summaryrefslogtreecommitdiff
path: root/voctogui
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-06-30 21:49:18 +0200
committerMaZderMind <git@mazdermind.de>2015-06-30 21:49:18 +0200
commit7aae42d2848f4f049d32ea38ddd769307470d069 (patch)
treed45428921d15e0ba349277ebd85b2ac3accfcc2c /voctogui
parent3690f8b0dc3fa142b28f7db0bb8243c54243eef9 (diff)
configure composition-mode accelerators
Diffstat (limited to 'voctogui')
-rw-r--r--voctogui/lib/ui.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/voctogui/lib/ui.py b/voctogui/lib/ui.py
index a75c1ba..2f81246 100644
--- a/voctogui/lib/ui.py
+++ b/voctogui/lib/ui.py
@@ -23,11 +23,39 @@ class Ui(UiBuilder):
self.previews = {}
self.preview_players = {}
+
+ self.configure_toolbar_accelerators()
self.configure_video_main()
self.configure_video_previews()
self.configure_audio_selector()
self.configure_streamblank_selector()
+ def configure_toolbar_accelerators(self):
+ accelerators = Gtk.AccelGroup()
+ self.win.add_accel_group(accelerators)
+
+ composites = [
+ 'composite-fullscreen',
+ 'composite-picture-in-picture',
+ 'composite-side-by-side-equal',
+ 'composite-side-by-side-preview'
+ ]
+
+ for idx, name in enumerate(composites):
+ key, mod = Gtk.accelerator_parse('F%u' % (idx+1))
+ btn = self.find_widget_recursive(self.win, name)
+ btn.set_name(name)
+
+ # Thanks to http://stackoverflow.com/a/19739855/1659732
+ btn.get_child().add_accelerator('clicked', accelerators, key, mod, Gtk.AccelFlags.VISIBLE)
+ btn.connect('toggled', self.toolbar_btn_toggled)
+
+ def toolbar_btn_toggled(self, btn):
+ if not btn.get_active():
+ return
+
+ print("btn toggled", btn.get_name())
+
def configure_video_main(self):
self.log.info('Initializing Main Video and Main Audio-Level View')