How to use the orange3.Orange.canvas.canvas.items.controlpoints.ControlPoint function in Orange3

To help you get started, we’ve selected a few Orange3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
margins = self.__margins
        rect = rect.adjusted(
            -margins.left(), -margins.top(), margins.right(), margins.bottom()
        )
        center = rect.center()
        cx, cy = center.x(), center.y()
        left, top, right, bottom = rect.left(), rect.top(), rect.right(), rect.bottom()

        self.controlPoint(ControlPoint.Left).setPos(left, cy)
        self.controlPoint(ControlPoint.Right).setPos(right, cy)
        self.controlPoint(ControlPoint.Top).setPos(cx, top)
        self.controlPoint(ControlPoint.Bottom).setPos(cx, bottom)

        self.controlPoint(ControlPoint.TopLeft).setPos(left, top)
        self.controlPoint(ControlPoint.TopRight).setPos(right, top)
        self.controlPoint(ControlPoint.BottomLeft).setPos(left, bottom)
        self.controlPoint(ControlPoint.BottomRight).setPos(right, bottom)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
def __pointsLayout(self):
        """Layout the control points
        """
        rect = self.__rect
        margins = self.__margins
        rect = rect.adjusted(
            -margins.left(), -margins.top(), margins.right(), margins.bottom()
        )
        center = rect.center()
        cx, cy = center.x(), center.y()
        left, top, right, bottom = rect.left(), rect.top(), rect.right(), rect.bottom()

        self.controlPoint(ControlPoint.Left).setPos(left, cy)
        self.controlPoint(ControlPoint.Right).setPos(right, cy)
        self.controlPoint(ControlPoint.Top).setPos(cx, top)
        self.controlPoint(ControlPoint.Bottom).setPos(cx, bottom)

        self.controlPoint(ControlPoint.TopLeft).setPos(left, top)
        self.controlPoint(ControlPoint.TopRight).setPos(right, top)
        self.controlPoint(ControlPoint.BottomLeft).setPos(left, bottom)
        self.controlPoint(ControlPoint.BottomRight).setPos(right, bottom)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
