- start on 'favourites' visual design. service listbox now configurable (in complex...
[enigma2.git] / lib / python / Screens / Setup.py
index 3df44a30a49e602fc937491b2eccdfb4b83fd721..de27ff5ee9f235f9ce0e5cd26a0e3af2501bb7ef 100644 (file)
@@ -1,6 +1,8 @@
 from Screen import Screen
 from Components.ActionMap import ActionMap
+from Components.config import config                           #global config instance
 from Components.config import configEntry
+from Components.config import configBoolean
 from Components.ConfigList import ConfigList
 
 import xml.dom.minidom
@@ -35,11 +37,30 @@ class Setup(Screen):
                                continue
                        elif x.tagName == 'item':
                                ItemText = getValbyAttr(x, "text")
-                               b = XMLTools.mergeText(x.childNodes);
-                               print "item " + ItemText + " " + b
+                               b = eval(XMLTools.mergeText(x.childNodes));
+                               print "item " + ItemText + " " + b.configPath
+                               if b == "":
+                                       continue
                                #add to configlist
-                               list.append(configEntry(ItemText))
+                               item = b.controlType(b)
                                
+                               # the first b is the item itself, ignored by the configList.
+                               # the second one is converted to string.
+                               list.append( (ItemText, item) )
+
+       def keyOk(self):
+               self["config"].handleKey(0)
+       def keyLeft(self):
+               self["config"].handleKey(1)
+       def keyRight(self):
+               self["config"].handleKey(2)
+
+       def keySave(self):
+               print "save requested"
+               for x in self["config"]:
+                       selection =     self["config"].getCurrent()
+                       selection.save()
+
        def __init__(self, session, setup):
                Screen.__init__(self, session)
 
@@ -59,10 +80,14 @@ class Setup(Screen):
                                self.addItems(list, x.childNodes);
                
                #check for list.entries > 0 else self.close
+               
                self["config"] = ConfigList(list)
 
-               self["actions"] = ActionMap(["OkCancelActions"], 
+               self["actions"] = ActionMap(["SetupActions"], 
                        {
-                               #"ok": self.inc,
-                               "cancel": self.close
+                               "cancel": self.close,
+                               "ok": self.keyOk,
+                               "left": self.keyLeft,
+                               "right": self.keyRight,
+                               "save": self.keySave
                        })