Browse code

Add toggle-toolbar feature and hide-toolbar commandline parameter.

Moritz Meier authored on 20/05/2020 21:21:59 • José Fonseca committed on 11/07/2020 11:53:07
Showing 3 changed files

... ...
@@ -105,6 +105,7 @@ You can also pass the following options:
105 105
       F                         find
106 106
       Q                         quit
107 107
       P                         print
108
+      T                         toggle toolbar
108 109
       Escape                    halt animation
109 110
       Ctrl-drag                 zoom in/out
110 111
       Shift-drag                zooms an area
... ...
@@ -56,6 +56,10 @@ Shortcuts:
56 56
         '-g', '--geometry',
57 57
         action='store', dest='geometry',
58 58
         help='default window size in form WxH')
59
+    parser.add_argument(
60
+        '--hide-toolbar',
61
+        action='store_true', dest='hide_toolbar',
62
+        help='Hides the toolbar on start.')
59 63
 
60 64
     options = parser.parse_args()
61 65
     inputfile = options.inputfile
... ...
@@ -76,6 +80,9 @@ Shortcuts:
76 80
         else:
77 81
             win.open_file(inputfile)
78 82
 
83
+    if options.hide_toolbar:
84
+        win.uimanager.get_widget('/ToolBar').set_visible(False)
85
+
79 86
     if sys.platform != 'win32':
80 87
         # Reset KeyboardInterrupt SIGINT handler, so that glib loop can be stopped by it
81 88
         import signal
... ...
@@ -336,6 +336,12 @@ class DotWidget(Gtk.DrawingArea):
336 336
         if event.keyval == Gdk.KEY_p:
337 337
             self.on_print()
338 338
             return True
339
+        if event.keyval == Gdk.KEY_t:
340
+            # toggle toolbar visibility
341
+            win = widget.get_toplevel()
342
+            toolbar = win.uimanager.get_widget("/ToolBar")
343
+            toolbar.set_visible(not toolbar.get_visible())
344
+            return True
339 345
         return False
340 346
 
341 347
     print_settings = None