aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib/ui.py
blob: 51c913eac791988ed04b0e271d13d30ae0b45183 (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.misc import MiscToolbarController
  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. drawing_area = self.find_widget_recursive(self.win, 'video_overlay_drawingarea')
  29. self.video_warning_overlay = VideoWarningOverlay(drawing_area)
  30. # Create Main-Video Display
  31. drawing_area = self.find_widget_recursive(self.win, 'video_main')
  32. self.main_video_display = VideoDisplay(drawing_area,
  33. port=11000,
  34. play_audio=Config.getboolean('mainvideo', 'playaudio'),
  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.misc_controller = MiscToolbarController(toolbar,
  55. win=self.win,
  56. uibuilder=self)
  57. def show(self):
  58. self.log.info('Showing Main-Window')
  59. self.win.show_all()