aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib/ui.py
blob: 0343c86baffc2aafd18e574fdbb3441b59f41f2a (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. win=self.win,
  40. uibuilder=self)
  41. drawing_area = self.find_widget_recursive(self.win, 'combo_audio')
  42. self.audio_selector_controller = AudioSelectorController(drawing_area,
  43. win=self.win,
  44. uibuilder=self)
  45. # Setup Toolbar Controllers
  46. toolbar = self.find_widget_recursive(self.win, 'toolbar')
  47. self.composition_toolbar_controller = CompositionToolbarController(toolbar,
  48. win=self.win,
  49. uibuilder=self)
  50. self.streamblank_toolbar_controller = StreamblankToolbarController(toolbar,
  51. win=self.win,
  52. uibuilder=self,
  53. warning_overlay=self.video_warning_overlay)
  54. self.special_functions_toolbar_controller = SpecialFunctionsToolbarController(toolbar,
  55. win=self.win,
  56. uibuilder=self,
  57. video_display=self.main_video_display)
  58. def show(self):
  59. self.log.info('Showing Main-Window')
  60. self.win.show_all()