60
60
Tip = namedtuple ("Tip" , ["msg" , "pos" ])
61
61
62
62
63
+ class Shortcuts (QDialog ):
64
+ def __init__ (self , parent ):
65
+ super ().__init__ (parent = parent )
66
+ self .setParent (parent )
67
+ self .setWindowTitle ("Shortcuts" )
68
+ vlayout = QVBoxLayout ()
69
+ shortcuts = """
70
+ * `2` and `3`, to switch between labeling and selection mode
71
+ * `4`, to enable pan & zoom
72
+ * `M`, to cycle through regular (sequential), quick, and loop annotation mode
73
+ * `E`, to enable edge coloring
74
+ * `F`, to toggle between animal and body part color scheme
75
+ * `V`, to toggle visibility of the selected layer
76
+ * `backspace`, to delete a point
77
+ """
78
+ message = QLabel (shortcuts )
79
+ vlayout .addWidget (message )
80
+ self .setLayout (vlayout )
81
+
82
+
63
83
class Tutorial (QDialog ):
64
84
def __init__ (self , parent ):
65
85
super ().__init__ (parent = parent )
@@ -622,6 +642,11 @@ def __init__(self, napari_viewer):
622
642
launch_tutorial .triggered .connect (self .start_tutorial )
623
643
self .viewer .window .view_menu .addAction (launch_tutorial )
624
644
645
+ # Add action to view keyboard shortcuts
646
+ display_shortcuts = QAction ("&Shortcuts" , self )
647
+ display_shortcuts .triggered .connect (self .display_shortcuts )
648
+ self .viewer .window .help_menu .addAction (display_shortcuts )
649
+
625
650
# Hide some unused viewer buttons
626
651
self .viewer .window ._qt_viewer .viewerButtons .gridViewButton .hide ()
627
652
self .viewer .window ._qt_viewer .viewerButtons .rollDimsButton .hide ()
@@ -642,6 +667,9 @@ def settings(self):
642
667
def start_tutorial (self ):
643
668
Tutorial (self .viewer .window ._qt_window .current ()).show ()
644
669
670
+ def display_shortcuts (self ):
671
+ Shortcuts (self .viewer .window ._qt_window .current ()).show ()
672
+
645
673
def _move_image_layer_to_bottom (self , index ):
646
674
if (ind := index ) != 0 :
647
675
self .viewer .layers .move_selected (ind , 0 )
0 commit comments