summaryrefslogtreecommitdiff
path: root/portato/gui/windows
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-09-06 01:34:45 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-09-06 01:34:45 +0200
commit5214c805634169499365c9a096e1bf0519deaa28 (patch)
tree53413c841ba2f5bc93d463b94843d9b359d1a413 /portato/gui/windows
parentb8e6e9e1d438e185151c77dbe656df463c6fe24e (diff)
downloadportato-5214c805634169499365c9a096e1bf0519deaa28.tar.gz
portato-5214c805634169499365c9a096e1bf0519deaa28.tar.bz2
portato-5214c805634169499365c9a096e1bf0519deaa28.zip
Automatic loading of the external menu
Diffstat (limited to '')
-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):