def mousePressEvent(self, event):
        anchor_item = self.scene.item_at(event.scenePos(),
                                         items.NodeAnchorItem,
                                         buttons=Qt.LeftButton)
        if anchor_item and event.button() == Qt.LeftButton:
            # Start a new link starting at item
            self.from_item = anchor_item.parentNodeItem()
            if isinstance(anchor_item, items.SourceAnchorItem):
                self.direction = NewLinkAction.FROM_SOURCE
                self.source_item = self.from_item
            else:
                self.direction = NewLinkAction.FROM_SINK
                self.sink_item = self.from_item

            event.accept()

            helpevent = QuickHelpTipEvent(
                self.tr("Create a new link"),
                self.
                tr('<h3>Create new link</h3>'
                   '<p>Drag a link to an existing node or release on '
                   'an empty spot to create a new node.</p>'
                   '<p>Hold Shift when releasing the mouse button to '
                   'edit connections.</p>'
                   #                        '<a href="help://orange-canvas/create-new-links">'
                   #                        'More ...</a>'
                   ))
            QCoreApplication.postEvent(self.document, helpevent)

            return True
        else:
            # Whoever put us in charge did not know what he was doing.
            self.cancel(self.ErrorReason)
            return False
Exemple #2
0
    def mousePressEvent(self, event):
        anchor_item = self.scene.item_at(event.scenePos(),
                                         items.NodeAnchorItem,
                                         buttons=Qt.LeftButton)
        if anchor_item and event.button() == Qt.LeftButton:
            # Start a new link starting at item
            self.from_item = anchor_item.parentNodeItem()
            if isinstance(anchor_item, items.SourceAnchorItem):
                self.direction = NewLinkAction.FROM_SOURCE
                self.source_item = self.from_item
            else:
                self.direction = NewLinkAction.FROM_SINK
                self.sink_item = self.from_item

            event.accept()

            helpevent = QuickHelpTipEvent(
                self.tr("Create a new link"),
                self.tr('<h3>Create new link</h3>'
                        '<p>Drag a link to an existing node or release on '
                        'an empty spot to create a new node.</p>'
                        '<p>Hold Shift when releasing the mouse button to '
                        'edit connections.</p>'
#                        '<a href="help://orange-canvas/create-new-links">'
#                        'More ...</a>'
                        )
            )
            QCoreApplication.postEvent(self.document, helpevent)

            return True
        else:
            # Whoever put us in charge did not know what he was doing.
            self.cancel(self.ErrorReason)
            return False
 def end(self):
     self.cleanup()
     # Remove the help tip set in mousePressEvent
     self.macro = None
     helpevent = QuickHelpTipEvent("", "")
     QCoreApplication.postEvent(self.document, helpevent)
     UserInteraction.end(self)
Exemple #4
0
 def end(self):
     self.cleanup()
     # Remove the help tip set in mousePressEvent
     self.macro = None
     helpevent = QuickHelpTipEvent("", "")
     QCoreApplication.postEvent(self.document, helpevent)
     UserInteraction.end(self)
Exemple #5
0
    def _stateChanged(self, future, state):
        """
        The `future` state has changed (called by :class:`Future`).
        """
        ev = StateChangedEvent(state)

        if self.thread() is QThread.currentThread():
            QCoreApplication.sendEvent(self, ev)
        else:
            QCoreApplication.postEvent(self, ev)
Exemple #6
0
    def _stateChanged(self, future, state):
        """
        The `future` state has changed (called by :class:`Future`).
        """
        ev = StateChangedEvent(state)

        if self.thread() is QThread.currentThread():
            QCoreApplication.sendEvent(self, ev)
        else:
            QCoreApplication.postEvent(self, ev)
Exemple #7
0
    def end(self):
        self.down_pos = None
        self.arrow_item = None
        self.annotation = None
        self.document.view().setCursor(Qt.ArrowCursor)

        # Clear the help tip
        helpevent = QuickHelpTipEvent("", "")
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.end(self)
    def end(self):
        self.down_pos = None
        self.arrow_item = None
        self.annotation = None
        self.document.view().setCursor(Qt.ArrowCursor)

        # Clear the help tip
        helpevent = QuickHelpTipEvent("", "")
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.end(self)
    def start(self):
        self.document.view().setCursor(Qt.CrossCursor)

        helpevent = QuickHelpTipEvent(
            self.tr("Click and drag to create a new arrow"),
            self.
            tr('<h3>New arrow annotation</h3>'
               '<p>Click and drag to create a new arrow annotation.</p>'
               #                    '<a href="help://orange-canvas/arrow-annotations>'
               #                    'More ...</a>'
               ))
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.start(self)
Exemple #10
0
        def on_done(f):
            assert f is future
            selfref = selfweakref()

            if selfref is None:
                return

            try:
                QCoreApplication.postEvent(selfref,
                                           QEvent(FutureWatcher.__FutureDone))
            except RuntimeError:
                # Ignore RuntimeErrors (when C++ side of QObject is deleted)
                # (? Use QObject.destroyed and remove the done callback ?)
                pass
