From 7aae42d2848f4f049d32ea38ddd769307470d069 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Tue, 30 Jun 2015 21:49:18 +0200 Subject: configure composition-mode accelerators --- voctogui/lib/ui.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'voctogui/lib/ui.py') 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') -- cgit v1.2.3