def add_command(self, name, desc, old=False, parent=None): if parent is None: parent = self.treeWidget self.changes() itemCommand = QTreeWidgetItem(parent) itemCommand.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsDragEnabled) itemCommand.isCommand = True itemCommand.filetypes = [] itemCommand.commands = [] itemCommand.path = "" itemCommand.commandMode = ComModes.BAT itemCommand.before = None itemCommand.after = None itemCommand.id = uuid.uuid4().int itemCommand.icon_path = None itemCommand.setText(0, name) itemCommand.setText(1, desc) if not old: self.treeWidget.setCurrentItem(itemCommand) self.treeWidget.editItem(itemCommand, 0) return itemCommand