diff options
author | MaZderMind <git@mazdermind.de> | 2015-11-15 19:18:28 +0100 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-11-15 19:18:28 +0100 |
commit | 96d9712579f49d57106ab1462e9571cfc53d222e (patch) | |
tree | 30f9b8a0ef838a165143321ff7e95667d1a5caff /voctogui/lib/toolbar | |
parent | 7061df44a9f2291c9a9147dea6878bbc1bd424d8 (diff) |
avoid re-reansmitting the same state again, fixes #20
Diffstat (limited to 'voctogui/lib/toolbar')
-rw-r--r-- | voctogui/lib/toolbar/composition.py | 6 | ||||
-rw-r--r-- | voctogui/lib/toolbar/streamblank.py | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/voctogui/lib/toolbar/composition.py b/voctogui/lib/toolbar/composition.py index f473ccf..a2b1f29 100644 --- a/voctogui/lib/toolbar/composition.py +++ b/voctogui/lib/toolbar/composition.py @@ -20,6 +20,7 @@ class CompositionToolbarController(object): ] self.composite_btns = {} + self.current_composition = None for idx, name in enumerate(composites): key, mod = Gtk.accelerator_parse('F%u' % (idx+1)) @@ -42,9 +43,14 @@ class CompositionToolbarController(object): return btn_name = btn.get_name() + if self.current_composition == btn_name: + self.log.info('composition-mode already active: %s', btn_name) + return + self.log.info('composition-mode activated: %s', btn_name) Connection.send('set_composite_mode', btn_name) def on_composite_mode(self, mode): self.log.info('on_composite_mode callback w/ mode %s', mode) + self.current_composition = mode self.composite_btns[mode].set_active(True) diff --git a/voctogui/lib/toolbar/streamblank.py b/voctogui/lib/toolbar/streamblank.py index 05a7018..ab71b17 100644 --- a/voctogui/lib/toolbar/streamblank.py +++ b/voctogui/lib/toolbar/streamblank.py @@ -29,6 +29,8 @@ class StreamblankToolbarController(object): blank_sources = Config.getlist('stream-blanker', 'sources') self.status_btns = {} + self.current_status = None + livebtn.connect('toggled', self.on_btn_toggled) livebtn.set_name('live') @@ -59,13 +61,17 @@ class StreamblankToolbarController(object): return btn_name = btn.get_name() - self.log.info('stream-status activated: %s', btn_name) if btn_name == 'live': self.warning_overlay.disable() else: self.warning_overlay.enable(btn_name) + if self.current_status == btn_name: + self.log.info('stream-status already activate: %s', btn_name) + return + + self.log.info('stream-status activated: %s', btn_name) if btn_name == 'live': Connection.send('set_stream_live') else: @@ -74,6 +80,7 @@ class StreamblankToolbarController(object): def on_stream_status(self, status, source = None): self.log.info('on_stream_status callback w/ status %s and source %s', status, source) + self.current_status = source if source is not None else status if status == 'live': self.livebtn.set_active(True) else: |