Commits

Aleš Erjavec committed 6fdc8b2

Added a keyboard shortcut to raise the main canvas window.

Comments (0)

Files changed (2)

Orange/OrangeCanvas/document/schemeedit.py

 from ..scheme import (
     scheme, signalmanager, SchemeNode, SchemeLink, BaseSchemeAnnotation
 )
+from ..scheme import widgetsscheme
 from ..canvas.scene import CanvasScene
 from ..canvas.view import CanvasView
 from ..canvas import items
             if event.type() == QEvent.WhatsThisClicked:
                 # Re post the event
                 self.__showHelpFor(event.href())
+            elif event.type() == \
+                    widgetsscheme.ActivateParentEvent.ActivateParent:
+                self.window().activateWindow()
+                self.window().raise_()
 
         return QWidget.eventFilter(self, obj, event)
 

Orange/OrangeCanvas/scheme/widgetsscheme.py

         help_shortcut = QShortcut(QKeySequence("F1"), widget)
         help_shortcut.activated.connect(self.__on_help_request)
 
+        # Up shortcut (activate/open parent)
+        up_shortcut = QShortcut(
+            QKeySequence(Qt.ControlModifier + Qt.Key_Up), widget)
+        up_shortcut.activated.connect(self.__on_activate_parent)
+
         return widget
 
     def node_processing_state(self, node):
             event = QWhatsThisClickedEvent(url)
             QCoreApplication.sendEvent(self.scheme(), event)
 
+    def __on_activate_parent(self):
+        """
+        Activate parent shortcut was pressed.
+        """
+        event = ActivateParentEvent()
+        QCoreApplication.sendEvent(self.scheme(), event)
+
     def __initialize_widget_state(self, node, widget):
         """
         Initialize the tracked info/warning/error message state.
     widget.setErrorMessage(message)
     return widget
 
+
+class ActivateParentEvent(QEvent):
+    ActivateParent = QEvent.registerEventType()
+
+    def __init__(self):
+        QEvent.__init__(self, self.ActivateParent)