def __init__(self, parent=None, rect=None, constraints=0, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setFlag(QGraphicsItem.ItemIsFocusable)

        self.__rect = rect if rect is not None else QRectF()
        self.__margins = QMargins()
        points = [
            ControlPoint(self, ControlPoint.Left),
            ControlPoint(self, ControlPoint.Top),
            ControlPoint(self, ControlPoint.TopLeft),
            ControlPoint(self, ControlPoint.Right),
            ControlPoint(self, ControlPoint.TopRight),
            ControlPoint(self, ControlPoint.Bottom),
            ControlPoint(self, ControlPoint.BottomLeft),
            ControlPoint(self, ControlPoint.BottomRight),
        ]
        assert points == sorted(points, key=lambda p: p.anchor())

        self.__points = dict((p.anchor(), p) for p in points)

        if self.scene():
            self.__installFilter()

        for p in points:
            p.setFlag(QGraphicsItem.ItemIsFocusable)
            p.setFocusProxy(self)

        self.controlPoint(ControlPoint.Top).setConstraint(Qt.Vertical)
        self.controlPoint(ControlPoint.Bottom).setConstraint(Qt.Vertical)
        self.controlPoint(ControlPoint.Left).setConstraint(Qt.Horizontal)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
def __init__(self, parent=None, rect=None, constraints=0, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setFlag(QGraphicsItem.ItemIsFocusable)

        self.__rect = rect if rect is not None else QRectF()
        self.__margins = QMargins()
        points = [
            ControlPoint(self, ControlPoint.Left),
            ControlPoint(self, ControlPoint.Top),
            ControlPoint(self, ControlPoint.TopLeft),
            ControlPoint(self, ControlPoint.Right),
            ControlPoint(self, ControlPoint.TopRight),
            ControlPoint(self, ControlPoint.Bottom),
            ControlPoint(self, ControlPoint.BottomLeft),
            ControlPoint(self, ControlPoint.BottomRight),
        ]
        assert points == sorted(points, key=lambda p: p.anchor())

        self.__points = dict((p.anchor(), p) for p in points)

        if self.scene():
            self.__installFilter()

        for p in points:
            p.setFlag(QGraphicsItem.ItemIsFocusable)
            p.setFocusProxy(self)

        self.controlPoint(ControlPoint.Top).setConstraint(Qt.Vertical)
        self.controlPoint(ControlPoint.Bottom).setConstraint(Qt.Vertical)
        self.controlPoint(ControlPoint.Left).setConstraint(Qt.Horizontal)
        self.controlPoint(ControlPoint.Right).setConstraint(Qt.Horizontal)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
def sceneEventFilter(self, obj, event):
        try:
            obj = toGraphicsObjectIfPossible(obj)
            if isinstance(obj, ControlPoint):
                etype = event.type()
                if (
                    etype == QEvent.GraphicsSceneMousePress
                    and event.button() == Qt.LeftButton
                ):
                    self.__setActiveControl(obj)

                elif (
                    etype == QEvent.GraphicsSceneMouseRelease
                    and event.button() == Qt.LeftButton
                ):
                    self.__setActiveControl(None)

        except Exception:
            log.error("Error in 'ControlPointRect.sceneEventFilter'", exc_info=True)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
def __init__(self, parent=None, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setFlag(QGraphicsItem.ItemIsFocusable)

        self.__line = QLineF()
        self.__points = [
            ControlPoint(self, ControlPoint.TopLeft),  # TopLeft is line start
            ControlPoint(self, ControlPoint.BottomRight),  # line end
        ]

        self.__activeControl = None

        if self.scene():
            self.__installFilter()

        for p in self.__points:
            p.setFlag(QGraphicsItem.ItemIsFocusable)
            p.setFocusProxy(self)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
def __init__(self, parent=None, rect=None, constraints=0, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setFlag(QGraphicsItem.ItemIsFocusable)

        self.__rect = rect if rect is not None else QRectF()
        self.__margins = QMargins()
        points = [
            ControlPoint(self, ControlPoint.Left),
            ControlPoint(self, ControlPoint.Top),
            ControlPoint(self, ControlPoint.TopLeft),
            ControlPoint(self, ControlPoint.Right),
            ControlPoint(self, ControlPoint.TopRight),
            ControlPoint(self, ControlPoint.Bottom),
            ControlPoint(self, ControlPoint.BottomLeft),
            ControlPoint(self, ControlPoint.BottomRight),
        ]
        assert points == sorted(points, key=lambda p: p.anchor())

        self.__points = dict((p.anchor(), p) for p in points)

        if self.scene():
            self.__installFilter()

        for p in points:
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
def __pointsLayout(self):
        """Layout the control points
        """
        rect = self.__rect
        margins = self.__margins
        rect = rect.adjusted(
            -margins.left(), -margins.top(), margins.right(), margins.bottom()
        )
        center = rect.center()
        cx, cy = center.x(), center.y()
        left, top, right, bottom = rect.left(), rect.top(), rect.right(), rect.bottom()

        self.controlPoint(ControlPoint.Left).setPos(left, cy)
        self.controlPoint(ControlPoint.Right).setPos(right, cy)
        self.controlPoint(ControlPoint.Top).setPos(cx, top)
        self.controlPoint(ControlPoint.Bottom).setPos(cx, bottom)

        self.controlPoint(ControlPoint.TopLeft).setPos(left, top)
        self.controlPoint(ControlPoint.TopRight).setPos(right, top)
        self.controlPoint(ControlPoint.BottomLeft).setPos(left, bottom)
        self.controlPoint(ControlPoint.BottomRight).setPos(right, bottom)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / canvas / canvas / items / controlpoints.py View on Github external
def __pointsLayout(self):
        """Layout the control points
        """
        rect = self.__rect
        margins = self.__margins
        rect = rect.adjusted(
            -margins.left(), -margins.top(), margins.right(), margins.bottom()
        )
        center = rect.center()
        cx, cy = center.x(), center.y()
        left, top, right, bottom = rect.left(), rect.top(), rect.right(), rect.bottom()

        self.controlPoint(ControlPoint.Left).setPos(left, cy)
        self.controlPoint(ControlPoint.Right).setPos(right, cy)
        self.controlPoint(ControlPoint.Top).setPos(cx, top)
        self.controlPoint(ControlPoint.Bottom).setPos(cx, bottom)

        self.controlPoint(ControlPoint.TopLeft).setPos(left, top)
        self.controlPoint(ControlPoint.TopRight).setPos(right, top)
        self.controlPoint(ControlPoint.BottomLeft).setPos(left, bottom)
        self.controlPoint(ControlPoint.BottomRight).setPos(right, bottom)