summaryrefslogtreecommitdiff
path: root/portato/gui/windows
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-04-19 19:47:26 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-04-19 19:47:26 +0200
commit6021507f58e9a30cb0324270c8e27aa0a0691a8c (patch)
tree55157b84f2a4a2e85b2da0c7c9161711519f54b9 /portato/gui/windows
parent43a537bb875381576fd8782884d1079080e1d592 (diff)
parent8ab3b62a6cd6b0d96409cd2cb0c9ef3150ebc1ab (diff)
downloadportato-6021507f58e9a30cb0324270c8e27aa0a0691a8c.tar.gz
portato-6021507f58e9a30cb0324270c8e27aa0a0691a8c.tar.bz2
portato-6021507f58e9a30cb0324270c8e27aa0a0691a8c.zip
Merge branch '0.14'
* 0.14: Remove unused pythonic eix parser implementation Connect the accels from the menu. Replace 'Portage Warning' by 'External Warning' Updated italian translation. Thx to Ponsi Conflicts: portato/eix/py_parser.py
Diffstat (limited to 'portato/gui/windows')
-rw-r--r--portato/gui/windows/basic.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/portato/gui/windows/basic.py b/portato/gui/windows/basic.py
index 3f8c535..ecd34f1 100644
--- a/portato/gui/windows/basic.py
+++ b/portato/gui/windows/basic.py
@@ -72,7 +72,7 @@ class WrappedTree (object):
error("UIItem '%s' of UIManager '%s' could not be found in class '%s'.", name, ui, self.klass)
return w
-class UIBuilder (object):
+class Window (object):
def __init__ (self, connector = None):
if not hasattr(self, "__file__"):
@@ -85,15 +85,18 @@ class UIBuilder (object):
self.tree = WrappedTree(self.__class__.__name__, self._builder)
+ if not hasattr(self, "__window__"):
+ self.__window__ = self.__class__.__name__
+
+ self.window = self.tree.get_widget(self.__window__)
+
# load menu if existing
menufile = os.path.join(TEMPLATE_DIR, self.__file__+".menu")
if os.path.exists(menufile):
debug("There is a menu-file for '%s'. Trying to load it.", 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)
+ self._add_menu(menufile, barbox)
# signal connections
if connector is None: connector = self
@@ -104,15 +107,16 @@ class UIBuilder (object):
for uc in set(unconnected):
error("Signal '%s' not connected in class '%s'.", uc, self.__class__.__name__)
-class Window (UIBuilder):
- def __init__ (self):
+ def _add_menu (self, menufile, barbox):
+ # add menubar
+ self._builder.add_from_file(menufile)
+ bar = self.tree.get_ui("menubar")
+ barbox.pack_start(bar, expand = False, fill = False)
- UIBuilder.__init__(self)
-
- if not hasattr(self, "__window__"):
- self.__window__ = self.__class__.__name__
-
- self.window = self.tree.get_widget(self.__window__)
+ # connect accelerators
+ for ui in self._builder.get_objects():
+ if isinstance(ui, gtk.UIManager):
+ self.window.add_accel_group(ui.get_accel_group())
@staticmethod
def watch_cursor (func):