def setActions(self, actions): self._actionList.clear() self._actions = [] for funcs, name, filename in actions: item = QListWidgetItem(name) item.setToolTip('\n'.join([func.description() for func in funcs])) item._action = [name, filename] self._actionList.addItem(item)
def _addAction(self, item=None): if item is None: for item in self._actionList.selectedItems(): self._addAction(item) return new_item = QListWidgetItem(item) new_item._action = item._action self._newActionList.addItem(new_item) self._newActionList.setCurrentItem(new_item, QItemSelectionModel.ClearAndSelect)
def setAttrs(self, name, actions, filenames, shortcut=''): names = dict([(z[2], z[1]) for z in actions]) self.setActions(actions) self.setName(name) self._newActionList.clear() self.setShortcut(shortcut) if filenames: for filename in filenames: item = QListWidgetItem(names.get(filename, translate('Shortcuts', '(Deleted)'))) item._action = [names.get(filename, ''), filename] self._newActionList.addItem(item)