def filterItems(item: QTreeWidgetItem) -> bool: op_class: type = item.data(1, Qt.UserRole) keep: bool = bool(item.parent()) if keep and issubclass(op_class, GraphOperation): keep &= op_class.minInputNumber() == op_class.maxInputNumber() == 1 \ and op_class.minOutputNumber() == 1 else: keep &= item.isHidden() return keep
def preset_for_item( self, item: QtWidgets.QTreeWidgetItem) -> Optional[VersionedPreset]: return self.window_manager.preset_manager.preset_for_uuid( item.data(0, Qt.UserRole))
def item_changed(item: QTreeWidgetItem, index: int): node = item.data(1, 0) selected = as_selection(item.checkState(index)) set_selection_down(node, selected) set_selection_up(node)
def _result_item_pressed(self, item: QTreeWidgetItem, column: int): if item.parent() is not self.result_tree: prx_index = self.fakom_tree.model().mapFromSource(item.data(0, Qt.UserRole)) if prx_index.isValid(): self.fakom_tree.scrollTo(prx_index, QAbstractItemView.PositionAtCenter)
def standardItem(w: QTreeWidgetItem) -> QStandardItem: s = QStandardItem() s.setData(w.data(0, Qt.DisplayRole), Qt.DisplayRole) s.setData(w.data(1, Qt.UserRole), Qt.UserRole) s.setData(w.data(0, Qt.ToolTipRole), Qt.ToolTipRole) return s