Beispiel #1
0
    def itemChange(self, change, value):
        # for selection changes test against QGraphicsItem.ItemSelectedChange
        # intercept the change instead of the has changed to enable features.
        if change == QGraphicsItem.ItemSelectedChange and self.scene():
            viewroot = self._viewroot
            current_filter_dict = viewroot.selectionFilterDict()
            selection_group = viewroot.vhiHandleSelectionGroup()

            # only add if the selection_group is not locked out
            if value == True and self._filter_name in current_filter_dict:
                if self.group() != selection_group:
                    selection_group.pendToAdd(self)
                    selection_group.setSelectionLock(selection_group)
                    self.setSelectedColor(True)
                    return True
                else:
                    return False
            # end if
            elif value == True:
                # don't select
                return False
            else:
                # Deselect
                selection_group.pendToRemove(self)
                self.setSelectedColor(False)
                return False
            # end else
        # end if
        return QGraphicsEllipseItem.itemChange(self, change, value)
Beispiel #2
0
 def itemChange(self, change, value):
     #print('%s.itemChange' % (self.__class__.__name__), ' change: %d, value:' % change, value)
     valnew = QGraphicsEllipseItem.itemChange(self, change, value)
     if change == self.ItemSelectedHasChanged:
         #self.set_control_points_visible(visible=True)
         self.set_control_points_visible(visible=self.isSelected())
     return valnew
Beispiel #3
0
    def itemChange(self,    change: QGraphicsItem.GraphicsItemChange,
                            value: Any) -> bool:
        """Used for selection of the :class:`VirtualHelixHandleItem`

        Args:
            change: parameter that is changing
            value : new value whose type depends on the ``change`` argument

        Returns:
            If the change is a ``QGraphicsItem.ItemSelectedChange``::

                ``True`` if selected, other ``False``

            Otherwise default to :meth:`QGraphicsEllipseItem.itemChange()` result
        """
        if change == QGraphicsItem.ItemSelectedChange and self.scene():
            viewroot = self._viewroot
            current_filter_set = viewroot.selectionFilterSet()
            selection_group = viewroot.vhiHandleSelectionGroup()
            # print("filter set", current_filter_set, self.FILTER_NAME)
            # only add if the selection_group is not locked out
            if value == True and self.FILTER_NAME in current_filter_set:    # noqa
                if self.group() != selection_group:
                    if not selection_group.isPending(self):
                        selection_group.pendToAdd(self)
                        selection_group.setSelectionLock(selection_group)
                        self.setSelectedColor(True)
                        return False  # only select if mode says so
                    return True
                else:
                    return False
            # end if
            elif value == True:  # noqa
                # print("don't select", value)
                # don't select
                return False
            else:
                # Deselect
                # print("Deselect", value)
                selection_group.pendToRemove(self)
                self.setSelectedColor(False)
                return False
            # end else
        # end if
        else:
            return QGraphicsEllipseItem.itemChange(self, change, value)
Beispiel #4
0
    def itemChange(self, change, value):
        """For selection changes test against QGraphicsItem.ItemSelectedChange
        intercept the change instead of the has changed to enable features.

        Args:
            change (TYPE): Description
            value (TYPE): Description
        """

        if change == QGraphicsItem.ItemSelectedChange and self.scene():
            viewroot = self._viewroot
            current_filter_set = viewroot.selectionFilterSet()
            selection_group = viewroot.vhiHandleSelectionGroup()
            # print("filter set", current_filter_set, self.FILTER_NAME)
            # only add if the selection_group is not locked out
            if value == True and self.FILTER_NAME in current_filter_set:  # noqa
                if self.group() != selection_group:
                    if not selection_group.isPending(self):
                        selection_group.pendToAdd(self)
                        selection_group.setSelectionLock(selection_group)
                        self.setSelectedColor(True)
                        return False  # only select if mode says so
                    return True
                else:
                    return False
            # end if
            elif value == True:  # noqa
                # print("don't select", value)
                # don't select
                return False
            else:
                # Deselect
                # print("Deselect", value)
                selection_group.pendToRemove(self)
                self.setSelectedColor(False)
                return False
            # end else
        # end if
        else:
            return QGraphicsEllipseItem.itemChange(self, change, value)
    def itemChange(self, change, value):
        """For selection changes test against QGraphicsItem.ItemSelectedChange
        intercept the change instead of the has changed to enable features.

        Args:
            change (TYPE): Description
            value (TYPE): Description
        """

        if change == QGraphicsItem.ItemSelectedChange and self.scene():
            viewroot = self._viewroot
            current_filter_set = viewroot.selectionFilterSet()
            selection_group = viewroot.vhiHandleSelectionGroup()
            # print("filter set", current_filter_set, self.FILTER_NAME)
            # only add if the selection_group is not locked out
            if value == True and self.FILTER_NAME in current_filter_set:    # noqa
                if self.group() != selection_group:
                    if not selection_group.isPending(self):
                        selection_group.pendToAdd(self)
                        selection_group.setSelectionLock(selection_group)
                        self.setSelectedColor(True)
                        return False  # only select if mode says so
                    return True
                else:
                    return False
            # end if
            elif value == True:  # noqa
                # print("don't select", value)
                # don't select
                return False
            else:
                # Deselect
                # print("Deselect", value)
                selection_group.pendToRemove(self)
                self.setSelectedColor(False)
                return False
            # end else
        # end if
        else:
            return QGraphicsEllipseItem.itemChange(self, change, value)
Beispiel #6
0
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemPositionChange:
         self.path.updateElement(self.index, value.toPointF())
     return QGraphicsEllipseItem.itemChange(self, change, value)
Beispiel #7
0
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemPositionChange and self.scene():
         command = CommandMoveItem(self, value)
         self.scene().undoStack.push(command)
     return QGraphicsEllipseItem.itemChange(self, change, value)