diff options
-rw-r--r-- | voctogui/lib/audioselector.py | 7 | ||||
-rwxr-xr-x | voctogui/voctogui.py | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/voctogui/lib/audioselector.py b/voctogui/lib/audioselector.py index 141ecc4..8196e33 100644 --- a/voctogui/lib/audioselector.py +++ b/voctogui/lib/audioselector.py @@ -26,10 +26,15 @@ class AudioSelectorController(object): for name in Config.getlist('mix', 'sources'): combo.append(name, name) - #combo.set_active_id(name) + # connect event-handler and request initial state + Connection.on('audio_status', self.on_audio_status) + Connection.send('get_audio') self.timer_iteration = 0 + def on_audio_status(self, source) + self.combo.set_active_id(name) + def on_button_press_event(self, combo, event): if event.type != Gdk.EventType.DOUBLE_BUTTON_PRESS: return diff --git a/voctogui/voctogui.py b/voctogui/voctogui.py index f867971..d37e168 100755 --- a/voctogui/voctogui.py +++ b/voctogui/voctogui.py @@ -103,18 +103,22 @@ def main(): logging.info('Python Version: %s', sys.version_info) logging.info('GStreamer Version: %s', Gst.version()) - # connect to server + # establish a synchronus connection to server Connection.establish( Config.get('server', 'host')) # fetch config from server Config.fetchServerConfig() + + # switch connection to nonblocking, event-driven mode Connection.enterNonblockingMode() # init main-class and main-loop + # (this binds all event-hander on the Connection) logging.debug('initializing Voctogui') voctogui = Voctogui() + # start the Mainloop and show the Window logging.debug('running Voctogui') voctogui.run() |