diff options
author | MaZderMind <git@mazdermind.de> | 2015-07-01 22:12:53 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-07-01 22:12:53 +0200 |
commit | 16cfb8c85896d9b1d4ad9a0d92c28e8dcc1324ca (patch) | |
tree | 0df1002c7f15dbfee702eedccb2b864c85cbe605 /voctogui | |
parent | a0f71b884e86d4f07da57263ece50dd711fea641 (diff) |
Implement Preview-Selection
Diffstat (limited to 'voctogui')
-rw-r--r-- | voctogui/lib/ui.py | 23 | ||||
-rw-r--r-- | voctogui/ui/voctogui.ui | 6 |
2 files changed, 25 insertions, 4 deletions
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') diff --git a/voctogui/ui/voctogui.ui b/voctogui/ui/voctogui.ui index f163a87..418b834 100644 --- a/voctogui/ui/voctogui.ui +++ b/voctogui/ui/voctogui.ui @@ -353,7 +353,7 @@ </packing> </child> <child> - <object class="GtkToggleButton" id="btn_a"> + <object class="GtkRadioButton" id="btn_a"> <property name="label" translatable="yes">A</property> <property name="width_request">40</property> <property name="height_request">40</property> @@ -361,6 +361,7 @@ <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="margin_right">5</property> + <property name="draw-indicator">False</property> </object> <packing> <property name="expand">False</property> @@ -369,7 +370,7 @@ </packing> </child> <child> - <object class="GtkToggleButton" id="btn_b"> + <object class="GtkRadioButton" id="btn_b"> <property name="label" translatable="yes">B</property> <property name="width_request">40</property> <property name="height_request">40</property> @@ -377,6 +378,7 @@ <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="margin_right">5</property> + <property name="draw-indicator">False</property> </object> <packing> <property name="expand">False</property> |