summaryrefslogtreecommitdiff
path: root/voctogui/lib/uibuilder.py
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-23 10:43:56 +0200
committerMaZderMind <github@mazdermind.de>2015-05-23 10:44:11 +0200
commite1fae24a3b145d42eaa40d62f7aed8f00d6bdf51 (patch)
treecb38d834e72435ab6e5aba48bcf1b0abed0ec703 /voctogui/lib/uibuilder.py
parentf59f27430b221fa5cd395ed6c747d282bcb18246 (diff)
basic gui
Diffstat (limited to 'voctogui/lib/uibuilder.py')
-rw-r--r--voctogui/lib/uibuilder.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/voctogui/lib/uibuilder.py b/voctogui/lib/uibuilder.py
new file mode 100644
index 0000000..8d8b245
--- /dev/null
+++ b/voctogui/lib/uibuilder.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python3
+import gi, logging
+from gi.repository import Gtk, Gst
+
+class UiBuilder(Gtk.Builder):
+ def __init__(self):
+ self.log = logging.getLogger('UiBuilder')
+ super().__init__()
+
+ def setup(self):
+ # Aquire the Main-Window from the UI-File
+ self.log.debug('Loading Main-Window "window" from .ui-File')
+ self.win = self.get_check_widget("window")
+
+ # Connect Close-Handler
+ self.win.connect("delete-event", Gtk.main_quit)
+
+ def show(self):
+ self.win.show_all()
+
+ def get_check_widget(self, widget_id):
+ widget = self.get_object(widget_id)
+ if not widget:
+ self.log.error('could not load required widget "%s" from the .ui-File', widget_id)
+ raise Exception('Widget not found in .ui-File')
+
+ return widget