From 16cfb8c85896d9b1d4ad9a0d92c28e8dcc1324ca Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Wed, 1 Jul 2015 22:12:53 +0200 Subject: Implement Preview-Selection --- voctogui/lib/ui.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'voctogui/lib') diff --git a/voctogui/lib/ui.py b/voctogui/lib/ui.py index 3d7cda7..628b96c 100644 --- a/voctogui/lib/ui.py +++ b/voctogui/lib/ui.py @@ -89,6 +89,9 @@ class Ui(UiBuilder): accelerators = Gtk.AccelGroup() self.win.add_accel_group(accelerators) + group_a = None + group_b = None + for idx, source in enumerate(sources): self.log.info('Initializing Video Preview %s', source) @@ -104,6 +107,20 @@ class Ui(UiBuilder): btn_a = self.find_widget_recursive(preview, 'btn_a') btn_b = self.find_widget_recursive(preview, 'btn_b') + btn_a.set_name("%c %u" % ('a', idx)) + btn_b.set_name("%c %u" % ('b', idx)) + + if not group_a: + group_a = btn_a + else: + btn_a.join_group(group_a) + + + if not group_b: + group_b = btn_b + else: + btn_b.join_group(group_b) + btn_a.connect('toggled', self.preview_btn_toggled) btn_b.connect('toggled', self.preview_btn_toggled) @@ -116,9 +133,11 @@ class Ui(UiBuilder): self.preview_players[source] = player self.previews[source] = preview - def preview_btn_toggled(self, btn): - self.log.info('preview_btn_toggled') + if not btn.get_active(): + return + + self.log.info('preview_btn_toggled: %s', btn.get_name()) def configure_audio_selector(self): self.log.info('Initializing Audio Selector') -- cgit v1.2.3