diff options
author | MaZderMind <git@mazdermind.de> | 2015-08-07 08:38:58 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-08-07 08:38:58 +0200 |
commit | 9eda09a1b66ceb3874c471910fc8c26874d2981e (patch) | |
tree | 45f9cfb1732b3ef0218328b47d2328c27347583f /voctogui/lib/toolbar | |
parent | a753cd71a02cd64c3dd03bbf4d22b605bae82c7e (diff) |
implement audioselector, videopreviews and composition-toolbar
Diffstat (limited to 'voctogui/lib/toolbar')
-rw-r--r-- | voctogui/lib/toolbar/composition.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/voctogui/lib/toolbar/composition.py b/voctogui/lib/toolbar/composition.py new file mode 100644 index 0000000..0185b7d --- /dev/null +++ b/voctogui/lib/toolbar/composition.py @@ -0,0 +1,33 @@ +import logging +from gi.repository import Gtk + +class CompositionToolbarController(object): + """ Manages Accelerators and Clicks on the Composition Toolbar-Buttons """ + + def __init__(self, drawing_area, win, uibuilder): + self.log = logging.getLogger('CompositionToolbarController') + + accelerators = Gtk.AccelGroup() + 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 = uibuilder.find_widget_recursive(drawing_area, 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.on_btn_toggled) + + def on_btn_toggled(self, btn): + if not btn.get_active(): + return + + self.log.info("on_btn_toggled: %s", btn.get_name()) |