diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-01-11 20:03:06 +0000 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-01-11 20:03:06 +0000 |
| commit | f3643e16acdb33f7a05ef3ce3faa45142a727e37 (patch) | |
| tree | 67094884c58069976a20a7e02b0d849a5cca5897 /lib | |
| parent | 38be97ebc8fd897de166a2f641df5b7c175dcb6f (diff) | |
| download | enigma2-f3643e16acdb33f7a05ef3ce3faa45142a727e37.tar.gz enigma2-f3643e16acdb33f7a05ef3ce3faa45142a727e37.zip | |
menu positioning for the plugins works now
example:
def getMenuRegistrationList():
list = []
list.append(("setup", 2, "Softwareupdate", "Example"))
list.append(("mainmenu", 0, "Foo", "Bar"))
return list
this means, that we have 2 menu entries:
a menu entry "Softwareupdate" is added to the setup menu on position 2 which calls the Example screen of the plugin
and a menu entry Foo is added to the main menu on the first position which calls the screen Bar
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/python/Components/PluginComponent.py | 4 | ||||
| -rw-r--r-- | lib/python/Screens/Menu.py | 23 |
2 files changed, 17 insertions, 10 deletions
diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index e0cc90a4..adfc98a0 100644 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -57,11 +57,11 @@ class PluginComponent: def menuDelete(self): for menuEntry in self.menuEntries: - menuupdater.delMenuItem(menuEntry[0][0], menuEntry[0][2], menuEntry[1], menuEntry[0][3]) + menuupdater.delMenuItem(menuEntry[0][0], menuEntry[0][1], menuEntry[0][2], menuEntry[1], menuEntry[0][3]) def menuUpdate(self): for menuEntry in self.menuEntries: - menuupdater.addMenuItem(menuEntry[0][0], menuEntry[0][2], menuEntry[1], menuEntry[0][3]) + menuupdater.addMenuItem(menuEntry[0][0], menuEntry[0][1], menuEntry[0][2], menuEntry[1], menuEntry[0][3]) def runPlugin(self, plugin, session): try: diff --git a/lib/python/Screens/Menu.py b/lib/python/Screens/Menu.py index 68a8ef98..9c41c165 100644 --- a/lib/python/Screens/Menu.py +++ b/lib/python/Screens/Menu.py @@ -57,13 +57,13 @@ class MenuUpdater: def __init__(self): self.updatedMenuItems = {} - def addMenuItem(self, id, text, module, screen): + def addMenuItem(self, id, pos, text, module, screen): if not self.updatedMenuAvailable(id): self.updatedMenuItems[id] = [] - self.updatedMenuItems[id].append([text, module, screen]) + self.updatedMenuItems[id].append([text, pos, module, screen]) - def delMenuItem(self, id, text, module, screen): - self.updatedMenuItems[id].remove([text, module, screen]) + def delMenuItem(self, id, pos, text, module, screen): + self.updatedMenuItems[id].remove([text, pos, module, screen]) def updatedMenuAvailable(self, id): return self.updatedMenuItems.has_key(id) @@ -151,19 +151,26 @@ class Menu(Screen): list = [] menuID = "" - for x in childNode: #walk through the actual nodelist + menuID = -1 + for x in childNode: #walk through the actual nodelist if x.nodeType != xml.dom.minidom.Element.nodeType: continue elif x.tagName == 'item': self.addItem(list, x) + count += 1 elif x.tagName == 'menu': self.addMenu(list, x) + count += 1 elif x.tagName == "id": menuID = getValbyAttr(x, "val") + count = 0 + if menuID != -1: + if menuupdater.updatedMenuAvailable(menuID): + for x in menuupdater.getUpdatedMenu(menuID): + if x[1] == count: + list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")))) + count += 1 - if menuupdater.updatedMenuAvailable(menuID): - for x in menuupdater.getUpdatedMenu(menuID): - list.append((x[0], boundFunction(self.runScreen, (x[1], x[2] + ", ")))) self["menu"] = MenuList(list) |
