summaryrefslogtreecommitdiff
path: root/voctogui/lib/toolbar/specialfunctions.py
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-08-07 11:32:34 +0200
committerMaZderMind <git@mazdermind.de>2015-08-07 11:32:34 +0200
commit2aa635013174a8c73839d52d678e503eabed2900 (patch)
tree7aab1e6b67cc09a10c2641819d8d7db4bcc9e770 /voctogui/lib/toolbar/specialfunctions.py
parent74c0cf9f94ff4ab2a0490eb1819175d3daf0793c (diff)
parent4ba884d3a81d215b341b44626483f1df6f471762 (diff)
Merge branch 'great-refactoring'
Diffstat (limited to 'voctogui/lib/toolbar/specialfunctions.py')
-rw-r--r--voctogui/lib/toolbar/specialfunctions.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/voctogui/lib/toolbar/specialfunctions.py b/voctogui/lib/toolbar/specialfunctions.py
new file mode 100644
index 0000000..61fb6bf
--- /dev/null
+++ b/voctogui/lib/toolbar/specialfunctions.py
@@ -0,0 +1,33 @@
+import logging
+from gi.repository import Gtk
+
+class SpecialFunctionsToolbarController(object):
+ """ Manages Accelerators and Clicks on the Composition Toolbar-Buttons """
+
+ def __init__(self, drawing_area, win, uibuilder, video_display):
+ self.log = logging.getLogger('SpecialFunctionsToolbarController')
+
+ self.video_display = video_display
+
+ accelerators = Gtk.AccelGroup()
+ win.add_accel_group(accelerators)
+
+ composites = [
+ 'preview_fullscreen',
+ 'preview_freeze',
+ ]
+
+ for idx, name in enumerate(composites):
+ key, mod = Gtk.accelerator_parse('F%u' % (idx+10))
+ btn = uibuilder.find_widget_recursive(drawing_area, name)
+ btn.set_name(name)
+
+ # Thanks to http://stackoverflow.com/a/19739855/1659732
+ childbtn = btn.get_child()
+ childbtn.add_accelerator('clicked', accelerators, key, mod, Gtk.AccelFlags.VISIBLE)
+ childbtn.connect('button-press-event', self.on_btn_event)
+ childbtn.connect('button-release-event', self.on_btn_event)
+
+ def on_btn_event(self, btn, event):
+ self.log.info("on_btn_event: %s @ %s", event.type, btn.get_name())
+ # do sth. to self.video_display here