summaryrefslogtreecommitdiff
path: root/voctogui/lib/ui.py
blob: 7e7a5e641a1bb267baa6e1a4fdce5546b3fa3fc4 (plain)
  1. #!/usr/bin/python3
  2. import gi, logging
  3. from gi.repository import Gtk, Gst
  4. from lib.uibuilder import UiBuilder
  5. class Ui(UiBuilder):
  6. def __init__(self, uifile):
  7. self.log = logging.getLogger('Ui')
  8. super().__init__(uifile)
  9. def setup(self):
  10. # Aquire the Main-Window from the UI-File
  11. self.win = self.get_check_widget('window')
  12. # Connect Close-Handler
  13. self.win.connect('delete-event', Gtk.main_quit)
  14. self.previews = {}
  15. self.configure_video_previews()
  16. self.configure_audio_selector()
  17. def configure_video_previews(self):
  18. sources = ['cam1', 'cam2', 'grabber']
  19. box = self.get_check_widget('box_left')
  20. for source in sources:
  21. preview = self.get_check_widget('widget_preview', clone=True)
  22. box.pack_start(preview, fill=False, expand=False, padding=0)
  23. # http://stackoverflow.com/questions/3489520/python-gtk-widget-name
  24. self.find_widget_recursive(preview, "label").set_label(source)
  25. self.previews[source] = preview
  26. def configure_audio_selector(self):
  27. combo = self.get_check_widget('combo_audio')
  28. combo.set_sensitive(True)
  29. liststore = self.get_check_widget('liststore_audio')
  30. liststore.clear()
  31. row = liststore.append()
  32. liststore.set(row, [0], ['foobar'])
  33. row = liststore.append('')
  34. liststore.set(row, [0], ['moofar'])
  35. combo.set_active_id('moofar')
  36. def show(self):
  37. self.win.show_all()