def on_give_privileges(self, widget, error=None): self.frame.np.queue.put(slskmessages.CheckPrivileges()) if self.frame.np.privileges_left is None: days = _("Unknown") else: days = self.frame.np.privileges_left // 60 // 60 // 24 message = _("Give how many days of global privileges to this user?" ) + " (" + _("%(days)s days left") % { 'days': days } + ")" if error: message += "\n\n" + error days = entry_dialog( self.frame.MainWindow, _("Give privileges") + " " + _("to %(user)s") % {"user": self.user}, message) if days: try: days = int(days) self.frame.np.queue.put( slskmessages.GivePrivileges(self.user, days)) except ValueError: self.on_give_privileges( widget, error=_("Please enter a whole number!"))
def on_edit_comments(self, widget): user = self.popup_menu.get_user() for i in self.usersmodel: if i[2] == user: comments = i[9] break else: comments = "" comments = entry_dialog(self.frame.MainWindow, _("Edit comments") + "...", _("Comments") + ":", comments) if comments is not None: for i in self.usersmodel: if i[2] == user: i[9] = comments self.usersmodel.set(i.iter, 9, comments) break self.save_user_list()
def on_give_privileges(self, widget): self.frame.np.queue.put(slskmessages.CheckPrivileges()) if self.frame.np.privileges_left is None: days = _("Unknown") else: days = self.frame.np.privileges_left // 60 // 60 // 24 text = entry_dialog( self.frame.MainWindow, _("Give privileges") + " " + _("to %(user)s") % {"user": self.user}, _("Give how many days of global privileges to this user?") + " (" + _("%(days)s days left") % {'days': days} + ")") if text: try: days = int(text) self.frame.np.queue.put( slskmessages.GivePrivileges(self.user, days)) except Exception as e: log.add_warning("%s", e)