summaryrefslogtreecommitdiff
path: root/voctogui
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-11-15 19:18:28 +0100
committerMaZderMind <git@mazdermind.de>2015-11-15 19:18:28 +0100
commit96d9712579f49d57106ab1462e9571cfc53d222e (patch)
tree30f9b8a0ef838a165143321ff7e95667d1a5caff /voctogui
parent7061df44a9f2291c9a9147dea6878bbc1bd424d8 (diff)
avoid re-reansmitting the same state again, fixes #20
Diffstat (limited to 'voctogui')
-rw-r--r--voctogui/lib/toolbar/composition.py6
-rw-r--r--voctogui/lib/toolbar/streamblank.py9
-rw-r--r--voctogui/lib/videopreviews.py9
3 files changed, 23 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:
diff --git a/voctogui/lib/videopreviews.py b/voctogui/lib/videopreviews.py
index 1afaa52..d80541f 100644
--- a/voctogui/lib/videopreviews.py
+++ b/voctogui/lib/videopreviews.py
@@ -20,6 +20,8 @@ class VideoPreviewsController(object):
self.a_btns = {}
self.b_btns = {}
+ self.current_source = {'a': None, 'b': None}
+
try:
width = Config.getint('previews', 'width')
self.log.debug('Preview-Width configured to %u', width)
@@ -105,6 +107,10 @@ class VideoPreviewsController(object):
channel, idx = btn_name.split(' ')[:2]
source_name = self.sources[int(idx)]
+ if self.current_source[channel] == source_name:
+ self.log.info('video-channel %s already on %s', channel, source_name)
+ return
+
self.log.info('video-channel %s changed to %s', channel, source_name)
Connection.send('set_video_'+channel, source_name)
@@ -121,5 +127,8 @@ class VideoPreviewsController(object):
def on_video_status(self, source_a, source_b):
self.log.info('on_video_status callback w/ sources: %s and %s', source_a, source_b)
+ self.current_source['a'] = source_a
+ self.current_source['b'] = source_b
+
self.a_btns[source_a].set_active(True)
self.b_btns[source_b].set_active(True)