summaryrefslogtreecommitdiff
path: root/voctogui/lib/ui.py
blob: 134bc2cdab6e45b345332e4a0ea85bf81250f32b (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. # from lib.toolbar.specialfunctions import SpecialFunctionsToolbarController
  14. class Ui(UiBuilder):
  15. def __init__(self, uifile):
  16. self.log = logging.getLogger('Ui')
  17. super().__init__(uifile)
  18. def setup(self):
  19. self.log.info('Initializing Ui')
  20. # Aquire the Main-Window from the UI-File
  21. self.win = self.get_check_widget('window')
  22. # Connect Close-Handler
  23. self.win.connect('delete-event', Gtk.main_quit)
  24. # Create Audio-Level Display
  25. drawing_area = self.find_widget_recursive(self.win, 'audiolevel_main')
  26. self.audio_level_display = AudioLevelDisplay(drawing_area)
  27. # Create Main-Video Overlay Controller
  28. self.video_warning_overlay = VideoWarningOverlay()
  29. # Create Main-Video Display
  30. drawing_area = self.find_widget_recursive(self.win, 'video_main')
  31. self.main_video_display = VideoDisplay(drawing_area,
  32. port=11000,
  33. play_audio=True,
  34. draw_callback=self.video_warning_overlay.draw_callback,
  35. level_callback=self.audio_level_display.level_callback)
  36. # Setup Preview Controller
  37. # drawing_area = self.find_widget_recursive(self.win, 'box_left')
  38. # self.video_previews_controller = VideoPreviewsController(drawing_area)
  39. # drawing_area = self.find_widget_recursive(self.win, 'combo_audio')
  40. # self.audio_selector_controller = AudioSelectorController(drawing_area)#
  41. # # Setup Toolbar Controllers
  42. # toolbar = self.find_widget_recursive(self.win, 'toolbar')
  43. # self.composition_toolbar_controller = CompositionToolbarController(toolbar)
  44. # self.streamblank_toolbar_controller = StreamblankToolbarController(toolbar,
  45. # warning_overlay=self.video_warning_overlay)
  46. # self.special_functions_toolbar_controller = SpecialFunctionsToolbarController(toolbar,
  47. # video_display=self.main_video_display)
  48. def show(self):
  49. self.log.info('Showing Main-Window')
  50. self.win.show_all()