diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2009-04-24 18:34:21 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2009-04-24 18:34:21 +0200 |
commit | 4c1d61cb71a396f09969ed264c91ebfff29145c1 (patch) | |
tree | ab8c3dd828b90b49551cfc1b34fba9ccb9da4887 | |
parent | ab69d8ac22a4548a55d3fbb4f5d8e7aff77df293 (diff) | |
download | portato-4c1d61cb71a396f09969ed264c91ebfff29145c1.tar.gz portato-4c1d61cb71a396f09969ed264c91ebfff29145c1.tar.bz2 portato-4c1d61cb71a396f09969ed264c91ebfff29145c1.zip |
Create PluginMenuSlot
Diffstat (limited to '')
-rw-r--r-- | portato/gui/windows/main.py | 22 | ||||
-rw-r--r-- | portato/plugin.py | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 6a65d2e..cb463c8 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -50,6 +50,27 @@ from .preference import PreferenceWindow from .search import SearchWindow from .update import UpdateWindow +class PluginMenuSlot (plugin.WidgetSlot): + + def __init__ (self, tree): + plugin.WidgetSlot.__init__(self, self.create_action, "Plugin Menu") + + self.ctr = 0 # counter for the plugin actions + self.uim = tree.get_widget("uimanager") + self.ag = tree.get_widget("pluginActionGroup") + + def create_action (self, label): + aname = "plugin%d" % self.ctr + a = gtk.Action(aname, label, None, None) + self.ctr += 1 + + def add (self, action): + self.ag.add_action(action) + + # add to UI + mid = self.uim.new_merge_id() + self.uim.add_ui(mid, "ui/menubar/pluginMenu", action.get_name(), action.get_name(), gtk.UI_MANAGER_MENUITEM, False) + class PackageTable: """A window with data about a specfic package.""" @@ -559,6 +580,7 @@ class MainWindow (Window): # set plugins and plugin-menu splash(_("Loading Plugins")) + PluginMenuSlot(self.tree) plugin.load_plugins() # session diff --git a/portato/plugin.py b/portato/plugin.py index 9efe396..50cc29f 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -119,6 +119,7 @@ class WidgetSlot (object): self.add = add self._inited = False + debug("Registering new WidgetSlot '%s'.", name) WidgetSlot.slots[name] = self def add_widget (self, w): |