diff options
author | MaZderMind <git@mazdermind.de> | 2015-08-07 11:19:30 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-08-07 11:19:30 +0200 |
commit | d200e609432591c1f1b2422c96616b3bfd1ea0f4 (patch) | |
tree | f898124f0c9901fdb3c3f0e5caac05bd85a64ad0 | |
parent | 9eda09a1b66ceb3874c471910fc8c26874d2981e (diff) |
implement streamblank
-rw-r--r-- | voctogui/lib/toolbar/streamblank.py | 45 | ||||
-rw-r--r-- | voctogui/lib/ui.py | 8 |
2 files changed, 50 insertions, 3 deletions
diff --git a/voctogui/lib/toolbar/streamblank.py b/voctogui/lib/toolbar/streamblank.py new file mode 100644 index 0000000..074fb80 --- /dev/null +++ b/voctogui/lib/toolbar/streamblank.py @@ -0,0 +1,45 @@ +import logging +from gi.repository import Gtk + +class StreamblankToolbarController(object): + """ Manages Accelerators and Clicks on the Composition Toolbar-Buttons """ + + def __init__(self, drawing_area, win, uibuilder, warning_overlay): + self.log = logging.getLogger('StreamblankToolbarController') + + self.warning_overlay = warning_overlay + + blank_sources = ['pause', 'nostream'] + + + livebtn = uibuilder.find_widget_recursive(drawing_area, 'stream_live') + blankbtn = uibuilder.find_widget_recursive(drawing_area, 'stream_blank') + + blankbtn_pos = drawing_area.get_item_index(blankbtn) + + livebtn.connect('toggled', self.on_btn_toggled) + livebtn.set_name('live') + + for idx, name in enumerate(blank_sources): + if idx == 0: + new_btn = blankbtn + else: + new_icon = Gtk.Image.new_from_pixbuf(blankbtn.get_icon_widget().get_pixbuf()) + new_btn = Gtk.RadioToolButton(group=livebtn) + new_btn.set_icon_widget(new_icon) + drawing_area.insert(new_btn, blankbtn_pos+1) + + new_btn.set_label("Stream %s" % name) + new_btn.connect('toggled', self.on_btn_toggled) + new_btn.set_name(name) + + def on_btn_toggled(self, btn): + if not btn.get_active(): + return + + self.log.info("on_btn_toggled: %s", btn.get_name()) + if btn.get_name() == 'live': + self.warning_overlay.disable() + + else: + self.warning_overlay.enable(btn.get_name()) diff --git a/voctogui/lib/ui.py b/voctogui/lib/ui.py index 9143e12..f264284 100644 --- a/voctogui/lib/ui.py +++ b/voctogui/lib/ui.py @@ -13,7 +13,7 @@ from lib.videopreviews import VideoPreviewsController from lib.audioselector import AudioSelectorController from lib.toolbar.composition import CompositionToolbarController -# from lib.toolbar.streamblank import StreamblankToolbarController +from lib.toolbar.streamblank import StreamblankToolbarController # from lib.toolbar.specialfunctions import SpecialFunctionsToolbarController class Ui(UiBuilder): @@ -67,8 +67,10 @@ class Ui(UiBuilder): win=self.win, uibuilder=self) - # self.streamblank_toolbar_controller = StreamblankToolbarController(toolbar, - # warning_overlay=self.video_warning_overlay) + self.streamblank_toolbar_controller = StreamblankToolbarController(toolbar, + win=self.win, + uibuilder=self, + warning_overlay=self.video_warning_overlay) # self.special_functions_toolbar_controller = SpecialFunctionsToolbarController(toolbar, # video_display=self.main_video_display) |