summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to 'portato')
-rw-r--r--portato/gui/templates/MainWindow.ui12
-rw-r--r--portato/gui/windows/basic.py16
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):