aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib/uibuilder.py
blob: 8d8b2458c357512b61e7446f266a24d03358c339 (plain)
  1. #!/usr/bin/python3
  2. import gi, logging
  3. from gi.repository import Gtk, Gst
  4. class UiBuilder(Gtk.Builder):
  5. def __init__(self):
  6. self.log = logging.getLogger('UiBuilder')
  7. super().__init__()
  8. def setup(self):
  9. # Aquire the Main-Window from the UI-File
  10. self.log.debug('Loading Main-Window "window" from .ui-File')
  11. self.win = self.get_check_widget("window")
  12. # Connect Close-Handler
  13. self.win.connect("delete-event", Gtk.main_quit)
  14. def show(self):
  15. self.win.show_all()
  16. def get_check_widget(self, widget_id):
  17. widget = self.get_object(widget_id)
  18. if not widget:
  19. self.log.error('could not load required widget "%s" from the .ui-File', widget_id)
  20. raise Exception('Widget not found in .ui-File')
  21. return widget