aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib/ui.py
blob: 92d06921168d4a5a4efb9cae6ec23419b4af78e8 (plain)
  1. import gi
  2. import 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,
  29. 'video_overlay_drawingarea')
  30. self.video_warning_overlay = VideoWarningOverlay(drawing_area)
  31. # Create Main-Video Display
  32. drawing_area = self.find_widget_recursive(self.win, 'video_main')
  33. self.main_video_display = VideoDisplay(
  34. drawing_area,
  35. port=11000,
  36. play_audio=Config.getboolean('mainvideo', 'playaudio'),
  37. level_callback=self.audio_level_display.level_callback
  38. )
  39. # Setup Preview Controller
  40. drawing_area = self.find_widget_recursive(self.win, 'box_left')
  41. self.video_previews_controller = VideoPreviewsController(
  42. drawing_area,
  43. win=self.win,
  44. uibuilder=self
  45. )
  46. drawing_area = self.find_widget_recursive(self.win, 'combo_audio')
  47. self.audio_selector_controller = AudioSelectorController(
  48. drawing_area,
  49. win=self.win,
  50. uibuilder=self
  51. )
  52. # Setup Toolbar Controllers
  53. toolbar = self.find_widget_recursive(self.win, 'toolbar')
  54. self.composition_toolbar_controller = CompositionToolbarController(
  55. toolbar,
  56. win=self.win,
  57. uibuilder=self
  58. )
  59. self.streamblank_toolbar_controller = StreamblankToolbarController(
  60. toolbar,
  61. win=self.win,
  62. uibuilder=self,
  63. warning_overlay=self.video_warning_overlay
  64. )
  65. self.misc_controller = MiscToolbarController(
  66. toolbar,
  67. win=self.win,
  68. uibuilder=self
  69. )
  70. def show(self):
  71. self.log.info('Showing Main-Window')
  72. self.win.show_all()