diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2009-09-06 01:34:45 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2009-09-06 01:34:45 +0200 |
commit | 5214c805634169499365c9a096e1bf0519deaa28 (patch) | |
tree | 53413c841ba2f5bc93d463b94843d9b359d1a413 | |
parent | b8e6e9e1d438e185151c77dbe656df463c6fe24e (diff) | |
download | portato-5214c805634169499365c9a096e1bf0519deaa28.tar.gz portato-5214c805634169499365c9a096e1bf0519deaa28.tar.bz2 portato-5214c805634169499365c9a096e1bf0519deaa28.zip |
Automatic loading of the external menu
Diffstat (limited to '')
-rw-r--r-- | portato/gui/templates/MainWindow.ui | 12 | ||||
-rw-r--r-- | portato/gui/windows/basic.py | 16 |
2 files changed, 25 insertions, 3 deletions
diff --git a/portato/gui/templates/MainWindow.ui b/portato/gui/templates/MainWindow.ui index f971d47..0455cfe 100644 --- a/portato/gui/templates/MainWindow.ui +++ b/portato/gui/templates/MainWindow.ui @@ -13,7 +13,17 @@ <property name="visible">True</property> <property name="orientation">vertical</property> <child> - <placeholder/> + <object class="GtkVBox" id="menubar_box"> + <property name="visible">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkHBox" id="searchHB"> 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): |