diff options
author | MaZderMind <git@mazdermind.de> | 2015-06-18 19:22:44 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-06-18 19:22:44 +0200 |
commit | 879321be42087978856d3f71f0fffb331bfa355a (patch) | |
tree | d10b366e53f7b7c6d5feb242e0ad209117ad791f /voctogui | |
parent | 1cf458baa8219a7f30d37a574f0201b0c7285ef1 (diff) |
Logging
Diffstat (limited to 'voctogui')
-rw-r--r-- | voctogui/lib/ui.py | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/voctogui/lib/ui.py b/voctogui/lib/ui.py index ebf412e..c8ae1c5 100644 --- a/voctogui/lib/ui.py +++ b/voctogui/lib/ui.py @@ -12,6 +12,8 @@ class Ui(UiBuilder): super().__init__(uifile) def setup(self): + self.log.info('Initializing Ui') + # Aquire the Main-Window from the UI-File self.win = self.get_check_widget('window') @@ -26,42 +28,72 @@ class Ui(UiBuilder): self.configure_audio_selector() def configure_video_main(self): + self.log.info('Initializing Main Video and Main Audio-Level View') + video = self.find_widget_recursive(self.win, 'video_main') audiolevel = self.find_widget_recursive(self.win, 'audiolevel_main') self.video_main_player = VideoDisplay(11000, video, audiolevel, playaudio=Config.getboolean('mainvideo', 'playaudio')) def configure_video_previews(self): + self.log.info('Initializing Video Previews') + sources = ['cam1', 'cam2', 'grabber'] box = self.find_widget_recursive(self.win, 'box_left') + try: + width = Config.getint('previews', 'width') + self.log.debug('Preview-Width configured to %u', width) + except: + width = 320 + self.log.debug('Preview-Width selected as %u', width) + + try: + height = Config.getint('previews', 'height') + self.log.debug('Preview-Height configured to %u', width) + except: + height = width*9/16 + self.log.debug('Preview-Height calculated to %u', width) + + + # Accelerators + accelerators = Gtk.AccelGroup() + self.win.add_accel_group(accelerators) + for idx, source in enumerate(sources): + self.log.info('Initializing Video Preview %s', source) + preview = self.get_check_widget('widget_preview', clone=True) video = self.find_widget_recursive(preview, 'video') - try: - width = Config.getint('previews', 'width') - except: - width = 320 - - try: - height = Config.getint('previews', 'height') - except: - height = width*9/16 - video.set_size_request(width, height) - box.pack_start(preview, fill=False, expand=False, padding=0) - # http://stackoverflow.com/questions/3489520/python-gtk-widget-name + player = VideoDisplay(13000 + idx, video) + self.find_widget_recursive(preview, 'label').set_label(source) + btn_a = self.find_widget_recursive(preview, 'btn_a') + btn_b = self.find_widget_recursive(preview, 'btn_b') - player = VideoDisplay(13000 + idx, video) + btn_a.connect('toggled', self.preview_btn_toggled) + btn_b.connect('toggled', self.preview_btn_toggled) + + key, mod = Gtk.accelerator_parse('%u' % (idx+1)) + btn_a.add_accelerator('activate', accelerators, key, mod, Gtk.AccelFlags.VISIBLE) + + key, mod = Gtk.accelerator_parse('<Ctrl>%u' % (idx+1)) + btn_b.add_accelerator('activate', accelerators, key, mod, Gtk.AccelFlags.VISIBLE) self.preview_players[source] = player self.previews[source] = preview + + def preview_btn_toggled(self, btn): + self.log.info('preview_btn_toggled') + def configure_audio_selector(self): + self.log.info('Initializing Audio Selector') + combo = self.find_widget_recursive(self.win, 'combo_audio') combo.set_sensitive(True) @@ -78,8 +110,11 @@ class Ui(UiBuilder): combo.set_active_id('moofar') def show(self): + self.log.info('Running Video-Playback Pipelines') + self.video_main_player.run() for name, player in self.preview_players.items(): player.run() + self.log.info('Showing Main-Window') self.win.show_all() |