1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.config import config #global config instance
4 from Components.config import configEntry
5 from Components.config import configBoolean
6 from Components.ConfigList import ConfigList
9 from xml.dom import EMPTY_NAMESPACE
10 from skin import elementsWithTag
12 from Tools import XMLTools
14 setupdom = xml.dom.minidom.parseString(
16 <setup key="rc" title="RC Menu">
17 <item text="Repeat Rate">config.inputDevices.repeat</item>
18 <item text="Delay Rate">config.inputDevices.delay</item>
22 def getValbyAttr(x, attr):
23 for p in range(x.attributes.length):
24 a = x.attributes.item(p)
34 def addItems(self, list, childNode):
36 if x.nodeType != xml.dom.minidom.Element.nodeType:
38 elif x.tagName == 'item':
39 ItemText = getValbyAttr(x, "text")
40 b = eval(XMLTools.mergeText(x.childNodes));
41 print "item " + ItemText + " " + b.configPath
45 item = b.controlType(b)
47 # the first b is the item itself, ignored by the configList.
48 # the second one is converted to string.
49 list.append( (ItemText, item) )
52 self["config"].handleKey(0)
54 self["config"].handleKey(1)
56 self["config"].handleKey(2)
59 print "save requested"
60 for x in self["config"]:
61 selection = self["config"].getCurrent()
64 def __init__(self, session, setup):
65 Screen.__init__(self, session)
67 print "request setup for " + setup
69 entries = setupdom.childNodes
73 for x in entries: #walk through the actual nodelist
74 if x.nodeType != xml.dom.minidom.Element.nodeType:
76 elif x.tagName == 'setup':
77 ItemText = getValbyAttr(x, "key")
80 self.addItems(list, x.childNodes);
82 #check for list.entries > 0 else self.close
84 self["config"] = ConfigList(list)
86 self["actions"] = ActionMap(["SetupActions"],
91 "right": self.keyRight,