summaryrefslogtreecommitdiff
path: root/voctogui/lib/ui.py
blob: 451a619f431c365a5b0811d36813d5899ae8b77f (plain)
  1. #!/usr/bin/python3
  2. import gi, logging
  3. from gi.repository import Gtk, Gst, Gdk, GLib
  4. from lib.config import Config
  5. from lib.uibuilder import UiBuilder
  6. from lib.videodisplay import VideoDisplay
  7. from lib.audioleveldisplay import AudioLevelDisplay
  8. from lib.warningoverlay import VideoWarningOverlay
  9. from lib.videopreviews import VideoPreviewsController
  10. from lib.audioselector import AudioSelectorController
  11. from lib.toolbar.composition import CompositionToolbarController
  12. from lib.toolbar.streamblank import StreamblankToolbarController
  13. class Ui(UiBuilder):
  14. def __init__(self, uifile):
  15. self.log = logging.getLogger('Ui')
  16. super().__init__(uifile)
  17. def setup(self):
  18. self.log.info('Initializing Ui')
  19. # Aquire the Main-Window from the UI-File
  20. self.win = self.get_check_widget('window')
  21. # Connect Close-Handler
  22. self.win.connect('delete-event', Gtk.main_quit)
  23. # Create Audio-Level Display
  24. drawing_area = self.find_widget_recursive(self.win, 'audiolevel_main')
  25. self.audio_level_display = AudioLevelDisplay(drawing_area)
  26. # Create Main-Video Overlay Controller
  27. self.video_warning_overlay = VideoWarningOverlay()
  28. # Create Main-Video Display
  29. drawing_area = self.find_widget_recursive(self.win, 'video_main')
  30. self.main_video_display = VideoDisplay(drawing_area,
  31. port=11000,
  32. play_audio=Config.getboolean('mainvideo', 'playaudio'),
  33. draw_callback=self.video_warning_overlay.draw_callback,
  34. level_callback=self.audio_level_display.level_callback)
  35. # Setup Preview Controller
  36. drawing_area = self.find_widget_recursive(self.win, 'box_left')
  37. self.video_previews_controller = VideoPreviewsController(drawing_area,
  38. win=self.win,
  39. uibuilder=self)
  40. drawing_area = self.find_widget_recursive(self.win, 'combo_audio')
  41. self.audio_selector_controller = AudioSelectorController(drawing_area,
  42. win=self.win,
  43. uibuilder=self)
  44. # Setup Toolbar Controllers
  45. toolbar = self.find_widget_recursive(self.win, 'toolbar')
  46. self.composition_toolbar_controller = CompositionToolbarController(toolbar,
  47. win=self.win,
  48. uibuilder=self)
  49. self.streamblank_toolbar_controller = StreamblankToolbarController(toolbar,
  50. win=self.win,
  51. uibuilder=self,
  52. warning_overlay=self.video_warning_overlay)
  53. def show(self):
  54. self.log.info('Showing Main-Window')
  55. self.win.show_all()