def remove_selected_cmd(self, *args): item = self.ui.commandTree.currentItem() parent = item.parent() if parent: # cast QStrings to Python strings monitor.remove_command(str(parent.text(0)), str(item.text(0))) else: monitor.remove_command(str(item.text(0))) self.__init_commands()
def update_cmd(self, format, cmd): item = self.ui.commandTree.currentItem() old_format = item.parent().text(0) old_cmd = item.text(0) if format == old_format and cmd != old_cmd: monitor.remove_command(str(format), str(old_cmd)) monitor.add_command(str(format), str(cmd)) elif format != old_format and cmd == old_cmd: monitor.remove_command(str(old_format), str(cmd)) monitor.add_command(str(format), str(cmd)) elif format != old_format and cmd != old_cmd: monitor.remove_command(str(old_format), str(old_cmd)) monitor.add_command(str(format), str(cmd)) self.__init_commands() print monitor.commands