From 8e58e2c810c3b1417575a9f13207558555adc582 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Tue, 6 Oct 2015 00:06:21 +0200 Subject: configure stream-blanker toolbar according to server's config --- voctogui/lib/toolbar/streamblank.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'voctogui/lib') diff --git a/voctogui/lib/toolbar/streamblank.py b/voctogui/lib/toolbar/streamblank.py index e1963c2..05a7018 100644 --- a/voctogui/lib/toolbar/streamblank.py +++ b/voctogui/lib/toolbar/streamblank.py @@ -1,6 +1,7 @@ import logging from gi.repository import Gtk +from lib.config import Config import lib.connection as Connection class StreamblankToolbarController(object): @@ -11,14 +12,23 @@ class StreamblankToolbarController(object): self.warning_overlay = warning_overlay - blank_sources = ['pause', 'nostream'] - self.status_btns = {} - 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) + if not Config.getboolean('stream-blanker', 'enabled'): + self.log.info('disabling stream-blanker features because the server does not support them: %s', Config.getboolean('stream-blanker', 'enabled')) + stream_blank_separator = uibuilder.find_widget_recursive(drawing_area, 'stream_blank_separator') + + drawing_area.remove(livebtn) + drawing_area.remove(blankbtn) + drawing_area.remove(stream_blank_separator) + return + + blank_sources = Config.getlist('stream-blanker', 'sources') + self.status_btns = {} + livebtn.connect('toggled', self.on_btn_toggled) livebtn.set_name('live') -- cgit v1.2.3