aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib/ui.py
blob: 553682c6193240f8870c199c31c1a24ce43c29f1 (plain)
  1. import gi, logging
  2. from gi.repository import Gtk, Gst, Gdk, GLib
  3. from lib.config import Config
  4. from lib.uibuilder import UiBuilder
  5. from lib.videodisplay import VideoDisplay
  6. from lib.audioleveldisplay import AudioLevelDisplay
  7. from lib.warningoverlay import VideoWarningOverlay
  8. from lib.videopreviews import VideoPreviewsController
  9. from lib.audioselector import AudioSelectorController
  10. from lib.toolbar.composition import CompositionToolbarController
  11. from lib.toolbar.streamblank import StreamblankToolbarController
  12. from lib.toolbar.misc import MiscToolbarController
  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. drawing_area = self.find_widget_recursive(self.win, 'video_overlay_drawingarea')
  28. self.video_warning_overlay = VideoWarningOverlay(drawing_area)
  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=Config.getboolean('mainvideo', 'playaudio'),
  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. self.misc_controller = MiscToolbarController(toolbar,
  54. win=self.win,
  55. uibuilder=self)
  56. def show(self):
  57. self.log.info('Showing Main-Window')
  58. self.win.show_all()