summaryrefslogtreecommitdiff
path: root/voctogui/lib/ui.py
blob: fd40bb8775fde5bd9b4c48d65944bdd833e255fa (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.configure_video_previews()
  15. self.configure_audio_selector()
  16. def configure_video_previews(self):
  17. sources = ['cam1', 'cam2', 'grabber']
  18. box = self.get_check_widget('box_left')
  19. for source in sources:
  20. preview = self.get_check_widget('widget_preview', clone=True)
  21. #box.add(preview)
  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. def configure_audio_selector(self):
  26. combo = self.get_check_widget('combo_audio')
  27. combo.set_sensitive(True)
  28. liststore = self.get_check_widget('liststore_audio')
  29. liststore.clear()
  30. row = liststore.append()
  31. liststore.set(row, [0], ['foobar'])
  32. row = liststore.append('')
  33. liststore.set(row, [0], ['moofar'])
  34. combo.set_active_id('moofar')
  35. def show(self):
  36. self.win.show_all()