Ejemplo n.º 1
0
 def selectionChanged(
     self, selected: QItemSelection, deselected: QItemSelection
 ):
     """The Qt Selection has changed. Update the python model."""
     s = self._root.selection
     s.difference_update(i.internalPointer() for i in deselected.indexes())
     s.update(i.internalPointer() for i in selected.indexes())
     return super().selectionChanged(selected, deselected)
Ejemplo n.º 2
0
 def selectionChanged(
     self: QAbstractItemView,
     selected: QItemSelection,
     deselected: QItemSelection,
 ):
     """The Qt Selection has changed. Update the python model."""
     s = self._root.selection
     s.difference_update(i.data(Qt.UserRole) for i in deselected.indexes())
     s.update(i.data(Qt.UserRole) for i in selected.indexes())
     return super().selectionChanged(selected, deselected)
Ejemplo n.º 3
0
    def selectionChanged(
        self: QAbstractItemView,
        selected: QItemSelection,
        deselected: QItemSelection,
    ):
        """The Qt Selection has changed. Update the python model."""
        sel = {i.data(ItemRole) for i in selected.indexes()}
        desel = {i.data(ItemRole) for i in deselected.indexes()}

        if not self._root.selection.events.changed._emitting:
            self._root.selection.update(sel)
            self._root.selection.difference_update(desel)
        return super().selectionChanged(selected, deselected)
Ejemplo n.º 4
0
 def selectionChanged(self, selected: QItemSelection,
                      deselected: QItemSelection) -> None:
     selected_indexes = selected.indexes()
     if not selected_indexes:
         return
     index = selected_indexes[0]
     self._activate(index)
Ejemplo n.º 5
0
    def _on_tree_selection(self, selected: QItemSelection,
                           deselected: QItemSelection):
        item = self.model.itemFromIndex(selected.indexes()[0])
        self.thumb_grid.set_item(item)

        if item.isImage():
            QCoreApplication.processEvents()
            self.load_image(item.wrapper)
Ejemplo n.º 6
0
    def selectionChanged(self, selected: QItemSelection, deselected: QItemSelection):
        selected_indexes = selected.indexes()
        if not selected_indexes:
            return
        data = selected_indexes[0].data(BrokerModel.broker_role)
        if data and data != self._current_broker:
            print(data)
            self._current_broker = data
            self.sigCurrentBrokerChanged.emit(data)

        super(BrokerView, self).selectionChanged(selected, deselected)
Ejemplo n.º 7
0
 def layer_selection_changed(self, selected: QtCore.QItemSelection,
                             deselected: QtCore.QItemSelection) -> None:
     if self.suppress_sel_change:
         return
     layer_index = selected.indexes()[0].row()
     self.win.changeViewLayer(self.win.project.stackup.layers[layer_index])