Exemple #11
0
    def start(self):
        self.document.view().setCursor(Qt.CrossCursor)

        helpevent = QuickHelpTipEvent(
            self.tr("Click and drag to create a new arrow"),
            self.tr('<h3>New arrow annotation</h3>'
                    '<p>Click and drag to create a new arrow annotation.</p>'
#                    '<a href="help://orange-canvas/arrow-annotations>'
#                    'More ...</a>'
                    )
        )
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.start(self)
Exemple #12
0
    def start(self):
        self.document.view().setCursor(Qt.CrossCursor)

        helpevent = QuickHelpTipEvent(
            self.tr("单击此处,创建新的文本批注"),
            self.
            tr('<h3>新建文本批注</h3>'
               '<p>在画布上单击(并拖动以调整大小),创建新的文本注释项。</p>'
               # '<a href="help://orange-canvas/text-annotations">'
               # 'More ...</a>'
               ))
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.start(self)
Exemple #13
0
    def start(self):
        self.document.view().setCursor(Qt.CrossCursor)

        helpevent = QuickHelpTipEvent(
            self.tr("单击并拖动,创建新的箭头"),
            self.
            tr('<h3>新建箭头批注</h3>'
               '<p>单击并拖动,创建新的箭头批注。</p>'
               # '<a href="help://orange-canvas/arrow-annotations>'
               #'More ...</a>'
               ))
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.start(self)
Exemple #14
0
        def on_done(f):
            assert f is future
            selfref = selfweakref()

            if selfref is None:
                return

            try:
                QCoreApplication.postEvent(
                    selfref, QEvent(FutureWatcher.__FutureDone))
            except RuntimeError:
                # Ignore RuntimeErrors (when C++ side of QObject is deleted)
                # (? Use QObject.destroyed and remove the done callback ?)
                pass
    def end(self):
        if self.control is not None:
            self.scene.removeItem(self.control)

        self.control = None
        self.down_pos = None
        self.annotation_item = None
        self.annotation = None
        self.document.view().setCursor(Qt.ArrowCursor)

        # Clear the help tip
        helpevent = QuickHelpTipEvent("", "")
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.end(self)
    def start(self):
        self.document.view().setCursor(Qt.CrossCursor)

        helpevent = QuickHelpTipEvent(
            self.tr("Click to create a new text annotation"),
            self.
            tr('<h3>New text annotation</h3>'
               '<p>Click (and drag to resize) on the canvas to create '
               'a new text annotation item.</p>'
               #                    '<a href="help://orange-canvas/text-annotations">'
               #                    'More ...</a>'
               ))
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.start(self)
Exemple #17
0
    def end(self):
        if self.control is not None:
            self.scene.removeItem(self.control)

        self.control = None
        self.down_pos = None
        self.annotation_item = None
        self.annotation = None
        self.document.view().setCursor(Qt.ArrowCursor)

        # Clear the help tip
        helpevent = QuickHelpTipEvent("", "")
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.end(self)
Exemple #18
0
    def start(self):
        self.document.view().setCursor(Qt.CrossCursor)

        helpevent = QuickHelpTipEvent(
            self.tr("Click to create a new text annotation"),
            self.tr('<h3>New text annotation</h3>'
                    '<p>Click (and drag to resize) on the canvas to create '
                    'a new text annotation item.</p>'
#                    '<a href="help://orange-canvas/text-annotations">'
#                    'More ...</a>'
                    )
        )
        QCoreApplication.postEvent(self.document, helpevent)

        UserInteraction.start(self)
Exemple #19
0
 def start(self):
     QCoreApplication.postEvent(self, ExecuteCallEvent())
Exemple #20
0
 def start(self):
     QCoreApplication.postEvent(self, ExecuteCallEvent())
Exemple #21
0
 def start(self):
     QCoreApplication.postEvent(self, QEvent(Task.__ExecuteCall))
Exemple #22
0
 def __on_anchorClicked(self, anchor):
     ev = QuickHelpDetailRequestEvent(anchor.toString(), anchor)
     QCoreApplication.postEvent(self, ev)
 def __on_anchorClicked(self, anchor):
     ev = QuickHelpDetailRequestEvent(anchor.toString(), anchor)
     QCoreApplication.postEvent(self, ev)
Exemple #24
0
 def start(self):
     QCoreApplication.postEvent(self, QEvent(Task.__ExecuteCall))