From: Felix Domke Date: Wed, 19 Jul 2006 19:30:54 +0000 (+0000) Subject: take setup menu titles optionally from setup.xml, try to make them a bit easier to... X-Git-Tag: 2.6.0~3147 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/3c91232d1ade05d5b7bd393ec41c1673c80b8f45 take setup menu titles optionally from setup.xml, try to make them a bit easier to understand --- diff --git a/data/menu.xml b/data/menu.xml index 499b9783..ba1dbc52 100644 --- a/data/menu.xml +++ b/data/menu.xml @@ -47,17 +47,17 @@ - - - - - - + + + + + + - - + + diff --git a/data/setup.xml b/data/setup.xml index 41ecdcf0..08e4dcb7 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -15,14 +15,14 @@ config.av.defaultac3 config.av.vcrswitch - - config.recording.asktozap + + config.recording.asktozap config.recording.margin_before config.recording.margin_after - config.usage.showdish - config.usage.multibouquet + config.usage.showdish + config.usage.multibouquet config.usage.quickzap_bouquet_change - config.usage.e1like_radio_mode + config.usage.e1like_radio_mode config.network.dhcp @@ -33,7 +33,7 @@ config.network.activate - + config.rfmod.enable config.rfmod.test config.rfmod.sound @@ -48,25 +48,12 @@ config.osd.alpha config.osd.bright config.osd.contrast - config.lcd.bright config.lcd.contrast config.lcd.standby - config.lcd.invert - - - config.parental.lock - config.parental.setuplock - - - config.expert.splitsize - config.expert.satpos - config.expert.fastzap - config.expert.skipconfirm - config.expert.hideerrors - config.expert.autoinfo + config.lcd.invert config.sat.tunerslot @@ -74,7 +61,7 @@ config.sat.diseqc config.sat.diseqca config.sat.diseqcb - config.sat.diseqcc + config.sat.diseqcc diff --git a/lib/python/Screens/Screen.py b/lib/python/Screens/Screen.py index 5f1cf6d6..060270b1 100644 --- a/lib/python/Screens/Screen.py +++ b/lib/python/Screens/Screen.py @@ -1,5 +1,6 @@ from Components.HTMLSkin import * from Components.GUISkin import * +from Components.Sources.Source import Source import sys @@ -99,7 +100,7 @@ class Screen(dict, HTMLSkin, GUISkin): for x in self.onShow: x() for val in self.values() + self.renderer: - if isinstance(val, GUIComponent): + if isinstance(val, GUIComponent) or isinstance(val, Source): val.onShow() def hide(self): @@ -110,5 +111,5 @@ class Screen(dict, HTMLSkin, GUISkin): for x in self.onHide: x() for val in self.values() + self.renderer: - if isinstance(val, GUIComponent): + if isinstance(val, GUIComponent) or isinstance(val, Source): val.onHide() diff --git a/lib/python/Screens/Setup.py b/lib/python/Screens/Setup.py index 41a9cf51..0d4764ac 100644 --- a/lib/python/Screens/Setup.py +++ b/lib/python/Screens/Setup.py @@ -23,16 +23,6 @@ except: setupdom = xml.dom.minidom.parseString(setupfile.read()) setupfile.close() -def getValbyAttr(x, attr): - for p in range(x.attributes.length): - a = x.attributes.item(p) - attrib = str(a.name) - value = str(a.value) - if attrib == attr: - return value - - return "" - class SetupSummary(Screen): skin = """ @@ -78,12 +68,11 @@ class Setup(Screen): if x.nodeType != xml.dom.minidom.Element.nodeType: continue elif x.tagName == 'setup': - ItemText = getValbyAttr(x, "key") - if ItemText != setup: + if x.getAttribute("key") != setup: continue self.addItems(list, x.childNodes); - myTitle = getValbyAttr(x, "title") - + myTitle = x.getAttribute("title").encode("UTF-8") + #check for list.entries > 0 else self.close self["config"] = ConfigList(list) @@ -136,9 +125,9 @@ class Setup(Screen): if x.nodeType != xml.dom.minidom.Element.nodeType: continue elif x.tagName == 'item': - ItemText = _(getValbyAttr(x, "text")) + item_text = _(x.getAttribute("text").encode("UTF-8") or "??") b = eval(XMLTools.mergeText(x.childNodes)); - print "item " + ItemText + " " + b.configPath + print "item " + item_text + " " + b.configPath if b == "": continue #add to configlist @@ -146,7 +135,7 @@ class Setup(Screen): # the first b is the item itself, ignored by the configList. # the second one is converted to string. - list.append( (ItemText, item) ) + list.append( (item_text, item) ) def handleKey(self, key): # ignore keys when not enabled @@ -178,3 +167,9 @@ class Setup(Screen): def keyNumberGlobal(self, number): self.handleKey(str(number)) + +def getSetupTitle(id): + xmldata = setupdom.childNodes[0].childNodes + for x in elementsWithTag(xmldata, "setup"): + if x.getAttribute("key") == id: + return x.getAttribute("title").encode("UTF-8")