diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-07-19 19:30:54 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-07-19 19:30:54 +0000 |
| commit | 3c91232d1ade05d5b7bd393ec41c1673c80b8f45 (patch) | |
| tree | 716d2f2b9075546b61e99f853f3820219dd54413 /lib/python/Screens/Setup.py | |
| parent | f3828b4fde4d61d9bb19eee7e92e2f566af6c391 (diff) | |
| download | enigma2-3c91232d1ade05d5b7bd393ec41c1673c80b8f45.tar.gz enigma2-3c91232d1ade05d5b7bd393ec41c1673c80b8f45.zip | |
take setup menu titles optionally from setup.xml, try to make them a bit easier to understand
Diffstat (limited to 'lib/python/Screens/Setup.py')
| -rw-r--r-- | lib/python/Screens/Setup.py | 29 |
1 files changed, 12 insertions, 17 deletions
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 = """ <screen position="0,0" size="132,64"> @@ -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") |
