def resetDocumentAndController(self, document: DocT): """ Args: document: model :class:`Document` """ self._document = document self._controller = ViewRootController(self, document)
def configure(self, window: WindowT, document: DocT): """ Args: window: Description document: Description """ self._window = window self._document = document self._controller = ViewRootController(self, document) self._root = self.invisibleRootItem() # Appearance self.setFont(_FONT) # Columns self.setColumnCount(2) self.setIndentation(14) # Header self.setHeaderLabels(["Property", "Value"]) h = self.header() h.resizeSection(0, 200) h.resizeSection(1, 100) h.setSectionResizeMode(QHeaderView.Interactive) # h.setStretchLastSection(False) custom_delegate = CustomStyleItemDelegate(self) self.setItemDelegate(custom_delegate) self.model().dataChanged.connect(self.dataChangedSlot) self.hide()
def resetDocumentAndController(self, document: DocT): """ Args: document: Description """ self._document = document self._controller = ViewRootController(self, document)
def configure(self, window: WindowT, document: DocT): self._window = window self._document = document self._controller = ViewRootController(self, document) self._root = self.invisibleRootItem() # access to top level item self._instance_items = {} self.are_signals_enabled = True # Appearance self.setFont(_FONT) # Columns self.setColumnCount(3) self.setIndentation(14) # Header self.setHeaderLabels(["Name", "", "", ""]) h = self.header() h.setStretchLastSection(False) h.setSectionResizeMode(0, QHeaderView.Stretch) h.setSectionResizeMode(1, QHeaderView.Fixed) h.setSectionResizeMode(2, QHeaderView.Fixed) h.setSectionResizeMode(3, QHeaderView.Fixed) h.setSectionsMovable(True) self.setColumnWidth(0, 120) self.setColumnWidth(1, 18) self.setColumnWidth(2, 18) self.setColumnWidth(3, 18) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.getCustomContextMenu) # Dragging self.setDragEnabled(True) self.setDragDropMode(QAbstractItemView.InternalMove) self.setSelectionMode(QAbstractItemView.ExtendedSelection) # self.setSelectionMode(QAbstractItemView.MultiSelection) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.model_selection_changes = (set(), set()) self.is_child_adding = 0 custom_delegate = CustomStyleItemDelegate(self) self.setItemDelegate(custom_delegate) self.selectionModel().selectionChanged.connect(self.selectionFilter) '''Temporarily disable the selectionFilter with this so you dont get double events ''' self.selection_filter_disabled = False # the :class:`QAbstractItemModel` of this :class:`QTreeWidget` self.model().dataChanged.connect(self.dataChangedSlot) self.itemClicked.connect(self.itemClickedHandler)
def resetDocumentAndController(self, document: DocT): """ Args: document: Document Raises: ImportError: Description """ self._document = document self._controller = ViewRootController(self, document) if len(self.instance_items) > 0: raise ImportError
def __init__(self, rect: QRectF, parent: QGraphicsItem, window: WindowT, document: DocT): """ Args: rect: Rectangle of this item parent: parent object window: DocumentWindow document: Document """ super(SliceRootItem, self).__init__(rect, parent) self._window = window self._document = document self._controller = ViewRootController(self, document) self.instance_items = {} self.manager = None self.select_tool = None self.are_signals_on = True self.setFlag(QGraphicsItem.ItemHasNoContents)
def __init__(self, rect: QRectF, parent: QGraphicsItem, window: WindowT, document: DocT): """ Args: rect: Rectangle of this item parent: parent object window: CNMainWindow document: Document """ super(GridRootItem, self).__init__(rect, parent) self._window: WindowT = window self._document: DocT = document self._controller: ViewRootController = ViewRootController( self, document) self.instance_items: dict = {} self.manager: GridToolManagerT = None self.select_tool: AbstractGridToolT = None self.are_signals_on: bool = True self.setFlag(QGraphicsItem.ItemHasNoContents)
def __init__(self, rect: QRectF, parent: QGraphicsItem, window: WindowT, document: DocT): """ Args: rect: Rectangle of this item parent: parent object window: CNMainWindow document: Document """ super(PathRootItem, self).__init__(rect, parent) self._window = window self._document = document self._controller = ViewRootController(self, document) self._part_item_for_part_instance = {} # Maps Part -> PartItem self._prexover_filter = None self.manager = None self.select_tool = None self.are_signals_on: bool = True self.setFlag(QGraphicsItem.ItemHasNoContents)
def resetDocumentAndController(self, document: DocT): """docstring for resetDocumentAndController""" self._document = document self._controller = ViewRootController(self, document) if len(self._instance_items) > 0: raise ImportError