X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/2622fe6c295525637d23e65e54e5a506d728ff7d..19ce1123c780a9475e2f158712da6e73fa543e9c:/lib/python/Screens/Menu.py diff --git a/lib/python/Screens/Menu.py b/lib/python/Screens/Menu.py index 19b36045..92039b42 100644 --- a/lib/python/Screens/Menu.py +++ b/lib/python/Screens/Menu.py @@ -5,6 +5,7 @@ from Components.Sources.StaticText import StaticText from Components.config import configfile from Components.PluginComponent import plugins from Components.config import config +from Components.SystemInfo import SystemInfo from Tools.Directories import resolveFilename, SCOPE_SKIN @@ -102,6 +103,9 @@ class Menu(Screen): self.session.openWithCallback(self.menuClosed, Setup, dialog) def addMenu(self, destList, node): + requires = node.getAttribute("requires") + if requires and not SystemInfo.get(requires, False): + return MenuTitle = _(node.getAttribute("text").encode("UTF-8") or "??") entryID = node.getAttribute("entryID") or "undefined" weight = node.getAttribute("weight") or 50 @@ -122,6 +126,9 @@ class Menu(Screen): self.close(True) def addItem(self, destList, node): + requires = node.getAttribute("requires") + if requires and not SystemInfo.get(requires, False): + return item_text = node.getAttribute("text").encode("UTF-8") entryID = node.getAttribute("entryID") or "undefined" weight = node.getAttribute("weight") or 50 @@ -173,6 +180,7 @@ class Menu(Screen): continue elif x.tagName == 'item': item_level = int(x.getAttribute("level") or "0") + if item_level <= config.usage.setup_level.index: self.addItem(list, x) count += 1 @@ -194,8 +202,13 @@ class Menu(Screen): if menuID is not None: # plugins for l in plugins.getPluginsForMenu(menuID): + # check if a plugin overrides an existing menu + plugin_menuid = l[2] + for x in list: + if x[2] == plugin_menuid: + list.remove(x) + break list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) - # for the skin: first try a menu_, then Menu self.skinName = [ ] @@ -225,6 +238,7 @@ class Menu(Screen): }) a = parent.getAttribute("title").encode("UTF-8") or None + a = a and _(a) if a is None: a = _(parent.getAttribute("text").encode("UTF-8")) self["title"] = StaticText(a)