summaryrefslogtreecommitdiff
path: root/portato/gui/windows/basic.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-09-06 01:46:45 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-09-06 01:46:45 +0200
commitaeffd6bb3e77545ac6de777c4b0c9f3024ae654f (patch)
tree2ab74d4b3b47fd35ec3a3b3f2f115a7430f9f006 /portato/gui/windows/basic.py
parentbf86fab5906e1466984d072cc9a0309b38b55a43 (diff)
parent30b9a89aaf90e5ea0edeadee6d6f1a9f05c40703 (diff)
downloadportato-aeffd6bb3e77545ac6de777c4b0c9f3024ae654f.tar.gz
portato-aeffd6bb3e77545ac6de777c4b0c9f3024ae654f.tar.bz2
portato-aeffd6bb3e77545ac6de777c4b0c9f3024ae654f.zip
Updated .ui files, so they work with the most up2date glade. Therefore moved action and menu declarations into an extra file and added some white magic to the UIBuilder class.
Diffstat (limited to 'portato/gui/windows/basic.py')
-rw-r--r--portato/gui/windows/basic.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/portato/gui/windows/basic.py b/portato/gui/windows/basic.py
index e7f48a6..cab2fb9 100644
--- a/portato/gui/windows/basic.py
+++ b/portato/gui/windows/basic.py
@@ -77,10 +77,24 @@ class UIBuilder (object):
if not hasattr(self, "__file__"):
self.__file__ = self.__class__.__name__
+ # general setup
self._builder = gtk.Builder()
self._builder.add_from_file(os.path.join(TEMPLATE_DIR, self.__file__+".ui"))
self._builder.set_translation_domain(APP)
+
+ self.tree = WrappedTree(self.__class__.__name__, self._builder)
+ # load menu if existing
+ menufile = os.path.join(TEMPLATE_DIR, self.__file__+".menu")
+ if os.path.exists(menufile):
+ debug("Menufile for '%s' exists.", self.__file__)
+ barbox = self.tree.get_widget("menubar_box")
+ if barbox is not None:
+ self._builder.add_from_file(menufile)
+ bar = self.tree.get_ui("menubar")
+ barbox.pack_start(bar, expand = False, fill = False)
+
+ # signal connections
if connector is None: connector = self
unconnected = self._builder.connect_signals(connector)
@@ -89,8 +103,6 @@ class UIBuilder (object):
for uc in set(unconnected):
error("Signal '%s' not connected in class '%s'.", uc, self.__class__.__name__)
- self.tree = WrappedTree(self.__class__.__name__, self._builder)
-
class Window (UIBuilder):
def __init__ (self):