config rewrite. some extensions still need to be updated.
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 2 Oct 2006 23:55:37 +0000 (23:55 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 2 Oct 2006 23:55:37 +0000 (23:55 +0000)
47 files changed:
Navigation.py
lib/python/Components/AVSwitch.py
lib/python/Components/Clock.py
lib/python/Components/ConfigList.py
lib/python/Components/InputDevice.py
lib/python/Components/Lcd.py
lib/python/Components/Network.py
lib/python/Components/NimManager.py
lib/python/Components/RFmod.py
lib/python/Components/RecordingConfig.py
lib/python/Components/Renderer/PositionGauge.py
lib/python/Components/ServicePosition.py
lib/python/Components/SetupDevices.py
lib/python/Components/Sources/Makefile.am
lib/python/Components/TimerSanityCheck.py
lib/python/Components/Timezones.py
lib/python/Components/UsageConfig.py
lib/python/Components/config.py
lib/python/Plugins/Extensions/FritzCall/plugin.py
lib/python/Plugins/Extensions/Makefile.am
lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py
lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py
lib/python/Plugins/SystemPlugins/Satfinder/plugin.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/Ci.py
lib/python/Screens/ConfigMenu.py
lib/python/Screens/Dish.py
lib/python/Screens/EpgSelection.py
lib/python/Screens/ImageWizard.py
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/Makefile.am
lib/python/Screens/Menu.py
lib/python/Screens/NetworkSetup.py
lib/python/Screens/PictureInPicture.py
lib/python/Screens/Satconfig.py
lib/python/Screens/ScanSetup.py
lib/python/Screens/Setup.py
lib/python/Screens/SimpleSummary.py
lib/python/Screens/StartWizard.py
lib/python/Screens/TimeDateInput.py
lib/python/Screens/TimerEdit.py
lib/python/Screens/TimerEntry.py
lib/python/Screens/TutorialWizard.py
lib/python/Screens/Volume.py
lib/python/Tools/NumericalTextInput.py
skin.py

index f1683df8cdb4ceffabb0a8948e420b6839140291..7b615bbdab6d37b6cb076ba1b11e92222f0c9a54 100644 (file)
@@ -4,6 +4,8 @@ import RecordTimer
 import NavigationInstance
 import ServiceReference
 
 import NavigationInstance
 import ServiceReference
 
+from time import time
+
 # TODO: remove pNavgation, eNavigation and rewrite this stuff in python.
 class Navigation:
        def __init__(self):
 # TODO: remove pNavgation, eNavigation and rewrite this stuff in python.
 class Navigation:
        def __init__(self):
index 19fccf54604bf24956b918427f736b47d0f553dd..33045d403ecf74fa851dddbd47a496998ba15c67 100644 (file)
@@ -1,4 +1,4 @@
-from config import *
+from config import config, ConfigSelection, ConfigYesNo, ConfigEnableDisable, ConfigSubsection, ConfigBoolean
 import os
 from enigma import *
 
 import os
 from enigma import *
 
@@ -14,7 +14,8 @@ class AVSwitch:
                else:
                        eAVSwitch.getInstance().setSlowblank(self.INPUT[input][1])
                # FIXME why do we have to reset the colorformat? bug in avs-driver?
                else:
                        eAVSwitch.getInstance().setSlowblank(self.INPUT[input][1])
                # FIXME why do we have to reset the colorformat? bug in avs-driver?
-               eAVSwitch.getInstance().setColorFormat(config.av.colorformat.value)
+               map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
+               eAVSwitch.getInstance().setColorFormat(map[config.av.colorformat.value])
 
        def setColorFormat(self, value):
                eAVSwitch.getInstance().setColorFormat(value)
 
        def setColorFormat(self, value):
                eAVSwitch.getInstance().setColorFormat(value)
@@ -28,7 +29,7 @@ class AVSwitch:
                eAVSwitch.getInstance().setVideomode(value)
 
        def getAspectRatioSetting(self):
                eAVSwitch.getInstance().setVideomode(value)
 
        def getAspectRatioSetting(self):
-               valstr = currentConfigSelectionElement(config.av.aspectratio)
+               valstr = config.av.aspectratio.value
                if valstr == "4_3_letterbox":
                        val = 0
                elif valstr == "4_3_panscan":
                if valstr == "4_3_letterbox":
                        val = 0
                elif valstr == "4_3_panscan":
@@ -49,7 +50,7 @@ class AVSwitch:
                if aspect == 0 or aspect == 1: # letterbox or panscan
                        value = 3 # 4:3_full_format
                elif aspect == 2: # 16:9
                if aspect == 0 or aspect == 1: # letterbox or panscan
                        value = 3 # 4:3_full_format
                elif aspect == 2: # 16:9
-                       if currentConfigSelectionElement(config.av.wss) == "off":
+                       if not config.av.wss.value:
                                value = 2 # auto(4:3_off)
                        else:
                                value = 1 # auto
                                value = 2 # auto(4:3_off)
                        else:
                                value = 1 # auto
@@ -71,32 +72,41 @@ class AVSwitch:
                eAVSwitch.getInstance().setSlowblank(value)
 
 def InitAVSwitch():
                eAVSwitch.getInstance().setSlowblank(value)
 
 def InitAVSwitch():
-       config.av = ConfigSubsection();
-       config.av.yuvenabled = configElementBoolean("config.av.yuvenabled", 0)
-       colorformat_choices = ( ("cvbs", _("CVBS")), ("rgb", _("RGB")), ("svideo", _("S-Video")), ("yuv", _("YPbPr")) )
+       config.av = ConfigSubsection()
+       config.av.yuvenabled = ConfigBoolean(default=False)
+       colorformat_choices = {"cvbs": _("CVBS"), "rgb": _("RGB"), "svideo": _("S-Video")}
        
        # when YUV is not enabled, don't let the user select it
        
        # when YUV is not enabled, don't let the user select it
-       if not config.av.yuvenabled.value:
-               colorformat_choices = colorformat_choices[:3]
-
-       config.av.colorformat = configElement("config.av.colorformat", configSelection, 1, colorformat_choices)
-       config.av.aspectratio = configElement("config.av.aspectratio", configSelection, 0, (("4_3_letterbox", _("4:3 Letterbox")), ("4_3_panscan", _("4:3 PanScan")), ("16_9", _("16:9")), ("16_9_always", _("16:9 always")), ("16_10_letterbox", _("16:10 Letterbox")), ("16_10_panscan", _("16:10 PanScan"))) )
-       #config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, ("PAL", "PAL + PAL60", "Multi", "NTSC") )
-       config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, (("pal", _("PAL")), ("ntsc", _("NTSC"))) )
-       config.av.wss = configElement("config.av.wss", configSelection, 0, (("off", _("Off")), ("on", _("On"))) )
-       config.av.defaultac3 = configElement("config.av.defaultac3", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))))
-       config.av.vcrswitch = configElement("config.av.vcrswitch", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))))
+       if config.av.yuvenabled.value:
+               colorformat_choices["yuv"] = _("YPbPr")
+
+       config.av.colorformat = ConfigSelection(choices=colorformat_choices, default="rgb")
+       config.av.aspectratio = ConfigSelection(choices={
+                       "4_3_letterbox": _("4:3 Letterbox"),
+                       "4_3_panscan": _("4:3 PanScan"), 
+                       "16_9": _("16:9"), 
+                       "16_9_always": _("16:9 always"),
+                       "16_10_letterbox": _("16:10 Letterbox"),
+                       "16_10_panscan": _("16:10 PanScan")}, 
+                       default = "4_3_letterbox")
+       config.av.tvsystem = ConfigSelection(choices = {"pal": _("PAL"), "ntsc": _("NTSC")}, default="pal")
+       config.av.wss = ConfigEnableDisable(default = True)
+       config.av.defaultac3 = ConfigYesNo(default = False)
+       config.av.vcrswitch = ConfigEnableDisable(default = False)
 
        iAVSwitch = AVSwitch()
 
        def setColorFormat(configElement):
 
        iAVSwitch = AVSwitch()
 
        def setColorFormat(configElement):
-               iAVSwitch.setColorFormat(configElement.value)
+               map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
+               iAVSwitch.setColorFormat(map[configElement.value])
 
        def setAspectRatio(configElement):
 
        def setAspectRatio(configElement):
-               iAVSwitch.setAspectRatio(configElement.value)
+               map = {"4_3_letterbox": 0, "4_3_panscan": 1, "16_9": 2, "16_9_always": 3, "16_10_letterbox": 4, "16_10_panscan": 5}
+               iAVSwitch.setAspectRatio(map[configElement.value])
 
        def setSystem(configElement):
 
        def setSystem(configElement):
-               iAVSwitch.setSystem(configElement.value)
+               map = {"pal": 0, "ntsc": 1}
+               iAVSwitch.setSystem(map[configElement.value])
 
        def setWSS(configElement):
                iAVSwitch.setAspectWSS()
 
        def setWSS(configElement):
                iAVSwitch.setAspectWSS()
index ae828c4f01769069ffcd9a202d51704aff272bdf..95f29b16b0bd3991712e8768c2aff032b1f9a49b 100644 (file)
@@ -7,8 +7,6 @@ from VariableText import *
 
 from enigma import *
 
 
 from enigma import *
 
-from config import config
-
 import time
 # now some "real" components:
 
 import time
 # now some "real" components:
 
@@ -28,20 +26,16 @@ class Clock(VariableText, HTMLComponent, GUIComponent):
        def onHide(self):
                self.clockTimer.stop()
 
        def onHide(self):
                self.clockTimer.stop()
 
-# "funktionalitaet"    
        def doClock(self):
                t = time.localtime()
                timestr = "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
                self.setText(timestr)
 
        def doClock(self):
                t = time.localtime()
                timestr = "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
                self.setText(timestr)
 
-# realisierung als GUI
        def createWidget(self, parent):
                return eLabel(parent)
 
        def removeWidget(self, w):
                del self.clockTimer
 
        def createWidget(self, parent):
                return eLabel(parent)
 
        def removeWidget(self, w):
                del self.clockTimer
 
-# ...und als HTML:
        def produceHTML(self):
        def produceHTML(self):
-       #       return T.b[self.getText()]
                return self.getText()
                return self.getText()
index 1341ac5046e8db1b406f3a0675045687e2f5f0d7..e586f39d002a6a510bb82b1a57fffd201382635d 100644 (file)
@@ -1,17 +1,27 @@
 from HTMLComponent import *
 from GUIComponent import *
 from HTMLComponent import *
 from GUIComponent import *
-from config import *
-
-from enigma import eListbox, eListboxPythonConfigContent
+from config import KEY_LEFT, KEY_RIGHT, KEY_0, KEY_DELETE, KEY_OK, KEY_TIMEOUT
+from Components.ActionMap import NumberActionMap
+from enigma import eListbox, eListboxPythonConfigContent, eTimer
 
 class ConfigList(HTMLComponent, GUIComponent, object):
 
 class ConfigList(HTMLComponent, GUIComponent, object):
-       def __init__(self, list):
+       def __init__(self, list, session = None):
                GUIComponent.__init__(self)
                self.l = eListboxPythonConfigContent()
                self.l.setSeperation(100)
                self.list = list
                self.onSelectionChanged = [ ]
                GUIComponent.__init__(self)
                self.l = eListboxPythonConfigContent()
                self.l.setSeperation(100)
                self.list = list
                self.onSelectionChanged = [ ]
+               self.current = None
+               self.help_window = None
+               self.setHelpWindowSession(session)
+               
+               self.timer = eTimer()
+               self.timer.timeout.get().append(self.timeout)
        
        
+       def setHelpWindowSession(self, session):
+               assert self.help_window is None, "you can't move a help window to another session"
+               self.session = session
+
        def toggle(self):
                selection = self.getCurrent()
                selection[1].toggle()
        def toggle(self):
                selection = self.getCurrent()
                selection[1].toggle()
@@ -19,9 +29,13 @@ class ConfigList(HTMLComponent, GUIComponent, object):
 
        def handleKey(self, key):
                selection = self.getCurrent()
 
        def handleKey(self, key):
                selection = self.getCurrent()
-               if selection[1].parent.enabled:
+               if selection[1].enabled:
                        selection[1].handleKey(key)
                        self.invalidateCurrent()
                        selection[1].handleKey(key)
                        self.invalidateCurrent()
+                       if self.help_window:
+                               self.help_window.update(selection[1])
+               if key not in [KEY_TIMEOUT, KEY_LEFT, KEY_RIGHT, KEY_DELETE, KEY_OK]:
+                       self.timer.start(1000, 1)
 
        def getCurrent(self):
                return self.l.getCurrentSelection()
 
        def getCurrent(self):
                return self.l.getCurrentSelection()
@@ -30,15 +44,26 @@ class ConfigList(HTMLComponent, GUIComponent, object):
                self.l.invalidateEntry(self.l.getCurrentSelectionIndex())
                
        def invalidate(self, entry):
                self.l.invalidateEntry(self.l.getCurrentSelectionIndex())
                
        def invalidate(self, entry):
-               i = 0
-               for x in self.__list:
-                       if (entry.getConfigPath() == x[1].parent.getConfigPath()):
-                               self.l.invalidateEntry(i)
-                       i += 1
+               self.l.invalidateEntry(self.__list.index(entry))
 
        GUI_WIDGET = eListbox
        
        def selectionChanged(self):
 
        GUI_WIDGET = eListbox
        
        def selectionChanged(self):
+               n = self.getCurrent()
+               
+               if self.help_window:
+                       print "close old help window!"
+                       self.session.deleteDialog(self.help_window)
+               
+               nh = n and n[1].helpWindow()
+               print "n, nh:", n, nh
+               if nh is not None and self.session is not None:
+                       print "show new help window"
+                       self.help_window = self.session.instantiateDialog(*nh)
+                       self.help_window.show()
+
+               print "config selection changed, from ", self.current, " to ", n
+               self.current = n
                for x in self.onSelectionChanged:
                        x()
 
                for x in self.onSelectionChanged:
                        x()
 
@@ -57,3 +82,43 @@ class ConfigList(HTMLComponent, GUIComponent, object):
                return self.__list
 
        list = property(getList, setList)
                return self.__list
 
        list = property(getList, setList)
+
+       def timeout(self):
+               self.handleKey(KEY_TIMEOUT)
+
+class ConfigListScreen:
+       def __init__(self, list, session = None):
+               self["config_actions"] = NumberActionMap(["SetupActions", "TextInputActions"],
+               {
+                       "ok": self.keyOK,
+                       "left": self.keyLeft,
+                       "right": self.keyRight,
+                       "delete": self.keyDelete,
+                       "1": self.keyNumberGlobal,
+                       "2": self.keyNumberGlobal,
+                       "3": self.keyNumberGlobal,
+                       "4": self.keyNumberGlobal,
+                       "5": self.keyNumberGlobal,
+                       "6": self.keyNumberGlobal,
+                       "7": self.keyNumberGlobal,
+                       "8": self.keyNumberGlobal,
+                       "9": self.keyNumberGlobal,
+                       "0": self.keyNumberGlobal
+               }, -1)
+
+               self["config"] = ConfigList(list, session = session)
+
+       def keyOK(self):
+               self["config"].handleKey(KEY_OK)
+
+       def keyLeft(self):
+               self["config"].handleKey(KEY_LEFT)
+
+       def keyRight(self):
+               self["config"].handleKey(KEY_RIGHT)
+
+       def keyDelete(self):
+               self["config"].handleKey(KEY_DELETE)
+
+       def keyNumberGlobal(self, number):
+               self["config"].handleKey(KEY_0 + number)
index bfb5435b80a39f09a3df4c2379248f3254549fc7..3c3bd7a1a6ee29bfa54feff09a516201d742e16e 100644 (file)
@@ -1,9 +1,4 @@
-from config import config                              #global config instance
-
-from config import configElement
-from config import ConfigSubsection
-from config import configSlider
-from config import configSelection
+from config import config, ConfigSlider, ConfigSubsection
 
 class inputDevices:
        def __init__(self):
 
 class inputDevices:
        def __init__(self):
@@ -17,8 +12,8 @@ class inputDevices:
 
 def InitInputDevices():
        config.inputDevices = ConfigSubsection();
 
 def InitInputDevices():
        config.inputDevices = ConfigSubsection();
-       config.inputDevices.repeat = configElement("config.inputDevices.repeat", configSlider, 5, (1, 10))
-       config.inputDevices.delay = configElement("config.inputDevices.delay", configSlider, 4, (1, 10))
+       config.inputDevices.repeat = ConfigSlider(default=5, limits=(1, 10))
+       config.inputDevices.delay = ConfigSlider(default=4, limits=(1, 10))
 
        #this instance anywhere else needed?    
        iDevices = inputDevices();      
 
        #this instance anywhere else needed?    
        iDevices = inputDevices();      
index ea0c37a1d99c5de8cfbf45033a1257acab995602..d547a58c523037a2284ad9c41d5c44638c3e9483 100644 (file)
@@ -1,10 +1,6 @@
-from config import config                              #global config instance
-from config import configSlider
-from config import configSelection
-from config import ConfigSubsection
-from config import configElement
+from config import config, ConfigSubsection, ConfigSlider, ConfigYesNo
 
 
-from enigma import *
+from enigma import eDBoxLCD
 
 class LCD:
        def __init__(self):
 
 class LCD:
        def __init__(self):
@@ -25,10 +21,10 @@ class LCD:
 
 def InitLcd():
        config.lcd = ConfigSubsection();
 
 def InitLcd():
        config.lcd = ConfigSubsection();
-       config.lcd.bright = configElement("config.lcd.bright", configSlider, 10, (1, 10))
-       config.lcd.contrast = configElement("config.lcd.contrast", configSlider, 10, (1, 10))
-       config.lcd.standby = configElement("config.lcd.standby", configSlider, 0, (1,10))
-       config.lcd.invert = configElement("config.lcd.invert", configSelection, 0, (("disable", _("Disable")), ("enable", _("Enable"))))
+       config.lcd.bright = ConfigSlider(default=10, limits=(1, 10))
+       config.lcd.contrast = ConfigSlider(default=10, limits=(1, 10))
+       config.lcd.standby = ConfigSlider(default=0, limits=(1,10))
+       config.lcd.invert = ConfigYesNo(default=False)
 
        ilcd = LCD()
 
 
        ilcd = LCD()
 
@@ -44,6 +40,3 @@ def InitLcd():
        config.lcd.bright.addNotifier(setLCDbright);
        config.lcd.contrast.addNotifier(setLCDcontrast);
        config.lcd.invert.addNotifier(setLCDinverted);
        config.lcd.bright.addNotifier(setLCDbright);
        config.lcd.contrast.addNotifier(setLCDcontrast);
        config.lcd.invert.addNotifier(setLCDinverted);
-       
-
-       
index 7d6c5e17e5104118f3e784b5a7898520939b4307..7513901f87a0ea933a4b6b37a3cf94f21fd17c80 100644 (file)
@@ -1,4 +1,4 @@
-from config import *
+from config import config, ConfigYesNo, ConfigIP, NoSave, ConfigSubsection, ConfigMAC
 
 import os
 from socket import *
 
 import os
 from socket import *
@@ -14,7 +14,7 @@ class Network:
                fp.write("auto lo\n")
                fp.write("iface lo inet loopback\n\n")
                fp.write("auto eth0\n")
                fp.write("auto lo\n")
                fp.write("iface lo inet loopback\n\n")
                fp.write("auto eth0\n")
-               if (currentConfigSelectionElement(config.network.dhcp) == "yes"):
+               if config.network.dhcp.value:
                        fp.write("iface eth0 inet dhcp\n")
                else:
                        fp.write("iface eth0 inet static\n")
                        fp.write("iface eth0 inet dhcp\n")
                else:
                        fp.write("iface eth0 inet static\n")
@@ -84,6 +84,7 @@ class Network:
                import os
                os.system("/etc/init.d/networking restart")
                config.network.ip.value = self.getCurrentIP()
                import os
                os.system("/etc/init.d/networking restart")
                config.network.ip.value = self.getCurrentIP()
+               config.network.ip.save()
                
        def setDHCP(self, useDHCP):
                if (useDHCP):
                
        def setDHCP(self, useDHCP):
                if (useDHCP):
@@ -140,22 +141,16 @@ iNetwork = Network()
 def InitNetwork():
        ip = iNetwork.getCurrentIP()
 
 def InitNetwork():
        ip = iNetwork.getCurrentIP()
 
-               
        config.network = ConfigSubsection()
        config.network = ConfigSubsection()
-       config.network.dhcp = configElement_nonSave("config.network.dhcp", configSelection, 1, (("no", _("no")), ("yes", _("yes"))))
-       config.network.ip = configElement_nonSave("config.network.ip", configSequence, ip, configsequencearg.get("IP"))
-       config.network.netmask = configElement_nonSave("config.network.netmask", configSequence, [255,255,255,0], configsequencearg.get("IP"))
-       config.network.gateway = configElement_nonSave("config.network.gateway", configSequence, [192,168,1,3], configsequencearg.get("IP"))
-       config.network.dns = configElement_nonSave("config.network.dns", configSequence, [192,168,1,3], configsequencearg.get("IP"))
-       config.network.mac = configElement_nonSave("config.network.mac", configSequence, [00,11,22,33,44,55], configsequencearg.get("MAC"))
+       config.network.dhcp = NoSave(ConfigYesNo(default=True))
+       config.network.ip = NoSave(ConfigIP(default=[0,0,0,0]))
+       config.network.netmask = NoSave(ConfigIP(default=[255,255,255,0]))
+       config.network.gateway = NoSave(ConfigIP(default=[192,168,1,3]))
+       config.network.dns = NoSave(ConfigIP(default=[192,168,1,3]))
+       config.network.mac = NoSave(ConfigMAC(default=[00,11,22,33,44,55]))
 
        iNetwork.loadNetworkConfig()
        
 
        iNetwork.loadNetworkConfig()
        
-       #FIXME using this till other concept for this is implemented
-       #config.network.activate = configElement("config.network.activate", configSelection, 0, ("yes, sir", "you are my hero"))
-       #config.network.activate = configElement("config.network.activate", configSelection, 0, ("yes", "you are my hero"))
-
-
        def writeNetworkConfig(configElement):
                iNetwork.writeNetworkConfig()
                
        def writeNetworkConfig(configElement):
                iNetwork.writeNetworkConfig()
                
index c24d8d351f718b6b17f8a3c0594c5d97f9e77fb3..783288ec5d643c271d6a6df68c07dde49adeb6b1 100644 (file)
@@ -1,13 +1,4 @@
-from config import config       #global config instance
-
-from config import configElement
-from config import ConfigSubsection
-from config import configSelection
-from config import currentConfigSelectionElement
-from config import getConfigSelectionElement
-from config import configSequence
-from config import configsequencearg
-from config import configSatlist
+from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigDummy, ConfigSubDict
 
 from enigma import eDVBSatelliteEquipmentControl, \
        eDVBSatelliteLNBParameters as lnbParam, \
 
 from enigma import eDVBSatelliteEquipmentControl, \
        eDVBSatelliteLNBParameters as lnbParam, \
@@ -74,12 +65,12 @@ class SecConfigure:
                        sec.setInputpowerDelta(50)
 
                        for x in self.NimManager.satList:
                        sec.setInputpowerDelta(50)
 
                        for x in self.NimManager.satList:
-                               print "Add sat " + str(x[1])
-                               sec.addSatellite(int(x[1]))
+                               print "Add sat " + str(x[0])
+                               sec.addSatellite(int(x[0]))
                                sec.setVoltageMode(0)
                                sec.setToneMode(0)
                                sec.setRotorPosNum(0) # USALS
                                sec.setVoltageMode(0)
                                sec.setToneMode(0)
                                sec.setRotorPosNum(0) # USALS
-                               self.satList.append(int(x[1]))
+                               self.satList.append(int(x[0]))
 
        def setSatposDepends(self, sec, nim1, nim2):
                print "tuner", nim1, "depends on satpos of", nim2
 
        def setSatposDepends(self, sec, nim1, nim2):
                print "tuner", nim1, "depends on satpos of", nim2
@@ -105,13 +96,13 @@ class SecConfigure:
                        x = slot.slotid
                        nim = config.Nims[x]
                        if slot.nimType == self.NimManager.nimType["DVB-S"]:
                        x = slot.slotid
                        nim = config.Nims[x]
                        if slot.nimType == self.NimManager.nimType["DVB-S"]:
-                               if currentConfigSelectionElement(nim.configMode) == "equal":
+                               if nim.configMode.value == "equal":
                                        self.equal[nim.equalTo.value]=x
                                        self.equal[nim.equalTo.value]=x
-                               if currentConfigSelectionElement(nim.configMode) == "loopthrough":
+                               if nim.configMode.value == "loopthrough":
                                        self.linkNIMs(sec, x, nim.linkedTo.value)
                                        self.linked[nim.linkedTo.value]=x
                                        self.linkNIMs(sec, x, nim.linkedTo.value)
                                        self.linked[nim.linkedTo.value]=x
-                               elif currentConfigSelectionElement(nim.configMode) == "satposdepends":
-                                       self.setSatposDepends(sec, x, nim.satposDependsTo.value)
+                               elif nim.configMode.value == "satposdepends":
+                                       self.setSatposDepends(sec, x, nim.satposDependsTo.index)
                                        self.satposdepends[nim.satposDependsTo.value]=x
 
                for slot in self.NimManager.nimslots:
                                        self.satposdepends[nim.satposDependsTo.value]=x
 
                for slot in self.NimManager.nimslots:
@@ -119,37 +110,38 @@ class SecConfigure:
                        nim = config.Nims[x]
                        if slot.nimType == self.NimManager.nimType["DVB-S"]:
                                print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
                        nim = config.Nims[x]
                        if slot.nimType == self.NimManager.nimType["DVB-S"]:
                                print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
-                               if currentConfigSelectionElement(nim.configMode) in [ "loopthrough", "satposdepends", "equal", "nothing" ]:
+                               print "diseqcmode: ", nim.configMode.value
+                               if nim.configMode.value in [ "loopthrough", "satposdepends", "equal", "nothing" ]:
                                        pass
                                        pass
-                               elif currentConfigSelectionElement(nim.configMode) == "simple":         #simple config
-                                       if currentConfigSelectionElement(nim.diseqcMode) == "single":                   #single
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.NONE, diseqcpos = diseqcParam.SENDNO)
-                                       elif currentConfigSelectionElement(nim.diseqcMode) == "toneburst_a_b":          #Toneburst A/B
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.A, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.B, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
-                                       elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b":             #DiSEqC A/B
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
-                                       elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b_c_d":         #DiSEqC A/B/C/D
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcC.vals[nim.diseqcC.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BA)
-                                               self.addLNBSimple(sec, slotid = x, orbpos = int(nim.diseqcD.vals[nim.diseqcD.value][1]), toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BB)
-                                       elif currentConfigSelectionElement(nim.diseqcMode) == "positioner":             #Positioner
-                                               if currentConfigSelectionElement(nim.latitudeOrientation) == "north":
+                               elif nim.configMode.value == "simple":          #simple config
+                                       if nim.diseqcMode.value == "single":                    #single
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.NONE, diseqcpos = diseqcParam.SENDNO)
+                                       elif nim.diseqcMode.value == "toneburst_a_b":           #Toneburst A/B
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.A, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.B, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.SENDNO)
+                                       elif nim.diseqcMode.value == "diseqc_a_b":              #DiSEqC A/B
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
+                                       elif nim.diseqcMode.value == "diseqc_a_b_c_d":          #DiSEqC A/B/C/D
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AA)
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcB.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.AB)
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcC.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BA)
+                                               self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcD.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.V1_0, diseqcpos = diseqcParam.BB)
+                                       elif nim.diseqcMode.value == "positioner":              #Positioner
+                                               if nim.latitudeOrientation.value == "north":
                                                        laValue = rotorParam.NORTH
                                                else:
                                                        laValue = rotorParam.SOUTH
                                                        laValue = rotorParam.NORTH
                                                else:
                                                        laValue = rotorParam.SOUTH
-                                               if currentConfigSelectionElement(nim.longitudeOrientation) == "east":
+                                               if nim.longitudeOrientation.value == "east":
                                                        loValue = rotorParam.EAST
                                                else:
                                                        loValue = rotorParam.WEST
                                                self.addLNBSimple(sec, slotid = x, diseqcmode = 3,
                                                        loValue = rotorParam.EAST
                                                else:
                                                        loValue = rotorParam.WEST
                                                self.addLNBSimple(sec, slotid = x, diseqcmode = 3,
-                                                       longitude = configsequencearg.getFloat(nim.longitude),
+                                                       longitude = nim.longitude.float,
                                                        loDirection = loValue,
                                                        loDirection = loValue,
-                                                       latitude = configsequencearg.getFloat(nim.latitude),
+                                                       latitude = nim.latitude.float,
                                                        laDirection = laValue)
                                                        laDirection = laValue)
-                               elif currentConfigSelectionElement(nim.configMode) == "advanced": #advanced config
+                               elif nim.configMode.value == "advanced": #advanced config
                                        self.updateAdvanced(sec, x)
                print "sec config completed"
 
                                        self.updateAdvanced(sec, x)
                print "sec config completed"
 
@@ -158,10 +150,10 @@ class SecConfigure:
                for x in range(1,33):
                        lnbSat[x] = []
                for x in self.NimManager.satList:
                for x in range(1,33):
                        lnbSat[x] = []
                for x in self.NimManager.satList:
-                       lnb = config.Nims[slotid].advanced.sat[x[1]].lnb.value
+                       lnb = int(config.Nims[slotid].advanced.sat[x[0]].lnb.value)
                        if lnb != 0:
                        if lnb != 0:
-                               print "add", x[1], "to", lnb
-                               lnbSat[lnb].append(x[1])
+                               print "add", x[0], "to", lnb
+                               lnbSat[lnb].append(x[0])
                for x in range(1,33):
                        if len(lnbSat[x]) > 0:
                                currLnb = config.Nims[slotid].advanced.lnb[x]
                for x in range(1,33):
                        if len(lnbSat[x]) > 0:
                                currLnb = config.Nims[slotid].advanced.lnb[x]
@@ -173,124 +165,110 @@ class SecConfigure:
                                elif self.linked.has_key(slotid):
                                        tunermask |= (1 << self.linked[slotid])
 
                                elif self.linked.has_key(slotid):
                                        tunermask |= (1 << self.linked[slotid])
 
-                               if currentConfigSelectionElement(currLnb.lof) == "universal_lnb":
+                               if currLnb.lof.value == "universal_lnb":
                                        sec.setLNBLOFL(9750000)
                                        sec.setLNBLOFH(10600000)
                                        sec.setLNBThreshold(11700000)
                                        sec.setLNBLOFL(9750000)
                                        sec.setLNBLOFH(10600000)
                                        sec.setLNBThreshold(11700000)
-                               elif currentConfigSelectionElement(currLnb.lof) == "c_band":
+                               elif currLnb.lof.value == "c_band":
                                        sec.setLNBLOFL(5150000)
                                        sec.setLNBLOFH(5150000)
                                        sec.setLNBThreshold(5150000)
                                        sec.setLNBLOFL(5150000)
                                        sec.setLNBLOFH(5150000)
                                        sec.setLNBThreshold(5150000)
-                               elif currentConfigSelectionElement(currLnb.lof) == "user_defined":
-                                       sec.setLNBLOFL(currLnb.lofl.value[0] * 1000)
-                                       sec.setLNBLOFH(currLnb.lofh.value[0] * 1000)
-                                       sec.setLNBThreshold(currLnb.threshold.value[0] * 1000)
+                               elif currLnb.lof.value == "user_defined":
+                                       sec.setLNBLOFL(currLnb.lofl.value * 1000)
+                                       sec.setLNBLOFH(currLnb.lofh.value * 1000)
+                                       sec.setLNBThreshold(currLnb.threshold.value * 1000)
                                        
                                        
-                               if currentConfigSelectionElement(currLnb.output_12v) == "0V":
+                               if currLnb.output_12v.value == "0V":
                                        pass # nyi in drivers
                                        pass # nyi in drivers
-                               elif currentConfigSelectionElement(currLnb.output_12v) == "12V":
+                               elif currLnb.output_12v.value == "12V":
                                        pass # nyi in drivers
                                        
                                        pass # nyi in drivers
                                        
-                               if currentConfigSelectionElement(currLnb.increased_voltage) == "yes":
+                               if currLnb.increased_voltage.value:
                                        sec.setLNBIncreasedVoltage(lnbParam.ON)
                                else:
                                        sec.setLNBIncreasedVoltage(lnbParam.OFF)
                                        sec.setLNBIncreasedVoltage(lnbParam.ON)
                                else:
                                        sec.setLNBIncreasedVoltage(lnbParam.OFF)
-                                       
-                               if currentConfigSelectionElement(currLnb.diseqcMode) == "none":
+                               
+                               dm = currLnb.diseqcMode.value 
+                               if dm == "none":
                                        sec.setDiSEqCMode(diseqcParam.NONE)
                                        sec.setDiSEqCMode(diseqcParam.NONE)
-                               elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
+                               elif dm == "1_0":
                                        sec.setDiSEqCMode(diseqcParam.V1_0)
                                        sec.setDiSEqCMode(diseqcParam.V1_0)
-                               elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_1":
+                               elif dm == "1_1":
                                        sec.setDiSEqCMode(diseqcParam.V1_1)
                                        sec.setDiSEqCMode(diseqcParam.V1_1)
-                               elif currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
+                               elif dm == "1_2":
                                        sec.setDiSEqCMode(diseqcParam.V1_2)
 
                                        if self.satposdepends.has_key(slotid):  # only useable with rotors
                                                tunermask |= (1 << self.satposdepends[slotid])
 
                                        sec.setDiSEqCMode(diseqcParam.V1_2)
 
                                        if self.satposdepends.has_key(slotid):  # only useable with rotors
                                                tunermask |= (1 << self.satposdepends[slotid])
 
-                               if currentConfigSelectionElement(currLnb.diseqcMode) != "none":
-                                       if currentConfigSelectionElement(currLnb.toneburst) == "none":
+                               if dm != "none":
+                                       if currLnb.toneburst.value == "none":
                                                sec.setToneburst(diseqcParam.NO)
                                                sec.setToneburst(diseqcParam.NO)
-                                       elif currentConfigSelectionElement(currLnb.toneburst) == "A":
+                                       elif currLnb.toneburst.value == "A":
                                                sec.setToneburst(diseqcParam.A)
                                                sec.setToneburst(diseqcParam.A)
-                                       elif currentConfigSelectionElement(currLnb.toneburst) == "B":
+                                       elif currLnb.toneburst.value == "B":
                                                sec.setToneburst(diseqcParam.B)
                                                sec.setToneburst(diseqcParam.B)
+                                       
+                                       # Committed Diseqc Command
+                                       cdc = currLnb.commitedDiseqcCommand.value
+                                       
+                                       c = [
+                                               ("none", diseqcParam.SENDNO),
+                                               ("AA", diseqcParam.AA),
+                                               ("AB", diseqcParam.AB),
+                                               ("BA", diseqcParam.BA),
+                                               ("BB", diseqcParam.BB)]
                                                
                                                
-                                       if currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "none":
-                                               sec.setCommittedCommand(diseqcParam.SENDNO)
-                                       elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "AA":
-                                               sec.setCommittedCommand(diseqcParam.AA)
-                                       elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "AB":
-                                               sec.setCommittedCommand(diseqcParam.AB)
-                                       elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "BA":
-                                               sec.setCommittedCommand(diseqcParam.BA)
-                                       elif currentConfigSelectionElement(currLnb.commitedDiseqcCommand) == "BB":
-                                               sec.setCommittedCommand(diseqcParam.BB)
+                                       if cdc in c:
+                                               sec.setCommittedCommand(c[cdc])
                                        else:
                                        else:
-                                               sec.setCommittedCommand(long(currentConfigSelectionElement(currLnb.commitedDiseqcCommand)))
+                                               sec.setCommittedCommand(long(cdc))
 
 
-                                       if currentConfigSelectionElement(currLnb.fastDiseqc) == "yes":
-                                               sec.setFastDiSEqC(True)
-                                       else:
-                                               sec.setFastDiSEqC(False)
+                                       sec.setFastDiSEqC(currLnb.fastDiseqc.value)
                                                
                                                
-                                       if currentConfigSelectionElement(currLnb.sequenceRepeat) == "yes":
-                                               sec.setSeqRepeat(True)
-                                       else:
-                                               sec.setSeqRepeat(False)
+                                       sec.setSeqRepeat(currLnb.sequenceRepeat.value)
                                                
                                                
-                                       if currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
+                                       if currLnb.diseqcMode.value == "1_0":
                                                currCO = currLnb.commandOrder1_0.value
                                        else:
                                                currCO = currLnb.commandOrder.value
                                                currCO = currLnb.commandOrder1_0.value
                                        else:
                                                currCO = currLnb.commandOrder.value
-                                               
-                                               if currLnb.uncommittedDiseqcCommand.value > 0:
-                                                       sec.setUncommittedCommand(0xF0|(currLnb.uncommittedDiseqcCommand.value-1))
+
+                                               udc = int(currLnb.uncommittedDiseqcCommand.value)
+                                               if udc > 0:
+                                                       sec.setUncommittedCommand(0xF0|(udc-1))
                                                else:
                                                        sec.setUncommittedCommand(0) # SENDNO
                                                else:
                                                        sec.setUncommittedCommand(0) # SENDNO
-                                               
-                                               if currentConfigSelectionElement(currLnb.diseqcRepeats) == "none":
-                                                       sec.setRepeats(0)
-                                               elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "one":
-                                                       sec.setRepeats(1)
-                                               elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "two":
-                                                       sec.setRepeats(2)
-                                               elif currentConfigSelectionElement(currLnb.diseqcRepeats) == "three":
-                                                       sec.setRepeats(3)
-                                               
-                                       setCommandOrder=False
-                                       if currCO == 0: # committed, toneburst
-                                               setCommandOrder=True
-                                       elif currCO == 1: # toneburst, committed
-                                               setCommandOrder=True
-                                       elif currCO == 2: # committed, uncommitted, toneburst
-                                               setCommandOrder=True
-                                       elif currCO == 3: # toneburst, committed, uncommitted
-                                               setCommandOrder=True
-                                       elif currCO == 4: # uncommitted, committed, toneburst
-                                               setCommandOrder=True
-                                       elif currCO == 5: # toneburst, uncommitted, commmitted
-                                               setCommandOrder=True
-                                       if setCommandOrder:
-                                               sec.setCommandOrder(currCO)
-                                               
-                               if currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
-                                       latitude = configsequencearg.getFloat(currLnb.latitude)
+
+                                               sec.setRepeats({"none": 0, "one": 1, "two": 2, "three": 3}[currLnb.diseqcRepeats.value])
+
+                                       setCommandOrder = False
+                                       
+                                       # 0 "committed, toneburst", 
+                                       # 1 "toneburst, committed", 
+                                       # 2 "committed, uncommitted, toneburst",
+                                       # 3 "toneburst, committed, uncommitted",
+                                       # 4 "uncommitted, committed, toneburst"
+                                       # 5 "toneburst, uncommitted, commmitted"
+                                       order_map = {"ct": 0, "tc": 1, "cut": 2, "tcu": 3, "uct": 4, "tuc": 5}
+                                       sec.setCommandOrder(order_map[currCO])
+
+                               if dm == "1_2":
+                                       latitude = currLnb.latitude.float
                                        sec.setLatitude(latitude)
                                        sec.setLatitude(latitude)
-                                       longitude = configsequencearg.getFloat(currLnb.longitude)
+                                       longitude = currLnb.longitude.float
                                        sec.setLongitude(longitude)
                                        sec.setLongitude(longitude)
-                                       if currentConfigSelectionElement(currLnb.latitudeOrientation) == "north":
+                                       if currLnb.latitudeOrientation.value == "north":
                                                sec.setLaDirection(rotorParam.NORTH)
                                        else:
                                                sec.setLaDirection(rotorParam.SOUTH)
                                                sec.setLaDirection(rotorParam.NORTH)
                                        else:
                                                sec.setLaDirection(rotorParam.SOUTH)
-                                       if currentConfigSelectionElement(currLnb.longitudeOrientation) == "east":
+                                       if currLnb.longitudeOrientation.value == "east":
                                                sec.setLoDirection(rotorParam.EAST)
                                        else:
                                                sec.setLoDirection(rotorParam.WEST)
                                                
                                                sec.setLoDirection(rotorParam.EAST)
                                        else:
                                                sec.setLoDirection(rotorParam.WEST)
                                                
-                               if currentConfigSelectionElement(currLnb.powerMeasurement) == "yes":
+                               if currLnb.powerMeasurement.value:
                                        sec.setUseInputpower(True)
                                        sec.setUseInputpower(True)
-                                       sec.setInputpowerDelta(currLnb.powerThreshold.value[0])
+                                       sec.setInputpowerDelta(currLnb.powerThreshold.value)
                                else:
                                        sec.setUseInputpower(False)
 
                                else:
                                        sec.setUseInputpower(False)
 
@@ -300,22 +278,23 @@ class SecConfigure:
                                for y in lnbSat[x]:
                                        sec.addSatellite(y)
                                        currSat = config.Nims[slotid].advanced.sat[y]
                                for y in lnbSat[x]:
                                        sec.addSatellite(y)
                                        currSat = config.Nims[slotid].advanced.sat[y]
-                                       if currentConfigSelectionElement(currSat.voltage) == "polarization":
+
+                                       if currSat.voltage.value == "polarization":
                                                sec.setVoltageMode(switchParam.HV)
                                                sec.setVoltageMode(switchParam.HV)
-                                       elif currentConfigSelectionElement(currSat.voltage) == "13V":
+                                       elif currSat.voltage.value == "13V":
                                                sec.setVoltageMode(switchParam._14V)
                                                sec.setVoltageMode(switchParam._14V)
-                                       elif currentConfigSelectionElement(currSat.voltage) == "18V":
+                                       elif currSat.voltage.value == "18V":
                                                sec.setVoltageMode(switchParam._18V)
                                                
                                                sec.setVoltageMode(switchParam._18V)
                                                
-                                       if currentConfigSelectionElement(currSat.tonemode) == "band":
+                                       if currSat.tonemode == "band":
                                                sec.setToneMode(switchParam.HILO)
                                                sec.setToneMode(switchParam.HILO)
-                                       elif currentConfigSelectionElement(currSat.tonemode) == "on":
+                                       elif currSat.tonemode == "on":
                                                sec.setToneMode(switchParam.ON)
                                                sec.setToneMode(switchParam.ON)
-                                       elif currentConfigSelectionElement(currSat.tonemode) == "off":
+                                       elif currSat.tonemode == "off":
                                                sec.setToneMode(switchParam.OFF)
                                                
                                                sec.setToneMode(switchParam.OFF)
                                                
-                                       if  currentConfigSelectionElement(currSat.usals) == "no":
-                                               sec.setRotorPosNum(currSat.rotorposition.value[0])
+                                       if not currSat.usals.value:
+                                               sec.setRotorPosNum(currSat.rotorposition.value)
                                        else:
                                                sec.setRotorPosNum(0) #USALS
 
                                        else:
                                                sec.setRotorPosNum(0) #USALS
 
@@ -345,7 +324,7 @@ class NimManager:
                                        tpos = 3600 + tpos
                                tname = attrs.get('name',"").encode("UTF-8")
                                self.satellites[tpos] = tname
                                        tpos = 3600 + tpos
                                tname = attrs.get('name',"").encode("UTF-8")
                                self.satellites[tpos] = tname
-                               self.satList.append( (tname, tpos) )
+                               self.satList.append( (tpos, tname) )
                                self.parsedSat = int(tpos)
                        elif (name == "transponder"):
                                modulation = int(attrs.get('modulation',"1")) # QPSK default
                                self.parsedSat = int(tpos)
                        elif (name == "transponder"):
                                modulation = int(attrs.get('modulation',"1")) # QPSK default
@@ -575,7 +554,7 @@ class NimManager:
                return list
 
        def getNimConfigMode(self, slotid):
                return list
 
        def getNimConfigMode(self, slotid):
-               return currentConfigSelectionElement(config.Nims[slotid].configMode)
+               return config.Nims[slotid].configMode.value
        
        def getSatList(self):
                return self.satList
        
        def getSatList(self):
                return self.satList
@@ -587,26 +566,27 @@ class NimManager:
                        
                        #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value]
                        #print "diseqcA:", config.Nims[slotid].diseqcA.value
                        
                        #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value]
                        #print "diseqcA:", config.Nims[slotid].diseqcA.value
-                       configMode = currentConfigSelectionElement(config.Nims[slotid].configMode)
+                       configMode = config.Nims[slotid].configMode.value
 
                        if configMode == "equal":
                                slotid=0 #FIXME add handling for more than two tuners !!!
 
                        if configMode == "equal":
                                slotid=0 #FIXME add handling for more than two tuners !!!
-                               configMode = currentConfigSelectionElement(config.Nims[slotid].configMode)
+                               configMode = config.Nims[slotid].configMode.value
 
                        if configMode == "simple":
 
                        if configMode == "simple":
-                               if (config.Nims[slotid].diseqcMode.value <= 3):
-                                       list.append(self.satList[config.Nims[slotid].diseqcA.value])
-                               if (0 < config.Nims[slotid].diseqcMode.value <= 3):
-                                       list.append(self.satList[config.Nims[slotid].diseqcB.value])
-                               if (config.Nims[slotid].diseqcMode.value == 3):
-                                       list.append(self.satList[config.Nims[slotid].diseqcC.value])
-                                       list.append(self.satList[config.Nims[slotid].diseqcD.value])
-                               if (config.Nims[slotid].diseqcMode.value == 4):
+                               dm = config.Nims[slotid].diseqcMode.value
+                               if dm in ["single", "toneburst", "diseqc_a_b", "diseqc_a_b_c_d"]:
+                                       list.append(self.satList[config.Nims[slotid].diseqcA.index])
+                               if dm in ["toneburst", "diseqc_a_b", "diseqc_a_b_c_d"]:
+                                       list.append(self.satList[config.Nims[slotid].diseqcB.index])
+                               if dm == "diseqc_a_b_c_d":
+                                       list.append(self.satList[config.Nims[slotid].diseqcC.index])
+                                       list.append(self.satList[config.Nims[slotid].diseqcD.index])
+                               if dm == "positioner":
                                        for x in self.satList:
                                                list.append(x)
                        elif configMode == "advanced":
                                for x in self.satList:
                                        for x in self.satList:
                                                list.append(x)
                        elif configMode == "advanced":
                                for x in self.satList:
-                                       if config.Nims[slotid].advanced.sat[x[1]].lnb.value != 0:
+                                       if int(config.Nims[slotid].advanced.sat[x[0]].lnb.value) != 0:
                                                list.append(x)
 
                return list
                                                list.append(x)
 
                return list
@@ -618,18 +598,18 @@ class NimManager:
 
                        #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value]
                        #print "diseqcA:", config.Nims[slotid].diseqcA.value
 
                        #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value]
                        #print "diseqcA:", config.Nims[slotid].diseqcA.value
-                       configMode = currentConfigSelectionElement(config.Nims[slotid].configMode)
+                       configMode = config.Nims[slotid].configMode.value
                        if configMode == "simple":
                        if configMode == "simple":
-                               if (config.Nims[slotid].diseqcMode.value == 4):
+                               if config.Nims[slotid].diseqcMode.value == "positioner":
                                        for x in self.satList:
                                                list.append(x)
                        elif configMode == "advanced":
                                for x in self.satList:
                                        nim = config.Nims[slotid]
                                        for x in self.satList:
                                                list.append(x)
                        elif configMode == "advanced":
                                for x in self.satList:
                                        nim = config.Nims[slotid]
-                                       lnbnum = nim.advanced.sat[x[1]].lnb.value
+                                       lnbnum = int(nim.advanced.sat[x[0]].lnb.value)
                                        if lnbnum != 0:
                                                lnb = nim.advanced.lnb[lnbnum]
                                        if lnbnum != 0:
                                                lnb = nim.advanced.lnb[lnbnum]
-                                               if lnb.diseqcMode.value == 3: # diseqc 1.2
+                                               if lnb.diseqcMode.value == "diseqc_a_b_c_d":
                                                        list.append(x)
                return list
 
                                                        list.append(x)
                return list
 
@@ -651,7 +631,7 @@ class NimManager:
                pass
 
 def InitNimManager(nimmgr):
                pass
 
 def InitNimManager(nimmgr):
-       config.Nims = []
+       config.Nims = ConfigSubList()
        for x in range(nimmgr.nimCount):
                config.Nims.append(ConfigSubsection())
                
        for x in range(nimmgr.nimCount):
                config.Nims.append(ConfigSubsection())
                
@@ -661,13 +641,13 @@ def InitNimManager(nimmgr):
                nimmgr.nimDiseqcModeChanged(slotid, configElement.value)
                
        def nimPortAChanged(slotid, configElement):
                nimmgr.nimDiseqcModeChanged(slotid, configElement.value)
                
        def nimPortAChanged(slotid, configElement):
-               nimmgr.nimPortAChanged(slotid, configElement.vals[configElement.value][1])
+               nimmgr.nimPortAChanged(slotid, configElement.value)
        def nimPortBChanged(slotid, configElement):
        def nimPortBChanged(slotid, configElement):
-               nimmgr.nimPortBChanged(slotid, configElement.vals[configElement.value][1])
+               nimmgr.nimPortBChanged(slotid, configElement.value)
        def nimPortCChanged(slotid, configElement):
        def nimPortCChanged(slotid, configElement):
-               nimmgr.nimPortCChanged(slotid, configElement.vals[configElement.value][1])
+               nimmgr.nimPortCChanged(slotid, configElement.value)
        def nimPortDChanged(slotid, configElement):
        def nimPortDChanged(slotid, configElement):
-               nimmgr.nimPortDChanged(slotid, configElement.vals[configElement.value][1])
+               nimmgr.nimPortDChanged(slotid, configElement.value)
 
        for slot in nimmgr.nimslots:
                x = slot.slotid
 
        for slot in nimmgr.nimslots:
                x = slot.slotid
@@ -676,46 +656,67 @@ def InitNimManager(nimmgr):
                
                if slot.nimType == nimmgr.nimType["DVB-S"]:
                        if slot.slotid == 0:
                
                if slot.nimType == nimmgr.nimType["DVB-S"]:
                        if slot.slotid == 0:
-                               nim.configMode = configElement(cname + "configMode", configSelection, 0, (
-                               ("simple", _("Simple")), ("advanced", _("Advanced"))), False)
+                               nim.configMode = ConfigSelection(
+                                       choices = {
+                                               "simple": _("simple"),
+                                               "advanced": _("advanced")},
+                                       default = "simple")
                        else:
                        else:
-                               nim.configMode = configElement(cname + "configMode", configSelection, 0, (
-                               ("equal", _("Equal to Socket A")),
-                               ("loopthrough", _("Loopthrough to Socket A")),
-                               ("nothing", _("Nothing connected")),
-                               ("satposdepends", _("Secondary cable from motorized LNB")),
-                               ("simple", _("Simple")),
-                               ("advanced", _("Advanced"))), False)
+
+                               nim.configMode = ConfigSelection(
+                                       choices = {
+                                               "equal": _("equal to Socket A"),
+                                               "looptrough": _("loopthrough to socket A"),
+                                               "nothing": _("nothing connected"),
+                                               "satposdepends": _("second cable of motorized LNB"),
+                                               "simple": _("simple"),
+                                               "advanced": _("advanced")},
+                                       default = "looptrough")
+
                        #important - check if just the 2nd one is LT only and the first one is DVB-S
                        #important - check if just the 2nd one is LT only and the first one is DVB-S
-                       if currentConfigSelectionElement(nim.configMode) in ["loopthrough", "satposdepends", "equal"]:
-                               if x == 0:                                                                              #first one can never be linked to anything
-                                       nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple")              #reset to simple
+                       if nim.configMode.value in ["loopthrough", "satposdepends", "equal"]:
+                               if x == 0: # first one can never be linked to anything
+                                       # reset to simple
+                                       nim.configMode.value = "simple"
                                        nim.configMode.save()
                                else:
                                        #FIXME: make it better
                                        for y in nimmgr.nimslots:
                                                if y.slotid == 0:
                                                        if y.nimType != nimmgr.nimType["DVB-S"]:
                                        nim.configMode.save()
                                else:
                                        #FIXME: make it better
                                        for y in nimmgr.nimslots:
                                                if y.slotid == 0:
                                                        if y.nimType != nimmgr.nimType["DVB-S"]:
-                                                               nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple")              #reset to simple
+                                                               # reset to simple
+                                                               nim.configMode.value = "simple"
                                                                nim.configMode.save()
 
                                                                nim.configMode.save()
 
-                       nim.diseqcMode = configElement(cname + "diseqcMode", configSelection, 2, (("single", _("Single")), ("toneburst_a_b", _("Toneburst A/B")), ("diseqc_a_b", _("DiSEqC A/B")), ("diseqc_a_b_c_d", _("DiSEqC A/B/C/D")), ("positioner", _("Positioner"))), False);
-                       nim.diseqcA = configElement(cname + "diseqcA", configSatlist, 192, nimmgr.satList, False);
-                       nim.diseqcB = configElement(cname + "diseqcB", configSatlist, 130, nimmgr.satList, False);
-                       nim.diseqcC = configElement(cname + "diseqcC", configSatlist, 0, nimmgr.satList, False);
-                       nim.diseqcD = configElement(cname + "diseqcD", configSatlist, 0, nimmgr.satList, False);
-                       nim.positionerMode = configElement(cname + "positionerMode", configSelection, 0, (("usals", _("USALS")), ("manual", _("manual"))), False);
-                       nim.longitude = configElement(cname + "longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,359),(0,999)]), False);
-                       nim.longitudeOrientation = configElement(cname + "longitudeOrientation", configSelection, 0, (("east", _("East")), ("west", _("West"))), False)
-                       nim.latitude = configElement(cname + "latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,359),(0,999)]), False);
-                       nim.latitudeOrientation = configElement(cname + "latitudeOrientation", configSelection, 0, (("north", _("North")), ("south", _("South"))), False)
+                       nim.diseqcMode = ConfigSelection(
+                               choices = [
+                                       ("single", _("Single")),
+                                       ("toneburst_a_b", _("Toneburst A/B")),
+                                       ("diseqc_a_b", _("DiSEqC A/B")),
+                                       ("diseqc_a_b_c_d", _("DiSEqC A/B/C/D")),
+                                       ("positioner", _("Positioner"))],
+                               default = "diseqc_a_b")
+                       nim.diseqcA = ConfigSatlist(default = 192, list = nimmgr.satList)
+                       nim.diseqcB = ConfigSatlist(default = 130, list = nimmgr.satList)
+                       nim.diseqcC = ConfigSatlist(list = nimmgr.satList)
+                       nim.diseqcD = ConfigSatlist(list = nimmgr.satList)
+                       nim.positionerMode = ConfigSelection(
+                               choices = [
+                                       ("usals", _("USALS")),
+                                       ("manual", _("manual"))],
+                               default = "usals")
+                       nim.longitude = ConfigFloat(default=[5,100], limits=[(0,359),(0,999)])
+                       nim.longitudeOrientation = ConfigSelection(choices={"east": _("East"), "west": _("West")}, default = "east")
+                       nim.latitude = ConfigFloat(default=[50,767], limits=[(0,359),(0,999)])
+                       nim.latitudeOrientation = ConfigSelection(choices={"north": _("North"), "south": _("South")}, default="north")
                        satNimList = nimmgr.getNimListOfType(nimmgr.nimType["DVB-S"], slot.slotid)
                        satNimList = nimmgr.getNimListOfType(nimmgr.nimType["DVB-S"], slot.slotid)
-                       satNimListNames = []
+                       satNimListNames = {}
                        for x in satNimList:
                        for x in satNimList:
-                               satNimListNames.append((("Slot_" + ("A", "B", "C", "D")[x] + "_" + nimmgr.getNimName(x)), _("Slot ") + ("A", "B", "C", "D")[x] + ": " + nimmgr.getNimName(x)))
-                       nim.equalTo = configElement(cname + "equalTo", configSelection, 0, satNimListNames, False);
-                       nim.linkedTo = configElement(cname + "linkedTo", configSelection, 0, satNimListNames, False);
-                       nim.satposDependsTo = configElement(cname + "satposDependsTo", configSelection, 0, satNimListNames, False);
+                               satNimListNames["Slot_" + ("A", "B", "C", "D")[x] + "_" + nimmgr.getNimName(x)] = _("Slot ") + ("A", "B", "C", "D")[x] + ": " + nimmgr.getNimName(x)
+                       if len(satNimListNames):
+                               nim.equalTo = ConfigSelection(choices = satNimListNames)
+                               nim.linkedTo = ConfigSelection(choices = satNimListNames)
+                               nim.satposDependsTo = ConfigSelection(choices = satNimListNames)
                        
                        #perhaps the instance of the slot is more useful?
 #                      nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x))
                        
                        #perhaps the instance of the slot is more useful?
 #                      nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x))
@@ -727,61 +728,72 @@ def InitNimManager(nimmgr):
                        
                        # advanced config:
                        nim.advanced = ConfigSubsection()
                        
                        # advanced config:
                        nim.advanced = ConfigSubsection()
-                       nim.advanced.sats = configElement(cname + "advanced.sats", configSatlist, 192, nimmgr.satList, False);
-                       nim.advanced.sat = {}
-                       lnbs = ["not available"]
+                       nim.advanced.sats = ConfigSatlist(default = 192, list = nimmgr.satList)
+                       nim.advanced.sat = ConfigSubDict()
+                       lnbs = [("0", "not available")]
                        for y in range(1, 33):
                        for y in range(1, 33):
-                               lnbs.append("LNB " + str(y))
+                               lnbs.append((str(y), "LNB " + str(y)))
+
                        for x in nimmgr.satList:
                        for x in nimmgr.satList:
-                               nim.advanced.sat[x[1]] = ConfigSubsection()
-                               nim.advanced.sat[x[1]].voltage = configElement(cname + "advanced.sat" + str(x[1]) + ".voltage", configSelection, 0, (("polarization", _("Polarization")), ("13V", _("13 V")), ("18V", _("18 V"))), False)
-                               nim.advanced.sat[x[1]].tonemode = configElement(cname + "advanced.sat" + str(x[1]) + ".tonemode", configSelection, 0, (("band", _("Band")), ("on", _("On")), ("off", _("Off"))), False)
-                               nim.advanced.sat[x[1]].usals = configElement(cname + "advanced.sat" + str(x[1]) + ".usals", configSelection, 0, (("yes", _("Yes")), ("no", _("No"))), False)
-                               nim.advanced.sat[x[1]].rotorposition = configElement(cname + "advanced.sat" + str(x[1]) + ".rotorposition", configSequence, [1], configsequencearg.get("INTEGER", (1, 255)), False)
-                               nim.advanced.sat[x[1]].lnb = configElement(cname + "advanced.sat" + str(x[1]) + ".lnb", configSelection, 0, lnbs, False)
+                               nim.advanced.sat[x[0]] = ConfigSubsection()
+                               nim.advanced.sat[x[0]].voltage = ConfigSelection(choices={"polarization": _("Polarization"), "13V": _("13 V"), "18V": _("18 V")}, default = "polarization")
+                               nim.advanced.sat[x[0]].tonemode = ConfigSelection(choices={"band": _("Band"), "on": _("On"), "off": _("Off")}, default = "band")
+                               nim.advanced.sat[x[0]].usals = ConfigYesNo(default=True)
+                               nim.advanced.sat[x[0]].rotorposition = ConfigInteger(default=1, limits=(1, 255))
+                               nim.advanced.sat[x[0]].lnb = ConfigSelection(choices = lnbs)
 
                        csw = [("none", _("None")), ("AA", _("AA")), ("AB", _("AB")), ("BA", _("BA")), ("BB", _("BB"))]
                        for y in range(0, 16):
                                csw.append((str(0xF0|y), "Input " + str(y+1)))
 
 
                        csw = [("none", _("None")), ("AA", _("AA")), ("AB", _("AB")), ("BA", _("BA")), ("BB", _("BB"))]
                        for y in range(0, 16):
                                csw.append((str(0xF0|y), "Input " + str(y+1)))
 
-                       ucsw = [("none", _("None"))]
+                       ucsw = [("0", _("None"))]
                        for y in range(1, 17):
                        for y in range(1, 17):
-                               ucsw.append("Input " + str(y))
+                               ucsw.append((str(y), "Input " + str(y)))
 
 
-                       nim.advanced.lnb = [0]
+                       nim.advanced.lnb = ConfigSubList()
+                       nim.advanced.lnb.append(ConfigDummy())
                        for x in range(1, 33):
                                nim.advanced.lnb.append(ConfigSubsection())
                        for x in range(1, 33):
                                nim.advanced.lnb.append(ConfigSubsection())
-                               nim.advanced.lnb[x].lof = configElement(cname + "advanced.lnb" + str(x) + ".lof", configSelection, 0, (("universal_lnb", _("Universal LNB")), ("c_band", _("C-Band")), ("user_defined", _("User defined"))), False)
-                               nim.advanced.lnb[x].lofl = configElement(cname + "advanced.lnb" + str(x) + ".lofl", configSequence, [9750], configsequencearg.get("INTEGER", (0, 99999)), False)
-                               nim.advanced.lnb[x].lofh = configElement(cname + "advanced.lnb" + str(x) + ".lofh", configSequence, [10600], configsequencearg.get("INTEGER", (0, 99999)), False)
-                               nim.advanced.lnb[x].threshold = configElement(cname + "advanced.lnb" + str(x) + ".threshold", configSequence, [11700], configsequencearg.get("INTEGER", (0, 99999)), False)
-                               nim.advanced.lnb[x].output_12v = configElement(cname + "advanced.lnb" + str(x) + ".output_12v", configSelection, 0, (("0V", _("0 V")), ("12V", _("12 V"))), False)
-                               nim.advanced.lnb[x].increased_voltage = configElement(cname + "advanced.lnb" + str(x) + ".increased_voltage", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))), False)
-                               nim.advanced.lnb[x].toneburst = configElement(cname + "advanced.lnb" + str(x) + ".toneburst", configSelection, 0, (("none", _("None")), ("A", _("A")), ("B", _("B"))), False)
-                               nim.advanced.lnb[x].diseqcMode = configElement(cname + "advanced.lnb" + str(x) + ".diseqcMode", configSelection, 0, (("none", _("None")), ("1_0", _("1.0")), ("1_1", _("1.1")), ("1_2", _("1.2"))), False)
-                               nim.advanced.lnb[x].commitedDiseqcCommand = configElement(cname + "advanced.lnb" + str(x) + ".commitedDiseqcCommand", configSelection, 0, csw, False)
-                               nim.advanced.lnb[x].fastDiseqc = configElement(cname + "advanced.lnb" + str(x) + ".fastDiseqc", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))), False)
-                               nim.advanced.lnb[x].sequenceRepeat = configElement(cname + "advanced.lnb" + str(x) + ".sequenceRepeat", configSelection, 0, (("no", _("No")), ("yes", _("Yes"))), False)
-                               nim.advanced.lnb[x].commandOrder1_0 = configElement(cname + "advanced.lnb" + str(x) + ".commandOrder1_0", configSelection, 0, ("committed, toneburst", "toneburst, committed"), False)
-                               nim.advanced.lnb[x].commandOrder = configElement(cname + "advanced.lnb" + str(x) + ".commandOrder", configSelection, 0, ("committed, toneburst", "toneburst, committed", "committed, uncommitted, toneburst", "toneburst, committed, uncommitted", "uncommitted, committed, toneburst", "toneburst, uncommitted, commmitted"), False)
-                               nim.advanced.lnb[x].uncommittedDiseqcCommand = configElement(cname + "advanced.lnb" + str(x) + ".uncommittedDiseqcCommand", configSelection, 0, ucsw, False)
-                               nim.advanced.lnb[x].diseqcRepeats = configElement(cname + "advanced.lnb" + str(x) + ".diseqcRepeats", configSelection, 0, (("none", _("None")), ("one", _("One")), ("two", _("Two")), ("three", _("Three"))), False)
-                               nim.advanced.lnb[x].longitude = configElement(cname + "advanced.lnb" + str(x) + ".longitude", configSequence, [5,100], configsequencearg.get("FLOAT", [(0,359),(0,999)]), False)
-                               nim.advanced.lnb[x].longitudeOrientation = configElement(cname + "advanced.lnb" + str(x) + ".longitudeOrientation", configSelection, 0, (("east", _("East")), ("west", _("West"))), False)
-                               nim.advanced.lnb[x].latitude = configElement(cname + "advanced.lnb" + str(x) + ".latitude", configSequence, [50,767], configsequencearg.get("FLOAT", [(0,359),(0,999)]), False)
-                               nim.advanced.lnb[x].latitudeOrientation = configElement(cname + "advanced.lnb" + str(x) + ".latitudeOrientation", configSelection, 0, (("north", _("North")), ("south", _("South"))), False)
-                               nim.advanced.lnb[x].powerMeasurement = configElement(cname + "advanced.lnb" + str(x) + ".powerMeasurement", configSelection, 0, (("yes", _("Yes")), ("no", _("No"))), False)
-                               nim.advanced.lnb[x].powerThreshold = configElement(cname + "advanced.lnb" + str(x) + ".powerThreshold", configSequence, [50], configsequencearg.get("INTEGER", (0, 100)), False)
+                               nim.advanced.lnb[x].lof = ConfigSelection(choices={"universal_lnb": _("Universal LNB"), "c_band": _("C-Band"), "user_defined": _("User defined")}, default="universal_lnb")
+                               nim.advanced.lnb[x].lofl = ConfigInteger(default=9750, limits = (0, 99999))
+                               nim.advanced.lnb[x].lofh = ConfigInteger(default=10600, limits = (0, 99999))
+                               nim.advanced.lnb[x].threshold = ConfigInteger(default=11700, limits = (0, 99999))
+                               nim.advanced.lnb[x].output_12v = ConfigSelection(choices = [("0V", _("0 V")), ("12V", _("12 V"))], default="0V")
+                               nim.advanced.lnb[x].increased_voltage = ConfigYesNo(default=False)
+                               nim.advanced.lnb[x].toneburst = ConfigSelection(choices = [("none", _("None")), ("A", _("A")), ("B", _("B"))], default = "none")
+                               nim.advanced.lnb[x].diseqcMode = ConfigSelection(choices = [("none", _("None")), ("1_0", _("1.0")), ("1_1", _("1.1")), ("1_2", _("1.2"))], default = "none")
+                               nim.advanced.lnb[x].commitedDiseqcCommand = ConfigSelection(choices = csw)
+                               nim.advanced.lnb[x].fastDiseqc = ConfigYesNo(default=False)
+                               nim.advanced.lnb[x].sequenceRepeat = ConfigYesNo(default=False)
+                               nim.advanced.lnb[x].commandOrder1_0 = ConfigSelection(choices = [("ct", "committed, toneburst"), ("tc", "toneburst, committed")], default = "ct")
+                               nim.advanced.lnb[x].commandOrder = ConfigSelection(choices = [
+                                               ("ct", "committed, toneburst"), 
+                                               ("tc", "toneburst, committed"), 
+                                               ("cut", "committed, uncommitted, toneburst"), 
+                                               ("tcu", "toneburst, committed, uncommitted"), 
+                                               ("uct", "uncommitted, committed, toneburst"), 
+                                               ("tuc", "toneburst, uncommitted, commmitted")],
+                                               default="ct")
+                               nim.advanced.lnb[x].uncommittedDiseqcCommand = ConfigSelection(choices = ucsw)
+                               nim.advanced.lnb[x].diseqcRepeats = ConfigSelection(choices = [("none", _("None")), ("one", _("One")), ("two", _("Two")), ("three", _("Three"))], default = "none")
+                               nim.advanced.lnb[x].longitude = ConfigFloat(default = [5,100], limits = [(0,359),(0,999)])
+                               nim.advanced.lnb[x].longitudeOrientation = ConfigSelection(choices = [("east", _("East")), ("west", _("West"))], default = "east")
+                               nim.advanced.lnb[x].latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)])
+                               nim.advanced.lnb[x].latitudeOrientation = ConfigSelection(choices = [("north", _("North")), ("south", _("South"))], default = "north")
+                               nim.advanced.lnb[x].powerMeasurement = ConfigYesNo(default=True)
+                               nim.advanced.lnb[x].powerThreshold = ConfigInteger(default=50, limits=(0, 100))
+
                elif slot.nimType == nimmgr.nimType["DVB-C"]:
                elif slot.nimType == nimmgr.nimType["DVB-C"]:
-                       nim.cable = configElement(cname + "cable", configSelection, 0, nimmgr.cablesList, False);
+                       nim.cable = ConfigSelection(choices = nimmgr.cablesList)
                elif slot.nimType == nimmgr.nimType["DVB-T"]:
                        list = []
                        for x in nimmgr.terrestrialsList:
                                list.append(x[0])
                elif slot.nimType == nimmgr.nimType["DVB-T"]:
                        list = []
                        for x in nimmgr.terrestrialsList:
                                list.append(x[0])
-                       nim.terrestrial = configElement(cname + "terrestrial", configSelection, 0, list, False);
-                       nim.terrestrial_5V = configElement(cname + "terrestrial_5V", configSelection, 1, (("on", _("On")), ("off", _("Off"))), True);
+                       nim.terrestrial = ConfigSelection(choices = list)
+                       nim.terrestrial_5V = ConfigOnOff()
                else:
                        print "pls add support for this frontend type!"         
                else:
                        print "pls add support for this frontend type!"         
+#                      assert False
 
        nimmgr.sec = SecConfigure(nimmgr)
 
 
        nimmgr.sec = SecConfigure(nimmgr)
 
index 881ac28dbbf8c10846970ab2114d445f8a188ad0..ff87a729dbd58d39f105df944fd5e117df20f23e 100644 (file)
@@ -25,12 +25,12 @@ class RFmod:
 def InitRFmod():
 
        config.rfmod = ConfigSubsection();
 def InitRFmod():
 
        config.rfmod = ConfigSubsection();
-       config.rfmod.enable = configElement("config.rfmod.enable", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))) );
-       config.rfmod.test = configElement("config.rfmod.test", configSelection, 0, (("disable", _("Disable")), ("enable", _("Enable"))) );
-       config.rfmod.sound = configElement("config.rfmod.sound", configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))) );
-       config.rfmod.soundcarrier = configElement("config.rfmod.soundcarrier", configSelection, 1, ("4.5 MHz", "5.5 MHz", "6.0 MHz", "6.5 MHz") );
-       config.rfmod.channel = configElement("config.rfmod.channel", configSelection, 36 - RFMOD_CHANNEL_MIN, tuple(["%d" % x for x in range(RFMOD_CHANNEL_MIN, RFMOD_CHANNEL_MAX)]))
-       config.rfmod.finetune = configElement("config.rfmod.finetune", configSlider, 5, (1, 10));
+       config.rfmod.enable = ConfigOnOff(default=False)
+       config.rfmod.test = ConfigOnOff(default=False)
+       config.rfmod.sound = ConfigOnOff(default=True)
+       config.rfmod.soundcarrier = ConfigSelection(choices=[("4500","4.5 MHz"), ("5500", "5.5 MHz"), ("6000", "6.0 MHz"), ("6500", "6.5 MHz")], default="5500")
+       config.rfmod.channel = ConfigSelection(default = "36", choices = ["%d" % x for x in range(RFMOD_CHANNEL_MIN, RFMOD_CHANNEL_MAX)])
+       config.rfmod.finetune = ConfigSlider(default=5, limits=(1, 10))
 
        iRFmod = RFmod()
 
 
        iRFmod = RFmod()
 
@@ -41,9 +41,9 @@ def InitRFmod():
        def setSoundFunction(configElement):
                iRFmod.setSoundFunction(configElement.value);
        def setSoundCarrier(configElement):
        def setSoundFunction(configElement):
                iRFmod.setSoundFunction(configElement.value);
        def setSoundCarrier(configElement):
-               iRFmod.setSoundCarrier(configElement.value);
+               iRFmod.setSoundCarrier(int(configElement.value));
        def setChannel(configElement):
        def setChannel(configElement):
-               iRFmod.setChannel(configElement.value + RFMOD_CHANNEL_MIN);
+               iRFmod.setChannel(int(configElement.value));
        def setFinetune(configElement):
                iRFmod.setFinetune(configElement.value - 5);
 
        def setFinetune(configElement):
                iRFmod.setFinetune(configElement.value - 5);
 
index ea037a617805767fccc736632d8c8be139589bca..03719860cc8f161de0237f86394386042b374cae 100644 (file)
@@ -1,10 +1,9 @@
-from config import *
+from config import ConfigInteger, ConfigYesNo, ConfigSubsection, config
 import os
 import os
-from enigma import *
 
 def InitRecordingConfig():
        config.recording = ConfigSubsection();
        # actually this is "recordings always have priority". "Yes" does mean: don't ask. The RecordTimer will ask when value is 0.
 
 def InitRecordingConfig():
        config.recording = ConfigSubsection();
        # actually this is "recordings always have priority". "Yes" does mean: don't ask. The RecordTimer will ask when value is 0.
-       config.recording.asktozap = configElement("config.recording.asktozap", configSelection, 1, (("no", _("no")), ("yes", _("yes"))) )
-       config.recording.margin_before = configElement("config.recording.margin_before", configSequence, [0], configsequencearg.get("INTEGER", (0, 30)))
-       config.recording.margin_after = configElement("config.recording.margin_after", configSequence, [0], configsequencearg.get("INTEGER", (0, 30)))
+       config.recording.asktozap = ConfigYesNo(default=True)
+       config.recording.margin_before = ConfigInteger(default=0, limits=(0,30))
+       config.recording.margin_after = ConfigInteger(default=0, limits=(0,30))
index 4b49501f7171e3eead576ef8e83a20b83f07a8de..5fa8c356191b8c79df99db2ab6376f640df351fe 100644 (file)
@@ -5,7 +5,9 @@ class PositionGauge(Renderer):
        def __init__(self):
                Renderer.__init__(self)
                self.__position = 0
        def __init__(self):
                Renderer.__init__(self)
                self.__position = 0
+               self.__seek_position = 0
                self.__length = 0
                self.__length = 0
+               self.__seek_enable = 0
                self.__cutlist = [ ]
        
        GUI_WIDGET = ePositionGauge
                self.__cutlist = [ ]
        
        GUI_WIDGET = ePositionGauge
@@ -53,3 +55,23 @@ class PositionGauge(Renderer):
                        self.instance.setInOutList(cutlist)
 
        cutlist = property(getCutlist, setCutlist)
                        self.instance.setInOutList(cutlist)
 
        cutlist = property(getCutlist, setCutlist)
+
+       def getSeekEnable(self):
+               return self.__seek_enable
+       
+       def setSeekEnable(self, val):
+               self.__seek_enable = val
+               if self.instance is not None:
+                       self.instance.enableSeekPointer(val)
+
+       seek_pointer_enabled = property(getSeekEnable, setSeekEnable)
+
+       def getSeekPosition(self):
+               return self.__seek_position
+       
+       def setSeekPosition(self, pos):
+               self.__seek_position = pos
+               if self.instance is not None:
+                       self.instance.setSeekPosition(pos)
+       
+       seek_pointer_position = property(getSeekPosition, setSeekPosition)
index f5771e3a0d9f8e9be032f9c5bde480429eec690d..d34d81fbdb5f57ede9cba1d39be72739dd1ef6ad 100644 (file)
@@ -3,13 +3,14 @@ from Components.GUIComponent import GUIComponent
 from enigma import eTimer, iPlayableService, iSeekableServicePtr, ePositionGauge
 import time
 
 from enigma import eTimer, iPlayableService, iSeekableServicePtr, ePositionGauge
 import time
 
-class ServicePosition(PerServiceDisplay):
+class ServicePosition(PerServiceDisplay, object):
        TYPE_LENGTH = 0,
        TYPE_POSITION = 1,
        TYPE_REMAINING = 2,
        TYPE_RELATIVE = 3
        
        def __init__(self, navcore, type):
        TYPE_LENGTH = 0,
        TYPE_POSITION = 1,
        TYPE_REMAINING = 2,
        TYPE_RELATIVE = 3
        
        def __init__(self, navcore, type):
+               object.__init__(self)
                self.updateTimer = eTimer()
                self.updateTimer.timeout.get().append(self.update)
                PerServiceDisplay.__init__(self, navcore,
                self.updateTimer = eTimer()
                self.updateTimer.timeout.get().append(self.update)
                PerServiceDisplay.__init__(self, navcore,
@@ -95,6 +96,7 @@ class ServicePositionGauge(PerServiceBase, GUIComponent):
                                iPlayableService.evCuesheetChanged: self.newCuesheet
                        })
                self.instance = None
                                iPlayableService.evCuesheetChanged: self.newCuesheet
                        })
                self.instance = None
+               self.__seek_position = 0
 
        def newService(self):
                if self.get() is None:  
 
        def newService(self):
                if self.get() is None:  
@@ -107,7 +109,7 @@ class ServicePositionGauge(PerServiceBase, GUIComponent):
                service = self.navcore.getCurrentService()
                seek = service and service.seek()
                if seek is None:
                service = self.navcore.getCurrentService()
                seek = service and service.seek()
                if seek is None:
-                       return None
+                       return (0, 0)
 
                len = seek.getLength()
                pos = seek.getPlayPosition()
 
                len = seek.getLength()
                pos = seek.getPlayPosition()
@@ -132,6 +134,7 @@ class ServicePositionGauge(PerServiceBase, GUIComponent):
        
        def postWidgetCreate(self, instance):
                self.newService()
        
        def postWidgetCreate(self, instance):
                self.newService()
+               self.setSeekPosition(self.__seek_position)
        
        def newCuesheet(self):
                service = self.navcore.getCurrentService()
        
        def newCuesheet(self):
                service = self.navcore.getCurrentService()
@@ -139,3 +142,25 @@ class ServicePositionGauge(PerServiceBase, GUIComponent):
                cutlist = (cue and cue.getCutList()) or [ ]
                if self.instance is not None:
                        self.instance.setInOutList(cutlist)
                cutlist = (cue and cue.getCutList()) or [ ]
                if self.instance is not None:
                        self.instance.setInOutList(cutlist)
+
+       def getSeekEnable(self):
+               return self.__seek_enable
+       
+       def setSeekEnable(self, val):
+               self.__seek_enable = val
+               if self.instance is not None:
+                       self.instance.enableSeekPointer(val)
+
+       seek_pointer_enabled = property(getSeekEnable, setSeekEnable)
+
+       def getSeekPosition(self):
+               return self.__seek_position
+       
+       def setSeekPosition(self, pos):
+               print "set seek position:", pos
+               self.__seek_position = pos
+               if self.instance is not None:
+                       print "set instance."
+                       self.instance.setSeekPosition(pos)
+       
+       seek_pointer_position = property(getSeekPosition, setSeekPosition)
index 9036fa63f0560780afba9636772410b63ab43d7f..bdbdcf032e890bd824b35db6f2d5a65487c6a195 100644 (file)
@@ -1,10 +1,4 @@
-#import os
-from config import config                              #global config instance
-from config import configElement
-from config import ConfigSubsection
-from config import configSlider
-from config import configSelection
-from config import configText
+from config import config, ConfigSlider, ConfigSelection, ConfigSubsection, ConfigOnOff, ConfigText
 from Components.Timezones import timezones
 from Components.Language import language
 
 from Components.Timezones import timezones
 from Components.Language import language
 
@@ -14,34 +8,26 @@ def InitSetupDevices():
                timezones.activateTimezone(configElement.value)
                
        config.timezone = ConfigSubsection();
                timezones.activateTimezone(configElement.value)
                
        config.timezone = ConfigSubsection();
-       config.timezone.val = configElement("config.timezone.val", configSelection, timezones.getDefaultTimezone(), timezones.getTimezoneList());
+       config.timezone.val = ConfigSelection(default = timezones.getDefaultTimezone(), choices = timezones.getTimezoneList())
        config.timezone.val.addNotifier(timezoneNotifier)
 
        config.timezone.val.addNotifier(timezoneNotifier)
 
-       config.rc = ConfigSubsection();
-       config.rc.map = configElement("config.rc.map", configSelection, 0, (_("Default"), _("Classic")) );
-
        config.keyboard = ConfigSubsection();
        config.keyboard = ConfigSubsection();
-       config.keyboard.keymap = configElement("config.keyboard.keymap", configSelection, 1, (_("English"), _("German")) );
+       config.keyboard.keymap = ConfigSelection(choices = [("en", _("English")), ("de",_("German"))])
 
 
-       config.osd = ConfigSubsection();
-       config.osd.alpha = configElement("config.osd.alpha", configSlider, 0, (1, 10));
-       config.osd.bright = configElement("config.osd.bright", configSlider, 5, (1, 10));
-       config.osd.contrast = configElement("config.osd.contrast", configSlider, 5, (1, 10));
-       
        def languageNotifier(configElement):
                language.activateLanguage(configElement.value)
        
        def languageNotifier(configElement):
                language.activateLanguage(configElement.value)
        
-       config.osd.language = configElement("config.osd.language", configText, "en_EN", 0);
+       config.osd = ConfigSubsection()
+       config.osd.language = ConfigText(default = "en_EN");
        config.osd.language.addNotifier(languageNotifier)
 
        config.parental = ConfigSubsection();
        config.osd.language.addNotifier(languageNotifier)
 
        config.parental = ConfigSubsection();
-       config.parental.lock = configElement("config.parental.lock", configSelection, 1, (_("Enable"), _("Disable")) );
-       config.parental.setuplock = configElement("config.parental.setuplock", configSelection, 1, (_("Enable"), _("Disable")) );
+       config.parental.lock = ConfigOnOff(default = False)
+       config.parental.setuplock = ConfigOnOff(default = False)
 
        config.expert = ConfigSubsection();
 
        config.expert = ConfigSubsection();
-       config.expert.splitsize = configElement("config.expert.splitsize", configSelection, 1, ("0.5Gbyte", "1.0 GByte", "1.5 GByte", "2.0 GByte") );
-       config.expert.satpos = configElement("config.expert.satpos", configSelection, 1, (_("Enable"), _("Disable")) );
-       config.expert.fastzap = configElement("config.expert.fastzap", configSelection, 0, (_("Enable"), _("Disable")) );
-       config.expert.skipconfirm = configElement("config.expert.skipconfirm", configSelection, 1, (_("Enable"), _("Disable")) );
-       config.expert.hideerrors = configElement("config.expert.hideerrors", configSelection, 1, (_("Enable"), _("Disable")) );
-       config.expert.autoinfo = configElement("config.expert.autoinfo", configSelection, 1, (_("Enable"), _("Disable")) );
+       config.expert.satpos = ConfigOnOff(default = True)
+       config.expert.fastzap = ConfigOnOff(default = True)
+       config.expert.skipconfirm = ConfigOnOff(default = False)
+       config.expert.hideerrors = ConfigOnOff(default = False)
+       config.expert.autoinfo = ConfigOnOff(default = True)
index 923c65129c751789016502bb2506d2097824f288..a1609840274455ff8a765925d40531fc72e8f958 100644 (file)
@@ -2,4 +2,4 @@ installdir = $(LIBDIR)/enigma2/python/Components/Sources
 
 install_PYTHON = \
        __init__.py Clock.py EventInfo.py Source.py MenuList.py CurrentService.py \
 
 install_PYTHON = \
        __init__.py Clock.py EventInfo.py Source.py MenuList.py CurrentService.py \
-       FrontendStatus.py Boolean.py
+       FrontendStatus.py Boolean.py Config.py ServiceList.py
index a6af141270d65c61047b96ef456039cc36ab2ef6..35e78de0f9c395073ef3bcf54fcf4463c2ecad25 100644 (file)
@@ -1,4 +1,3 @@
-from Components.config import config
 from Components.NimManager import nimmanager
 from time import localtime
 
 from Components.NimManager import nimmanager
 from time import localtime
 
index 15837450e1074a70966a57a627740c74b0ed807e..704b765e2b17deb2e47db097a1071e6f01f5689a 100644 (file)
@@ -52,6 +52,6 @@ class Timezones:
        
        def getDefaultTimezone(self):
                # TODO return something more useful - depending on country-settings?
        
        def getDefaultTimezone(self):
                # TODO return something more useful - depending on country-settings?
-               return 27
+               return "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Vienna"
 
 timezones = Timezones()
 
 timezones = Timezones()
index e10a7491ae484d7fe6a28f23f49f192680ffb93c..36fc41781601220c89e335909689a35ca04682bb 100644 (file)
@@ -1,10 +1,8 @@
-from config import *
-import os
-from enigma import *
+from config import ConfigSubsection, ConfigYesNo, config
 
 def InitUsageConfig():
        config.usage = ConfigSubsection();
 
 def InitUsageConfig():
        config.usage = ConfigSubsection();
-       config.usage.showdish = configElement("config.usage.showdish", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
-       config.usage.multibouquet = configElement("config.usage.multibouquet", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
-       config.usage.quickzap_bouquet_change = configElement("config.usage.quickzap_bouquet_change", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
-       config.usage.e1like_radio_mode = configElement("config.usage.e1like_radio_mode", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
+       config.usage.showdish = ConfigYesNo(default = False)
+       config.usage.multibouquet = ConfigYesNo(default = False)
+       config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
+       config.usage.e1like_radio_mode = ConfigYesNo(default = False)
index e140295d2ee9089c27fbd49a04c27e01cc5430ba..b5a0bbbdba8049a1a93c7e9996827f95b6fb2b44 100644 (file)
-from time import *
+import time
 from Tools.NumericalTextInput import NumericalTextInput
 from Tools.NumericalTextInput import NumericalTextInput
-from Tools.Directories import *
-
-class configFile:
+from Tools.Directories import resolveFilename, SCOPE_CONFIG
+
+
+# ConfigElement, the base class of all ConfigElements.
+
+# it stores:
+#   value    the current value, usefully encoded.
+#            usually a property which retrieves _value,
+#            and maybe does some reformatting
+#   _value   the value as it's going to be saved in the configfile,
+#            though still in non-string form.
+#            this is the object which is actually worked on.
+#   default  the initial value. If _value is equal to default,
+#            it will not be stored in the config file
+#   saved_value is a text representation of _value, stored in the config file
+#
+# and has (at least) the following methods:
+#   save()   stores _value into saved_value, 
+#            (or stores 'None' if it should not be stored)
+#   load()   loads _value from saved_value, or loads
+#            the default if saved_value is 'None' (default)
+#            or invalid.
+#
+class ConfigElement(object):
        def __init__(self):
        def __init__(self):
-               self.changed = 0
-               self.configElements = { }
-               try:
-                       self.file = open(resolveFilename(SCOPE_CONFIG, "config"))
-               except IOError:
-                       print "cannot open config file"
-                       return 
-               
-               while 1:
-                       line = self.file.readline()
-                       if line == "":
-                               break
-                       
-                       if line.startswith("#"):                #skip comments
-                               continue        
-                               
-                       self.addElement(line)
-               self.file.close()
-
-       def addElement(self, line):
-               x = line.find("=")
-               if x > -1:
-                       self.configElements[line[:x]] = line[x + 1:-1]
-
-       def getKey(self, key):
-               return self.configElements[key]
-
-       def setKey(self, key, value, isDefaultKey=False):
-               self.changed = 1
-               if isDefaultKey and self.configElements.has_key(key):
-                       del self.configElements[key]
-               else:
-                       self.configElements[key] = value
+               object.__init__(self)
+               self.saved_value = None
+               self.save_disabled = False
+               self.notifiers = []
+               self.enabled = True
 
 
-       def getResolvedKey(self, key):
-               str = self.configElements[key]
-               if len(str):
-                       pos = str.find('*')
-                       if pos != -1:
-                               str = str[pos+1:]
-                               pos = str.find('*')
-                               if pos != -1:
-                                       return str[:pos]
-                       return str
-               return None
+       # you need to override this to do input validation
+       def setValue(self, value):
+               self._value = value
+               self.changed()
 
 
-       def save(self):
-               if self.changed == 0:           #no changes, so no write to disk needed
-                       return
-                       
-               fileHandle = open(resolveFilename(SCOPE_CONFIG, "config"), "w")
-               
-               keys = self.configElements.keys()
-               keys.sort()
-               for x in keys:
-                       wstr = x + "=" + self.configElements[x] + "\n"
+       def getValue(self):
+               return self._value
+       
+       value = property(getValue, setValue)
 
 
-                       fileHandle.write(wstr)
+       # you need to override this if self.value is not a string
+       def fromstring(self, value):
+               return value
 
 
-               fileHandle.close()
-               
-def currentConfigSelectionElement(element):
-       return element.vals[element.value][0]
-
-def getConfigSelectionElement(element, value):
-       count = 0
-       for x in element.vals:
-               if x[0] == value:
-                       return count
-               count += 1
-       return -1
-
-class configSelection:
-       def __init__(self, parent):
-               self.parent = parent
-               
-       def checkValues(self):
-               if self.parent.value < 0:
-                       self.parent.value = len(self.parent.vals) - 1   
-               elif(self.parent.value > (len(self.parent.vals) - 1)):
-                       self.parent.value = 0
+       # you can overide this for fancy default handling
+       def load(self):
+               if self.saved_value is None:
+                       self.value = self.default
+               else:
+                       self.value = self.fromstring(self.saved_value)
 
 
-       def cancel(self):
-               self.parent.reload()
+       def tostring(self, value):
+               return str(value)
 
 
+       # you need to override this if str(self.value) doesn't work
        def save(self):
        def save(self):
-               self.parent.save()
+               if self.save_disabled or self.value == self.default:
+                       self.saved_value = None
+               else:
+                       self.saved_value = self.tostring(self.value)
 
 
-       def handleKey(self, key):
-               if key == config.key["prevElement"]:
-                       self.parent.value = self.parent.value - 1
-               if key == config.key["nextElement"]:
-                       self.parent.value = self.parent.value + 1
-               
-               self.checkValues()                      
+       def cancel(self):
+               self.load()
 
 
-               self.parent.change()
+       def changed(self):
+               for x in self.notifiers:
+                       x(self)
+                       
+       def addNotifier(self, notifier):
+               assert callable(notifier), "notifiers must be callable"
+               self.notifiers.append(notifier)
 
 
-       def __call__(self, selected):                   #needed by configlist
-               self.checkValues()
+       def disableSave(self):
+               self.save_disabled = True
 
 
-               returnValue = _(self.parent.vals[self.parent.value])
-               if not isinstance(returnValue, str):
-                       returnValue = returnValue[1]
+       def __call__(self, selected):
+               return self.getMulti(selected)
 
 
-               # FIXME: it's not really nice to translate this here.
-               # however, configSelections are persistent.
+       def helpWindow(self):
+               return None
+
+KEY_LEFT = 0
+KEY_RIGHT = 1
+KEY_OK = 2
+KEY_DELETE = 3
+KEY_TIMEOUT = 4
+KEY_NUMBERS = range(12, 12+10)
+KEY_0 = 12
+KEY_9 = 12+9
+
+def getKeyNumber(key):
+       assert key in KEY_NUMBERS
+       return key - KEY_0
+
+#
+# ConfigSelection is a "one of.."-type.
+# it has the "choices", usually a list, which contains
+# (id, desc)-tuples (or just only the ids, in case the id
+# will be used as description)
+#
+# all ids MUST be plain strings.
+#
+class ConfigSelection(ConfigElement):
+       def __init__(self, choices, default = None):
+               ConfigElement.__init__(self)
+               self.choices = []
+               self.description = {}
                
                
-               # WORKAROUND: don't translate ""
-               if returnValue:
-                       returnValue = _(returnValue)
+               if isinstance(choices, list):
+                       for x in choices:
+                               if isinstance(x, tuple):
+                                       self.choices.append(x[0])
+                                       self.description[x[0]] = x[1]
+                               else:
+                                       self.choices.append(x)
+                                       self.description[x] = x
+               elif isinstance(choices, dict):
+                       for (key, val) in choices.items():
+                               self.choices.append(key)
+                               self.description[key] = val
+               else:
+                       assert False, "ConfigSelection choices must be dict or list!"
                
                
-               return ("text", returnValue)
+               assert len(self.choices), "you can't have an empty configselection"
+
+               if default is None:
+                       default = self.choices[0]
+
+               assert default in self.choices, "default must be in choice list, but " + repr(default) + " is not!"
+               for x in self.choices:
+                       assert isinstance(x, str), "ConfigSelection choices must be strings"
                
                
-class configDateTime:
-       def __init__(self, parent):
-               self.parent = parent
+               self.value = self.default = default
+
+       def setValue(self, value):
+               if value in self.choices:
+                       self._value = value
+               else:
+                       self._value = self.default
                
                
-       def checkValues(self):
-               pass
-#              if self.parent.value < 0:
-                       #self.parent.value = 0  
+               self.changed()
 
 
-               #if(self.parent.value >= (len(self.parent.vals) - 1)):
-                       #self.parent.value = len(self.parent.vals) - 1
+       def tostring(self, val):
+               return (val, ','.join(self.choices))
 
 
-       def cancel(self):
-               self.parent.reload()
+       def getValue(self):
+               return self._value
 
 
-       def save(self):
-               self.parent.save()
+       value = property(getValue, setValue)
+       
+       def getIndex(self):
+               return self.choices.index(self.value)
+       
+       index = property(getIndex)
 
 
+       # GUI
        def handleKey(self, key):
        def handleKey(self, key):
-               if key == config.key["prevElement"]:
-                       self.parent.value = self.parent.value - self.parent.vals[1]
-               if key == config.key["nextElement"]:
-                       self.parent.value = self.parent.value + self.parent.vals[1]
-               
-               self.checkValues()
+               nchoices = len(self.choices)
+               i = self.choices.index(self.value)
+               if key == KEY_LEFT:
+                       self.value = self.choices[(i + nchoices - 1) % nchoices]
+               elif key == KEY_RIGHT:
+                       self.value = self.choices[(i + 1) % nchoices]
+               elif key == KEY_TIMEOUT:
+                       self.timeout()
+                       return
 
 
-               self.parent.change()    
+       def getMulti(self, selected):
+               return ("text", self.description[self.value])
 
 
-       def __call__(self, selected):                   #needed by configlist
-               self.checkValues()
-               return ("text", strftime(self.parent.vals[0], localtime(self.parent.value)))
-       
-class configSatlist:
-       def __init__(self, parent):
-               self.parent = parent
+       # HTML
+       def getHTML(self, id):
+               res = ""
+               for v in self.choices:
+                       if self.value == v:
+                               checked = 'checked="checked" '
+                       else:
+                               checked = ''
+                       res += '<input type="radio" name="' + id + '" ' + checked + 'value="' + v + '">' + self.description[v] + "</input></br>\n"
+               return res;
+
+       def unsafeAssign(self, value):
+               # setValue does check if value is in choices. This is safe enough.
+               self.value = value
+
+# a binary decision.
+#
+# several customized versions exist for different
+# descriptions.
+#
+class ConfigBoolean(ConfigElement):
+       def __init__(self, default = False, descriptions = {False: "false", True: "true"}):
+               ConfigElement.__init__(self)
+               self.descriptions = descriptions
+               self.value = self.default = default
+       def handleKey(self, key):
+               if key in [KEY_LEFT, KEY_RIGHT]:
+                       self.value = not self.value
 
 
-       def checkValues(self):
-               if self.parent.value < 0:
-                       self.parent.value = 0   
+       def getMulti(self, selected):
+               return ("text", _(self.descriptions[self.value]))
 
 
-               if(self.parent.value >= (len(self.parent.vals) - 1)):
-                       self.parent.value = len(self.parent.vals) - 1
-                       
-       def cancel(self):
-               self.parent.reload()
+       def tostring(self, value):
+               if not value:
+                       return "false"
+               else:
+                       return "true"
 
 
-       def save(self):
-               self.parent.save()
+       def fromstring(self, val):
+               if val == "true":
+                       return True
+               else:
+                       return False
 
 
-       def handleKey(self, key):
-               if key == config.key["prevElement"]:
-                       self.parent.value = self.parent.value - 1
-               if key == config.key["nextElement"]:
-                       self.parent.value = self.parent.value + 1
-               
-               self.checkValues()                      
+       def getHTML(self, id):
+               if self.value:
+                       checked = ' checked="checked"'
+               else:
+                       checked = ''
+               return '<input type="checkbox" name="' + id + '" value="1" ' + checked + " />"
+
+       # this is FLAWED. and must be fixed.
+       def unsafeAssign(self, value):
+               if value == "1":
+                       self.value = True
+               else:
+                       self.value = False
 
 
-               self.parent.change()    
+class ConfigYesNo(ConfigBoolean):
+       def __init__(self, default = False):
+               ConfigBoolean.__init__(self, default = default, descriptions = {False: _("no"), True: _("yes")})
 
 
-       def __call__(self, selected):                   #needed by configlist
-               self.checkValues()
-               #fixme
-               return ("text", str(self.parent.vals[self.parent.value][0]))
-
-class configSequenceArg:
-       def get(self, type, args = ()):
-               # configsequencearg.get ("IP")
-               if (type == "IP"):
-                       return (("."), [(0,255),(0,255),(0,255),(0,255)], "")
-               # configsequencearg.get ("MAC")
-               if (type == "POSITION"):
-                       return ((","), [(0,args[0]),(0,args[1]),(0,args[2]),(0,args[3])], "")
-               if (type == "MAC"):
-                       return ((":"), [(1,255),(1,255),(1,255),(1,255),(1,255),(1,255)], "")
-               # configsequencearg.get ("CLOCK")
-               if (type == "CLOCK"):
-                       return ((":"), [(0,23),(0,59)], "")
-               # configsequencearg.get("INTEGER", (min, max)) => x with min <= x <= max
-               if (type == "INTEGER"):
-                       return ((":"), [args], "")
-               # configsequencearg.get("PINCODE", (number, "*")) => pin with number = length of pincode and "*" as numbers shown as stars
-               # configsequencearg.get("PINCODE", (number, "")) => pin with number = length of pincode and numbers shown
-               if (type == "PINCODE"):
-                       return ((":"), [(0, (10**args[0])-1)], args[1])
-               # configsequencearg.get("FLOAT", [(min,max),(min1,max1)]) => x.y with min <= x <= max and min1 <= y <= max1
-               if (type == "FLOAT"):
-                       return (("."), args, "")
-               
-       def getFloat(self, element):
-               return float(("%d.%0" + str(len(str(element.vals[1][1][1]))) + "d") % (element.value[0], element.value[1]))
+class ConfigOnOff(ConfigBoolean):
+       def __init__(self, default = False):
+               ConfigBoolean.__init__(self, default = default, descriptions = {False: _("off"), True: _("on")})
+
+class ConfigEnableDisable(ConfigBoolean):
+       def __init__(self, default = False):
+               ConfigBoolean.__init__(self, default = default, descriptions = {False: _("disable"), True: _("enable")})
+
+class ConfigDateTime(ConfigElement):
+       def __init__(self, default, formatstring, increment = 86400):
+               ConfigElement.__init__(self)
+               self.increment = increment
+               self.formatstring = formatstring
+               self.value = self.default = int(default)
 
 
-configsequencearg = configSequenceArg()
+       def handleKey(self, key):
+               if key == KEY_LEFT:
+                       self.value = self.value - self.increment
+               if key == KEY_RIGHT:
+                       self.value = self.value + self.increment
+
+       def getMulti(self, selected):
+               return ("text", time.strftime(self.formatstring, time.localtime(self.value)))
+
+       def fromstring(self, val):
+               return int(val)
+
+# *THE* mighty config element class
+#
+# allows you to store/edit a sequence of values.
+# can be used for IP-addresses, dates, plain integers, ...
+# several helper exist to ease this up a bit.
+#
+class ConfigSequence(ConfigElement):
+       def __init__(self, seperator, limits, censor_char = "", default = None):
+               ConfigElement.__init__(self)
+               assert isinstance(limits, list) and len(limits[0]) == 2, "limits must be [(min, max),...]-tuple-list"
+               assert censor_char == "" or len(censor_char) == 1, "censor char must be a single char (or \"\")"
+               #assert isinstance(default, list), "default must be a list"
+               #assert isinstance(default[0], int), "list must contain numbers"
+               #assert len(default) == len(limits), "length must match"
+
+               self.marked_pos = 0
+               self.seperator = seperator
+               self.limits = limits
+               self.censor_char = censor_char
                
                
-class configSequence:
-       def __init__(self, parent):
-               self.parent = parent
-               self.markedPos = 0
-               self.seperator = self.parent.vals[0]
-               self.valueBounds = self.parent.vals[1]
-               self.censorChar = self.parent.vals[2]
+               self.value = self.default = default
 
 
-       def checkValues(self):
-               maxPos = 0
+       def validate(self):
+               max_pos = 0
                num = 0
                num = 0
-               for i in self.parent.value:
-                       maxPos += len(str(self.valueBounds[num][1]))
-                       while (self.valueBounds[num][0] > self.parent.value[num]):
-                               self.parent.value[num] += 1
-
-                       while (self.valueBounds[num][1] < self.parent.value[num]):
-                               self.parent.value[num] -= 1
-                               
-#                      if (self.valueBounds[num][0] <= i <= self.valueBounds[num][1]):
-                               #pass
-                       #else:
-                               #self.parent.value[num] = self.valueBounds[num][0]
+               for i in self._value:
+                       max_pos += len(str(self.limits[num][1]))
+
+                       while self._value[num] < self.limits[num][0]:
+                               self.value[num] += 1
+
+                       while self._value[num] > self.limits[num][1]:
+                               self._value[num] -= 1
+
                        num += 1
                        num += 1
-               
-               if self.markedPos >= maxPos:
-                       self.markedPos = maxPos - 1
-               if self.markedPos < 0:
-                       self.markedPos = 0
+
+               if self.marked_pos >= max_pos:
+                       self.marked_pos = max_pos - 1
+
+               if self.marked_pos < 0:
+                       self.marked_pos = 0
+
+       def validatePos(self):
+               if self.marked_pos < 0:
+                       self.marked_pos = 0
                        
                        
-       def cancel(self):
-               self.parent.reload()
+               total_len = sum([len(str(x[1])) for x in self.limits])
 
 
-       def save(self):
-               self.parent.save()
+               if self.marked_pos >= total_len:
+                       self.marked_pos = total_len - 1
 
        def handleKey(self, key):
 
        def handleKey(self, key):
-               #this will no change anything on the value itself
-               #so we can handle it here in gui element
-               if key == config.key["prevElement"]:
-                       self.markedPos -= 1
-               if key == config.key["nextElement"]:
-                       self.markedPos += 1
+               if key == KEY_LEFT:
+                       self.marked_pos -= 1
+                       self.validatePos()
+
+               if key == KEY_RIGHT:
+                       self.marked_pos += 1
+                       self.validatePos()
                
                
-               if key >= config.key["0"] and key <= config.key["9"]:
-                       self.blockLen = []
-                       for x in self.valueBounds:
-                               self.blockLen.append(len(str(x[1])))
-                               
+               if key in KEY_NUMBERS:
+                       print "is number"
+                       block_len = []
+                       for x in self.limits:
+                               block_len.append(len(str(x[1])))
+                       
+                       total_len = sum(block_len)
+
                        pos = 0
                        blocknumber = 0
                        pos = 0
                        blocknumber = 0
-                       self.blockLenTotal = [0,]
-                       for x in self.blockLen:
-                               pos += self.blockLen[blocknumber]
-                               self.blockLenTotal.append(pos)
-                               if (pos - 1 >= self.markedPos):
+                       block_len_total = [0, ]
+                       for x in block_len:
+                               pos += block_len[blocknumber]
+                               block_len_total.append(pos)
+                               if pos - 1 >= self.marked_pos:
                                        pass
                                else:
                                        blocknumber += 1
                                        pass
                                else:
                                        blocknumber += 1
-                                       
-                       number = 9 - config.key["9"] + key
+
+                       number = getKeyNumber(key)
+                       
                        # length of numberblock
                        # length of numberblock
-                       numberLen = len(str(self.valueBounds[blocknumber][1]))
+                       number_len = len(str(self.limits[blocknumber][1]))
+
                        # position in the block
                        # position in the block
-                       posinblock = self.markedPos - self.blockLenTotal[blocknumber]
+                       posinblock = self.marked_pos - block_len_total[blocknumber]
                        
                        
-                       oldvalue = self.parent.value[blocknumber]
-                       olddec = oldvalue % 10 ** (numberLen - posinblock) - (oldvalue % 10 ** (numberLen - posinblock - 1))
-                       newvalue = oldvalue - olddec + (10 ** (numberLen - posinblock - 1) * number)
+                       oldvalue = self._value[blocknumber]
+                       olddec = oldvalue % 10 ** (number_len - posinblock) - (oldvalue % 10 ** (number_len - posinblock - 1))
+                       newvalue = oldvalue - olddec + (10 ** (number_len - posinblock - 1) * number)
                        
                        
-                       self.parent.value[blocknumber] = newvalue
-                       self.markedPos += 1
+                       self._value[blocknumber] = newvalue
+                       self.marked_pos += 1
                
                
-               self.checkValues()
-
-               #FIXME: dont call when press left/right
-               self.parent.change()    
+                       self.validate()
+                       self.changed()
+                       
+                       print "res:", self._value
 
 
-       def __call__(self, selected):                   #needed by configlist
+       def getMulti(self, selected):
                value = ""
                value = ""
-               mPos = self.markedPos
+               mPos = self.marked_pos
                num = 0;
                num = 0;
-               for i in self.parent.value:
+               for i in self._value:
                        if len(value):  #fixme no heading separator possible
                                value += self.seperator
                                if mPos >= len(value) - 1:
                                        mPos += 1
                        if len(value):  #fixme no heading separator possible
                                value += self.seperator
                                if mPos >= len(value) - 1:
                                        mPos += 1
-                               
-                       #diff =         self.valueBounds - len(str(i))
-                       #if diff > 0:
-                               ## if this helps?!
-                               #value += " " * diff
-                       if (self.censorChar == ""):
-                               value += ("%0" + str(len(str(self.valueBounds[num][1]))) + "d") % i
+
+                       if self.censor_char == "":
+                               value += ("%0" + str(len(str(self.limits[num][1]))) + "d") % i
                        else:
                        else:
-                               value += (self.censorChar * len(str(self.valueBounds[num][1])))
+                               value += (self.censorChar * len(str(self.limits[num][1])))
                        num += 1
                        num += 1
+
                        # only mark cursor when we are selected
                        # (this code is heavily ink optimized!)
                        # only mark cursor when we are selected
                        # (this code is heavily ink optimized!)
-               if (self.parent.enabled == True):
+               if self.enabled:
                        return ("mtext"[1-selected:], value, [mPos])
                else:
                        return ("text", value)
 
                        return ("mtext"[1-selected:], value, [mPos])
                else:
                        return ("text", value)
 
-class configNothing:
-       def __init__(self, parent):
-               self.parent = parent
-               self.markedPos = 0
+       def tostring(self, val):
+               return self.seperator.join([self.saveSingle(x) for x in val])
+       
+       def saveSingle(self, v):
+               return str(v)
 
 
-       def cancel(self):
-               self.parent.reload()
+       def fromstring(self, value):
+               return [int(x) for x in self.saved_value.split(self.seperator)]
 
 
-       def save(self):
-               self.parent.save()
-               
-       def nextEntry(self):
-               self.parent.vals[1](self.parent.getConfigPath())
+class ConfigIP(ConfigSequence):
+       def __init__(self, default):
+               ConfigSequence.__init__(self, seperator = ".", limits = [(0,255),(0,255),(0,255),(0,255)], default = default)
 
 
-       def handleKey(self, key):
-               pass
-
-       def __call__(self, selected):                   #needed by configlist
-               return ("text", "")
-
-class configText(NumericalTextInput):
-       # used as first parameter
-       # is the text of a fixed size or is the user able to extend the length of the text
-       extendableSize = 1
-       fixedSize = 2
-
-       def __init__(self, parent):
-               NumericalTextInput.__init__(self, self.nextEntry)
-               self.parent = parent
-               self.markedPos = 0
-               self.mode = self.parent.vals[0]
-               try:
-                       self.Text = self.parent.value.decode("utf-8")
-               except UnicodeDecodeError:
-                       self.Text = self.parent.value
-                       print "utf8 kaputt!"
+class ConfigMAC(ConfigSequence):
+       def __init__(self, default):
+               ConfigSequence.__init__(self, seperator = ":", limits = [(1,255),(1,255),(1,255),(1,255),(1,255),(1,255)], default = default)
 
 
-       def checkValues(self):
-               if (self.markedPos < 0):
-                       self.markedPos = 0
-               if (self.markedPos >= len(self.Text)):
-                       self.markedPos = len(self.Text) - 1
+class ConfigPosition(ConfigSequence):
+       def __init__(self, default, args):
+               ConfigSequence.__init__(self, seperator = ",", limits = [(0,args[0]),(0,args[1]),(0,args[2]),(0,args[3])], default = default)
 
 
-       def cancel(self):
-               self.parent.reload()
+class ConfigClock(ConfigSequence):
+       def __init__(self, default):
+               ConfigSequence.__init__(self, seperator = ":", limits = [(0,23),(0,59)], default = default)
 
 
-       def save(self):
-               self.parent.save()
+class ConfigInteger(ConfigSequence):
+       def __init__(self, default, limits):
+               ConfigSequence.__init__(self, seperator = ":", limits = [limits], default = default)
+       
+       # you need to override this to do input validation
+       def setValue(self, value):
+               self._value = [value]
+               self.changed()
+
+       def getValue(self):
+               return self._value[0]
+       
+       value = property(getValue, setValue)
 
 
-       def nextEntry(self):
-               self.parent.vals[1](self.parent.getConfigPath())
+       def fromstring(self, value):
+               return int(value)
 
 
-       def handleKey(self, key):
-               #this will no change anything on the value itself
-               #so we can handle it here in gui element
-               if key == config.key["delete"]:
-                       self.Text = self.Text[0:self.markedPos] + self.Text[self.markedPos + 1:]
-                       self.parent.value = self.Text.encode("utf-8")
-               elif key == config.key["prevElement"]:
-                       self.nextKey()
-                       self.markedPos -= 1
-               elif key == config.key["nextElement"]:
-                       self.nextKey()
-                       self.markedPos += 1
-                       if (self.mode == self.extendableSize):
-                               if (self.markedPos >= len(self.Text)):
-                                       self.Text = self.Text.ljust(len(self.Text) + 1)
-                                       self.parent.value = self.Text.encode("utf-8")
-               elif key >= config.key["0"] and key <= config.key["9"]:
-                       number = 9 - config.key["9"] + key
-                       self.Text = self.Text[0:self.markedPos] + self.getKey(number) + self.Text[self.markedPos + 1:]
-                       self.parent.value = self.Text.encode("utf-8")
-               self.checkValues()
-               self.parent.change()
+       def tostring(self, value):
+               return str(value)
+
+class ConfigPIN(ConfigSequence):
+       def __init__(self, default, len = 4, censor = ""):
+               ConfigSequence.__init__(self, seperator = ":", limits = [(0, (10**len)-1)], censor_char = censor, default = [default])
+
+class ConfigFloat(ConfigSequence):
+       def __init__(self, default, limits):
+               ConfigSequence.__init__(self, seperator = ".", limits = limits, default = default)
 
 
-       def __call__(self, selected):                   #needed by configlist
-               return ("mtext"[1-selected:], self.parent.value, [self.markedPos])
+       def getFloat(self):
+               return float(self.value[1] / float(self.limits[1][1] + 1) + self.value[0])
 
 
-class configValue:
-       def __init__(self, obj):
-               self.obj = obj
+       float = property(getFloat)
+
+# an editable text...
+class ConfigText(ConfigElement, NumericalTextInput):
+       def __init__(self, default = "", fixed_size = True):
+               ConfigElement.__init__(self)
+               NumericalTextInput.__init__(self, nextFunc = self.nextFunc, handleTimeout = False)
                
                
-       def __str__(self):
-               return self.obj
+               self.marked_pos = 0
+               self.fixed_size = fixed_size
 
 
-class Config:
-       def __init__(self):
-               self.key = { "choseElement": 0,
-                                        "prevElement": 1,
-                                        "nextElement": 2,
-                                        "delete": 3,
-                                        "0": 10,
-                                        "1": 11,
-                                        "2": 12,
-                                        "3": 13,
-                                        "4": 14,
-                                        "5": 15,
-                                        "6": 16,
-                                        "7": 17,
-                                        "8": 18,
-                                        "9": 19 }
+               self.value = self.default = default
+
+       def validateMarker(self):
+               if self.marked_pos < 0:
+                       self.marked_pos = 0
+               if self.marked_pos >= len(self.text):
+                       self.marked_pos = len(self.text) - 1
+
+       #def nextEntry(self):
+       #       self.vals[1](self.getConfigPath())
+
+       def handleKey(self, key):
+               # this will no change anything on the value itself
+               # so we can handle it here in gui element
+               if key == KEY_DELETE:
+                       self.text = self.text[0:self.marked_pos] + self.text[self.marked_pos + 1:]
+               elif key == KEY_LEFT:
+                       self.marked_pos -= 1
+               elif key == KEY_RIGHT:
+                       self.marked_pos += 1
+                       if not self.fixed_size:
+                               if self.marked_pos >= len(self.text):
+                                       self.text = self.text.ljust(len(self.text) + 1)
+               elif key in KEY_NUMBERS:
+                       number = self.getKey(getKeyNumber(key))
+                       self.text = self.text[0:self.marked_pos] + str(number) + self.text[self.marked_pos + 1:]
+               elif key == KEY_TIMEOUT:
+                       self.timeout()
+                       return
+
+               self.validateMarker()
+               self.changed()
+
+       def nextFunc(self):
+               self.marked_pos += 1
+               self.validateMarker()
+               self.changed()
+
+       def getValue(self):
+               return self.text.encode("utf-8")
                
                
-config = Config();
+       def setValue(self, val):
+               try:
+                       self.text = val.decode("utf-8")
+               except UnicodeDecodeError:
+                       self.text = val
+                       print "Broken UTF8!"
 
 
-configfile = configFile()
+       value = property(getValue, setValue)
+       _value = property(getValue, setValue)
 
 
-class configSlider:
-       def __init__(self, parent):
-               self.parent = parent
+       def getMulti(self, selected):
+               return ("mtext"[1-selected:], self.value, [self.marked_pos])
 
 
-       def cancel(self):
-               self.parent.reload()
+       def helpWindow(self):
+               print "helpWindow for text!"
 
 
-       def save(self):
-               self.parent.save()
+               from Screens.NumericalTextInputHelpDialog import NumericalTextInputHelpDialog
+               return (NumericalTextInputHelpDialog,self)
+
+       def getHTML(self, id):
+               return '<input type="text" name="' + id + '" value="' + self.value + '" /><br>\n'
+
+       def unsafeAssign(self, value):
+               self.value = str(value)
+
+# a slider.
+class ConfigSlider(ConfigElement):
+       def __init__(self, default = 0, increment = 1, limits = (0, 100)):
+               ConfigElement.__init__(self)
+               self.value = self.default = default
+               self.min = limits[0]
+               self.max = limits[1]
+               self.increment = increment
 
        def checkValues(self):
 
        def checkValues(self):
-               if self.parent.value < 0:
-                       self.parent.value = 0   
+               if self.value < self.min:
+                       self.value = self.min
 
 
-               if self.parent.value > self.parent.vals[1]:
-                       self.parent.value = self.parent.vals[1]
+               if self.value > self.max:
+                       self.value = self.max
 
        def handleKey(self, key):
 
        def handleKey(self, key):
-               if key == config.key["prevElement"]:
-                       self.parent.value = self.parent.value - self.parent.vals[0]
-               if key == config.key["nextElement"]:
-                       self.parent.value = self.parent.value + self.parent.vals[0]
-                                       
-               self.checkValues()      
-               self.parent.change()    
-
-       def __call__(self, selected):                   #needed by configlist
+               if key == KEY_LEFT:
+                       self.value -= self.increment
+               elif key == KEY_RIGHT:
+                       self.value += self.increment
+               else:
+                       return
+
                self.checkValues()
                self.checkValues()
-               return ("slider", self.parent.value, self.parent.vals[1])
+               self.changed()
 
 
-class ConfigSubsection:
+       def getMulti(self, selected):
+               self.checkValues()
+               return ("slider", self.value, self.max)
+
+       def fromstring(self, value):
+               return int(value)
+
+# a satlist. in fact, it's a ConfigSelection.
+class ConfigSatlist(ConfigSelection):
+       def __init__(self, list, default = None):
+               if default is not None:
+                       default = str(default)
+               if list == [ ]:
+                       list = [0, "N/A"]
+               ConfigSelection.__init__(self, choices = [(str(orbpos), desc) for (orbpos, desc) in list], default = default)
+
+       def getOrbitalPosition(self):
+               return int(self.value)
+       
+       orbital_position = property(getOrbitalPosition)
+
+# nothing.
+class ConfigDummy(ConfigSelection):
        def __init__(self):
        def __init__(self):
-               pass
-
-class configElement:
-
-       def getIndexbyEntry(self, data):
-               cnt = 0;
-               tcnt = -1; #for defaultval
-               for x in self.vals:
-                       if int(x[1]) == int(data):
-                                       return cnt
-                       if int(x[1]) == int(self.defaultValue):
-                                       tcnt = cnt
-                       cnt += 1
-               if tcnt != -1:
-                       return tcnt
-               return 0        #prevent bigger then array
-
-       def datafromFile(self, control, data):
-               if control == configSlider:
-                       return int(data)
-               elif control == configSelection:
-                       try:
-                               return int(data)
-                       except:
-                               for x in data.split(":"):
-                                       if x[0] == "*":
-                                               count = 0
-                                               for y in self.vals:
-                                                       if y[0] == x[1:-1]:
-                                                               return count
-                                                       count += 1
-                               return self.defaultValue
-               elif control == configDateTime:
-                       return int(data)
-               elif control == configText:
-                       return str(data)
-               elif control == configSequence:
-                       list = [ ]
-                       part = data.split(self.vals[0])
-                       for x in part:
-                               list.append(int(x))
-                       return list
-               elif control == configSatlist:
-                       return self.getIndexbyEntry(data)
-               else: 
-                       return ""       
-
-       def datatoFile(self, control, data):
-               if control == configSlider:
-                       return str(data)
-               elif control == configSelection:
-                       if len(self.vals) < data + 1:
-                               return "0"
-                       if isinstance(self.vals[data], str):
-                               return str(data)
-                       else:
-                               confList = []
-                               count = 0
-                               for x in self.vals:
-                                       if count == data:
-                                               confList.append("*" + str(x[0] + "*"))
-                                       else:
-                                               confList.append(x[0])
-                                       count += 1
-                               return ":".join(confList)
-                       return str(data)
-               elif control == configDateTime:
-                       return str(data)
-               elif control == configText:
-                       return str(data.strip())
-               elif control == configSequence:
-#                      print self.vals
-#                      print self.value
-                       try:
-                               value = ""
-                               count = 0
-                               for i in data:
-                                       if value !="":
-                                               value += self.vals[0]
-                                       value += (("%0" + str(len(str(self.vals[1][count][1]))) + "d") % i)
-                                       count += 1
-                                       #value = ((len(data) * ("%d" + self.vals[0]))[0:-1]) % tuple(data)
-                       except: 
-                               value = str(data)       
-                       return value
-               elif control == configSatlist:
-                       return str(self.vals[self.value][1]);
-               else: 
-                       return ""       
-
-       def loadData(self):
-               #print "load:" + self.configPath
-               try:
-                       value = self.datafromFile(self.controlType, configfile.getKey(self.configPath))
-               except:         
-                       value = ""
-
-               if value == "":
-                       #print "value not found - using default"
-                       if self.controlType == configSatlist:
-                               self.value = self.getIndexbyEntry(self.defaultValue)
-                       elif self.controlType == configSequence:
-                               self.value = self.defaultValue[:]
-                       else:
-                               self.value = self.defaultValue
+               ConfigSelection.__init__(self, choices = [""])
+
+# until here, 'saved_value' always had to be a *string*.
+# now, in ConfigSubsection, and only there, saved_value
+# is a dict, essentially forming a tree.
+#
+# config.foo.bar=True
+# config.foobar=False
+#
+# turns into:
+# config.saved_value == {"foo": {"bar": "True"}, "foobar": "False"}
+#
+
+
+class ConfigSubsectionContent(object):
+       pass
+
+# we store a backup of the loaded configuration
+# data in self.stored_values, to be able to deploy
+# them when a new config element will be added,
+# so non-default values are instantly available
+
+# A list, for example:
+# config.dipswitches = ConfigSubList()
+# config.dipswitches.append(ConfigYesNo())
+# config.dipswitches.append(ConfigYesNo())
+# config.dipswitches.append(ConfigYesNo())
+class ConfigSubList(list, object):
+       def __init__(self):
+               object.__init__(self)
+               list.__init__(self)
+               self.stored_values = {}
 
 
-                       self.save()             #add missing value to dict
-               else:
-                       #print "set val:" + str(value)
-                       self.value = value
-
-               #is this right? activate settings after load/cancel and use default     
-               self.change()
-
-       def __init__(self, configPath, control, defaultValue, vals, saveDefaults = True):
-               self.configPath = configPath
-               self.defaultValue = defaultValue
-               self.controlType = control
-               self.vals = vals
-               self.notifierList = [ ]
-               self.enabled = True
-               self.saveDefaults = saveDefaults
-               self.loadData()         
-               
-       def getConfigPath(self):
-               return self.configPath
+       def save(self):
+               for x in self:
+                       x.save()
        
        
-       def addNotifier(self, notifier):
-               self.notifierList.append(notifier);
-               notifier(self);
+       def load(self):
+               for x in self:
+                       x.load()
+
+       def getSavedValue(self):
+               res = {}
+               for i in range(len(self)):
+                       sv = self[i].saved_value
+                       if sv is not None:
+                               res[str(i)] = sv
+               return res
+
+       def setSavedValue(self, values):
+               self.stored_values = dict(values)
+               for (key, val) in self.stored_values.items():
+                       if int(key) < len(self):
+                               self[int(key)].saved_value = val
+
+       saved_value = property(getSavedValue, setSavedValue)
+       
+       def append(self, item):
+               list.append(self, item)
+               i = str(len(self))
+               if i in self.stored_values:
+                       item.saved_value = self.stored_values[i]
+                       item.load()
+
+# same as ConfigSubList, just as a dictionary.
+# care must be taken that the 'key' has a proper
+# str() method, because it will be used in the config
+# file.
+class ConfigSubDict(dict, object):
+       def __init__(self):
+               object.__init__(self)
+               dict.__init__(self)
+               self.stored_values = {}
 
 
-       def change(self):
-               for notifier in self.notifierList:
-                       notifier(self)
+       def save(self):
+               for x in self.values():
+                       x.save()
+       
+       def load(self):
+               for x in self.values():
+                       x.load()
+
+       def getSavedValue(self):
+               res = {}
+               for (key, val) in self.items():
+                       if val.saved_value is not None:
+                               res[str(key)] = val.saved_value
+               return res
+
+       def setSavedValue(self, values):
+               self.stored_values = dict(values)
+               for (key, val) in self.items():
+                       if str(key) in self.stored_values:
+                               val = self.stored_values[str(key)]
+
+       saved_value = property(getSavedValue, setSavedValue)
+
+       def __setitem__(self, key, item):
+               dict.__setitem__(self, key, item)
+               if str(key) in self.stored_values:
+                       item.saved_value = self.stored_values[str(key)]
+                       item.load()
+
+# Like the classes above, just with a more "native"
+# syntax.
+#
+# some evil stuff must be done to allow instant
+# loading of added elements. this is why this class
+# is so complex.
+#
+# we need the 'content' because we overwrite 
+# __setattr__.
+# If you don't understand this, try adding
+# __setattr__ to a usual exisiting class and you will.
+class ConfigSubsection(object):
+       def __init__(self):
+               object.__init__(self)
+               self.__dict__["content"] = ConfigSubsectionContent()
+               self.content.items = { }
+               self.content.stored_values = { }
+       
+       def __setattr__(self, name, value):
+               if name == "saved_value":
+                       return self.setSavedValue(value)
+               self.content.items[name] = value
+               if name in self.content.stored_values:
+                       #print "ok, now we have a new item,", name, "and have the following value for it:", self.content.stored_values[name]
+                       value.saved_value = self.content.stored_values[name]
+                       value.load()
+
+       def __getattr__(self, name):
+               return self.content.items[name]
+
+       def getSavedValue(self):
+               res = self.content.stored_values
+               for (key, val) in self.content.items.items():
+                       if val.saved_value is not None:
+                               res[key] = val.saved_value
+               return res
+
+       def setSavedValue(self, values):
+               values = dict(values)
+               
+               self.content.stored_values = values
+               
+               for (key, val) in self.content.items.items():
+                       if key in values:
+                               val.setSavedValue(values[key])
 
 
-       def reload(self):
-               self.loadData()
+       saved_value = property(getSavedValue, setSavedValue)
 
        def save(self):
 
        def save(self):
-               if self.controlType == configSatlist:
-                       defaultValue = self.getIndexbyEntry(self.defaultValue)
-               else:
-                       defaultValue = self.defaultValue
-               if self.value != defaultValue or self.saveDefaults:
-                       configfile.setKey(self.configPath, self.datatoFile(self.controlType, self.value))
-               else:
-                       try:
-                               oldValue = configfile.getKey(self.configPath)
-                       except:
-                               oldValue = None
-                       if oldValue is not None and oldValue != defaultValue:
-                               configfile.setKey(self.configPath, self.datatoFile(self.controlType, self.value), True)
+               for x in self.content.items.values():
+                       x.save()
+
+       def load(self):
+               for x in self.content.items.values():
+                       x.load()
+
+# the root config object, which also can "pickle" (=serialize)
+# down the whole config tree.
+#
+# we try to keep non-existing config entries, to apply them whenever
+# a new config entry is added to a subsection
+# also, non-existing config entries will be saved, so they won't be
+# lost when a config entry disappears.
+class Config(ConfigSubsection):
+       def __init__(self):
+               ConfigSubsection.__init__(self)
 
 
-class configElement_nonSave(configElement):
-       def __init__(self, configPath, control, defaultValue, vals):
-               configElement.__init__(self, configPath, control, defaultValue, vals)
+       def pickle_this(self, prefix, topickle, result):
+               for (key, val) in topickle.items():
+                       name = prefix + "." + key
+                       
+                       if isinstance(val, dict):
+                               self.pickle_this(name, val, result)
+                       elif isinstance(val, tuple):
+                               result.append(name + "=" + val[0]) # + " ; " + val[1])
+                       else:
+                               result.append(name + "=" + val)
+
+       def pickle(self):
+               result = [ ]
+               self.pickle_this("config", self.saved_value, result)
+               return '\n'.join(result) + "\n"
+
+       def unpickle(self, lines):
+               tree = { }
+               for l in lines:
+                       if not len(l) or l[0] == '#':
+                               continue
+                       
+                       n = l.find('=')
+                       val = l[n+1:].strip()
 
 
-       def save(self):
-               pass
+                       names = l[:n].split('.')
+#                      if val.find(' ') != -1:
+#                              val = val[:val.find(' ')]
 
 
-def getConfigListEntry(description, element):
-       b = element
-       item = b.controlType(b)
-       return ((description, item))
+                       base = tree
+                       
+                       for n in names[:-1]:
+                               base = base.setdefault(n, {})
+                       
+                       base[names[-1]] = val
 
 
-def configElementBoolean(name, default, texts=(_("Disable"), _("Enable"))):
-       return configElement(name, configSelection, default, texts)
+               # we inherit from ConfigSubsection, so ...
+               #object.__setattr__(self, "saved_value", tree["config"])
+               self.setSavedValue(tree["config"])
 
 
+       def saveToFile(self, filename):
+               f = open(filename, "w")
+               f.write(self.pickle())
+               f.close()
+
+       def loadFromFile(self, filename):
+               f = open(filename, "r")
+               self.unpickle(f.readlines())
+               f.close()
+
+config = Config()
 config.misc = ConfigSubsection()
 config.misc = ConfigSubsection()
+
+class ConfigFile:
+       CONFIG_FILE = resolveFilename(SCOPE_CONFIG, "config2")
+
+       def load(self):
+               try:
+                       config.loadFromFile(self.CONFIG_FILE)
+               except IOError, e:
+                       print "unable to load config (%s), assuming defaults..." % str(e)
+       
+       def save(self):
+               config.save()
+               config.saveToFile(self.CONFIG_FILE)
+       
+       def getResolvedKey(self, key):
+               return None # FIXME
+
+def NoSave(element):
+       element.disableSave()
+       return element
+
+configfile = ConfigFile()
+
+configfile.load()
+
+def getConfigListEntry(desc, config):
+       return (desc, config)
+
+#def _(x):
+#      return x
+#
+#config.bla = ConfigSubsection()
+#config.bla.test = ConfigYesNo()
+#config.nim = ConfigSubList()
+#config.nim.append(ConfigSubsection())
+#config.nim[0].bla = ConfigYesNo()
+#config.nim.append(ConfigSubsection())
+#config.nim[1].bla = ConfigYesNo()
+#config.nim[1].blub = ConfigYesNo()
+#config.arg = ConfigSubDict()
+#config.arg["Hello"] = ConfigYesNo()
+#
+#config.arg["Hello"].handleKey(KEY_RIGHT)
+#config.arg["Hello"].handleKey(KEY_RIGHT)
+#
+##config.saved_value
+#
+##configfile.save()
+#config.save()
+#print config.pickle()
index 9d20f415f3a362f2fe301b22535fd78bb60c6e1f..816d3c35ed77eec48fd9819218d883df2f46e90a 100644 (file)
@@ -13,12 +13,12 @@ from enigma import eTimer
 
 my_global_session = None
 
 
 my_global_session = None
 
-from Components.config import config, ConfigSubsection, configElement, configSequence, getConfigListEntry, configsequencearg, configElementBoolean
+from Components.config import config, ConfigSubsection, ConfigIP, ConfigEnableDisable
 from Components.ConfigList import ConfigList
 
 config.FritzCall = ConfigSubsection()
 from Components.ConfigList import ConfigList
 
 config.FritzCall = ConfigSubsection()
-config.FritzCall.hostname = configElement("config.FritzCall.hostname", configSequence, [192,168,178,254], configsequencearg.get("IP"))
-config.FritzCall.enable = configElementBoolean("config.FritzCall.enable", 0)
+config.FritzCall.hostname = ConfigIP(default = [192,168,178,254])
+config.FritzCall.enable = ConfigEnableDisable()
 
 class FritzCallSetup(Screen):
        skin = """
 
 class FritzCallSetup(Screen):
        skin = """
index c5e92f635a033083b61a2d20320fb80ee0ca15f7..dca63faff40ba3b904941710b6af970355d8b67c 100644 (file)
@@ -1,2 +1,3 @@
-SUBDIRS = TuxboxPlugins WebInterface FileManager CutListEditor ZappingAlternatives
+SUBDIRS = TuxboxPlugins WebInterface FileManager CutListEditor ZappingAlternatives SimpleRSS FritzCall
+
 
 
index f47886c2ed21f5df45100678bb0efd56bac33946..ebdaa7c845fe184f191fbbddd046e3db515fd426 100644 (file)
@@ -7,7 +7,7 @@ from Components.Pixmap import *
 from Components.Pixmap import Pixmap
 from Components.Label import Label
 from Components.MenuList import MenuList
 from Components.Pixmap import Pixmap
 from Components.Label import Label
 from Components.MenuList import MenuList
-from Components.config import config, configSelection, configSelection, getConfigListEntry, configElement, ConfigSubsection, currentConfigSelectionElement
+from Components.config import config, ConfigSelection, ConfigSubsection
 from Components.ConfigList import ConfigList
 from Plugins.Plugin import PluginDescriptor
 
 from Components.ConfigList import ConfigList
 from Plugins.Plugin import PluginDescriptor
 
@@ -107,8 +107,8 @@ class BackupSetup(Screen):
                self.list = [ ]
                self["config"] = ConfigList(self.list)
                config.backup = ConfigSubsection()
                self.list = [ ]
                self["config"] = ConfigList(self.list)
                config.backup = ConfigSubsection()
-               config.backup.type = configElement("config.backup.type", configSelection, 0, (("full", _("full /etc directory")), ("settings", _("only /etc/enigma2 directory")), ("var", _("/var directory")), ("skin", _("/usr/share/enigma2 directory"))))
-               config.backup.location = configElement("config.backup.location", configSelection, 0, (("usb", _("USB Stick")), ("cf", _("CF Drive")), ("hdd", _("Harddisk"))))
+               config.backup.type = ConfigSelection(choices = [("full", _("full /etc directory")), ("settings", _("only /etc/enigma2 directory")), ("var", _("/var directory")), ("skin", _("/usr/share/enigma2 directory"))])
+               config.backup.location = ConfigSelection(choices = [("usb", _("USB Stick")), ("cf", _("CF Drive")), ("hdd", _("Harddisk"))])
                self.list.append(getConfigListEntry(_("Backup Mode"), config.backup.type))
                self.list.append(getConfigListEntry(_("Backup Location"), config.backup.location))
 
                self.list.append(getConfigListEntry(_("Backup Mode"), config.backup.type))
                self.list.append(getConfigListEntry(_("Backup Location"), config.backup.location))
 
@@ -192,7 +192,7 @@ class RestoreMenu(Screen):
 
        def fill_list(self):
                self.flist = []
 
        def fill_list(self):
                self.flist = []
-               self.path = BackupPath[str(currentConfigSelectionElement(config.backup.location))]
+               self.path = BackupPath[config.backup.location.value]
                if (os.path.exists(str(self.path)) == False):
                        os.makedirs(str(self.path))
                for file in os.listdir(str(self.path)):
                if (os.path.exists(str(self.path)) == False):
                        os.makedirs(str(self.path))
                for file in os.listdir(str(self.path)):
index 13bf85f3d6c42835fa664c4ac934bc050b33574e..6cb0c087f0b9012d99b65e4afe23dfff964e62ce 100644 (file)
@@ -10,7 +10,7 @@ from Components.TunerInfo import TunerInfo
 from Components.ActionMap import ActionMap
 from Components.NimManager import nimmanager
 from Components.MenuList import MenuList
 from Components.ActionMap import ActionMap
 from Components.NimManager import nimmanager
 from Components.MenuList import MenuList
-from Components.config import config, ConfigSubsection, configElement_nonSave, configNothing, getConfigListEntry, configSelection, currentConfigSelectionElement, configSatlist
+from Components.config import ConfigDummy, ConfigSelection
 
 class PositionerSetup(Screen):
        skin = """
 
 class PositionerSetup(Screen):
        skin = """
@@ -114,24 +114,23 @@ class PositionerSetup(Screen):
                self.statusTimer.start(50, False)
                
        def createConfig(self):
                self.statusTimer.start(50, False)
                
        def createConfig(self):
-               config.positioner = ConfigSubsection()
-               config.positioner.tune = configElement_nonSave("tune", configNothing, 0, None)
-               config.positioner.move = configElement_nonSave("move", configNothing, 0, None)
-               config.positioner.finemove = configElement_nonSave("finemove", configNothing, 0, None)
-               config.positioner.limits = configElement_nonSave("limits", configNothing, 0, None)
-               config.positioner.goto0 = configElement_nonSave("goto0", configNothing, 0, None)
+               self.positioner_tune = ConfigDummy()
+               self.positioner_move = ConfigDummy()
+               self.positioner_finemove = ConfigDummy()
+               self.positioner_limits = ConfigDummy()
+               self.positioner_goto0 = ConfigDummy()
                storepos = []
                for x in range(1,255):
                        storepos.append(str(x))
                storepos = []
                for x in range(1,255):
                        storepos.append(str(x))
-               config.positioner.storage = configElement_nonSave("storage", configSelection, 0, storepos)
+               self.positioner_storage = ConfigSelection(choices = storepos)
        
        def createSetup(self):
        
        def createSetup(self):
-               self.list.append(getConfigListEntry(_("Tune"), config.positioner.tune))
-               self.list.append(getConfigListEntry(_("Positioner movement"), config.positioner.move))
-               self.list.append(getConfigListEntry(_("Positioner fine movement"), config.positioner.finemove))
-               self.list.append(getConfigListEntry(_("Set limits"), config.positioner.limits))
-               self.list.append(getConfigListEntry(_("Positioner storage"), config.positioner.storage))
-               self.list.append(getConfigListEntry(_("Goto 0"), config.positioner.goto0))
+               self.list.append(getConfigListEntry(_("Tune"), self.positioner_tune))
+               self.list.append(getConfigListEntry(_("Positioner movement"), self.positioner_move))
+               self.list.append(getConfigListEntry(_("Positioner fine movement"), self.positioner_finemove))
+               self.list.append(getConfigListEntry(_("Set limits"), self.positioner_limits))
+               self.list.append(getConfigListEntry(_("Positioner storage"), self.positioner_storage))
+               self.list.append(getConfigListEntry(_("Goto 0"), self.positioner_goto0))
                self["list"].l.setList(self.list)
                
        def go(self):
                self["list"].l.setList(self.list)
                
        def go(self):
@@ -234,8 +233,8 @@ class PositionerSetup(Screen):
                        print "stepping west"
                        self.diseqccommand("moveWest", 0xFF) # one step
                elif entry == "storage":
                        print "stepping west"
                        self.diseqccommand("moveWest", 0xFF) # one step
                elif entry == "storage":
-                       print "store at position", (config.positioner.storage.value + 1)
-                       self.diseqccommand("store", config.positioner.storage.value + 1)
+                       print "store at position", (self.positioner_storage.value + 1)
+                       self.diseqccommand("store", self.positioner_storage.value + 1)
                elif entry == "limits":
                        self.diseqccommand("limitWest")
        
                elif entry == "limits":
                        self.diseqccommand("limitWest")
        
@@ -255,8 +254,8 @@ class PositionerSetup(Screen):
                        print "stepping east"
                        self.diseqccommand("moveEast", 0xFF) # one step
                elif entry == "storage":
                        print "stepping east"
                        self.diseqccommand("moveEast", 0xFF) # one step
                elif entry == "storage":
-                       print "move to position", (config.positioner.storage.value + 1)
-                       self.diseqccommand("moveTo", config.positioner.storage.value + 1)
+                       print "move to position", (self.positioner_storage.value + 1)
+                       self.diseqccommand("moveTo", self.positioner_storage.value + 1)
                elif entry == "limits":
                        self.diseqccommand("limitEast")
 #      
                elif entry == "limits":
                        self.diseqccommand("limitEast")
 #      
index d915b91f6a71f5d1e658885e84d243f9733b638b..f9075a1d6b183ae525a8270c188eed00a9aa4002 100644 (file)
@@ -10,7 +10,7 @@ from Components.TunerInfo import TunerInfo
 from Components.ActionMap import ActionMap
 from Components.NimManager import nimmanager
 from Components.MenuList import MenuList
 from Components.ActionMap import ActionMap
 from Components.NimManager import nimmanager
 from Components.MenuList import MenuList
-from Components.config import config, ConfigSubsection, configElement_nonSave, configNothing, getConfigListEntry, configSelection, currentConfigSelectionElement, configSatlist
+from Components.config import ConfigSelection, ConfigSatlist
 
 class Tuner:
        def __init__(self, frontend):
 
 class Tuner:
        def __init__(self, frontend):
@@ -128,18 +128,18 @@ class Satfinder(ScanSetup):
                self.satEntry = None
 
                self.list = []
                self.satEntry = None
 
                self.list = []
-               self.typeOfTuningEntry = getConfigListEntry(_('Tune'), config.tuning.type)
+               self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
                self.list.append(self.typeOfTuningEntry)
                self.list.append(self.typeOfTuningEntry)
-               self.satEntry = getConfigListEntry(_('Satellite'), config.tuning.sat)
+               self.satEntry = getConfigListEntry(_('Satellite'), self.tuning_sat)
                self.list.append(self.satEntry)
                self.list.append(self.satEntry)
-               if currentConfigSelectionElement(config.tuning.type) == "manual_transponder":
-                       self.list.append(getConfigListEntry(_('Frequency'), config.scan.sat.frequency))
-                       self.list.append(getConfigListEntry(_('Inversion'), config.scan.sat.inversion))
-                       self.list.append(getConfigListEntry(_('Symbol Rate'), config.scan.sat.symbolrate))
-                       self.list.append(getConfigListEntry(_("Polarity"), config.scan.sat.polarization))
-                       self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec))
-               elif config.tuning.transponder and currentConfigSelectionElement(config.tuning.type) == "predefined_transponder":
-                       self.list.append(getConfigListEntry(_("Transponder"), config.tuning.transponder))
+               if currentConfigSelectionElement(self.tuning_type) == "manual_transponder":
+                       self.list.append(getConfigListEntry(_('Frequency'), self.scan_sat.frequency))
+                       self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
+                       self.list.append(getConfigListEntry(_('Symbol Rate'), self.scan_sat.symbolrate))
+                       self.list.append(getConfigListEntry(_("Polarity"), self.scan_sat.polarization))
+                       self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec))
+               elif self.tuning_transponder and currentConfigSelectionElement(self.tuning_type) == "predefined_transponder":
+                       self.list.append(getConfigListEntry(_("Transponder"), self.tuning_transponder))
                self["config"].list = self.list
                self["config"].l.setList(self.list)
 
                self["config"].list = self.list
                self["config"].l.setList(self.list)
 
@@ -152,42 +152,41 @@ class Satfinder(ScanSetup):
 
        def retune(self, configElement):
                returnvalue = (0, 0, 0, 0, 0, 0, 0)
 
        def retune(self, configElement):
                returnvalue = (0, 0, 0, 0, 0, 0, 0)
-               val = config.tuning.sat.value
-               if val > 0 and len(config.tuning.sat.vals) > val:
-                       satpos = config.tuning.sat.vals[config.tuning.sat.value][1]
-               elif len(config.tuning.sat.vals) > 0:
-                       satpos = config.tuning.sat.vals[0][1]
+               val = self.tuning_sat.orbital_positioon
+               if val > 0 and len(self.tuning_sat.vals) > val:
+                       satpos = self.tuning_sat.vals[self.tuning_sat.value][1]
+               elif len(self.tuning_sat.vals) > 0:
+                       satpos = self.tuning_sat.vals[0][1]
                else:
                        satpos = None
                if satpos:
                else:
                        satpos = None
                if satpos:
-                       if currentConfigSelectionElement(config.tuning.type) == "manual_transponder":
-                               returnvalue = (config.scan.sat.frequency.value[0], config.scan.sat.symbolrate.value[0], config.scan.sat.polarization.value, config.scan.sat.fec.value, config.scan.sat.inversion.value, satpos)
-                       elif currentConfigSelectionElement(config.tuning.type) == "predefined_transponder":
-                               transponder = nimmanager.getTransponders(config.tuning.sat.vals[config.tuning.sat.value][1])[config.tuning.transponder.value]
-                               returnvalue = (int(transponder[1] / 1000), int(transponder[2] / 1000), transponder[3], transponder[4], 2, config.tuning.sat.vals[config.tuning.sat.value][1], satpos)
+                       if currentConfigSelectionElement(self.tuning_type) == "manual_transponder":
+                               returnvalue = (self.scan_sat.frequency.value[0], self.scan_sat.symbolrate.value[0], self.scan_sat.polarization.value, self.scan_sat.fec.value, self.scan_sat.inversion.value, satpos)
+                       elif currentConfigSelectionElement(self.tuning_type) == "predefined_transponder":
+                               transponder = nimmanager.getTransponders(self.tuning_sat.vals[self.tuning_sat.value][1])[self.tuning_transponder.value]
+                               returnvalue = (int(transponder[1] / 1000), int(transponder[2] / 1000), transponder[3], transponder[4], 2, self.tuning_sat.vals[self.tuning_sat.value][1], satpos)
                        self.tune(returnvalue)
 
        def createConfig(self, foo):
                        self.tune(returnvalue)
 
        def createConfig(self, foo):
-               config.tuning = ConfigSubsection()
 
 
-               config.tuning.transponder = None
-               config.tuning.type = configElement_nonSave("config.tuning.type", configSelection, 0, (("manual_transponder", _("Manual transponder")), ("predefined_transponder", _("Predefined satellite"))))
-               config.tuning.sat = configElement_nonSave("config.tuning.sat", configSatlist, 192, nimmanager.getSatListForNim(self.feid))
+               self.tuning_transponder = None
+               self.tuning_type = ConfigSelection(choices = [("manual_transponder", _("Manual transponder")), ("predefined_transponder", _("Predefined satellite"))])
+               self.tuning_sat = ConfigSatlist(default = 192, satlist = nimmanager.getSatListForNim(self.feid))
                ScanSetup.createConfig(self, None)
                
                self.updateSats()
 
                ScanSetup.createConfig(self, None)
                
                self.updateSats()
 
-               config.tuning.type.addNotifier(self.retune)
-               config.tuning.sat.addNotifier(self.retune)
-               config.scan.sat.frequency.addNotifier(self.retune)
-               config.scan.sat.inversion.addNotifier(self.retune)
-               config.scan.sat.symbolrate.addNotifier(self.retune)
-               config.scan.sat.polarization.addNotifier(self.retune)
-               config.scan.sat.fec.addNotifier(self.retune)
+               self.tuning_type.addNotifier(self.retune)
+               self.tuning_sat.addNotifier(self.retune)
+               self.scan_sat.frequency.addNotifier(self.retune)
+               self.scan_sat.inversion.addNotifier(self.retune)
+               self.scan_sat.symbolrate.addNotifier(self.retune)
+               self.scan_sat.polarization.addNotifier(self.retune)
+               self.scan_sat.fec.addNotifier(self.retune)
 
        def updateSats(self):
 
        def updateSats(self):
-               satnum = config.tuning.sat.value
-               satlist = config.tuning.sat.vals
+               satnum = self.tuning_sat.value
+               satlist = self.tuning_sat.vals
                if len(satlist):
                        transponderlist = nimmanager.getTransponders(satlist[satnum][1])
                        list = []
                if len(satlist):
                        transponderlist = nimmanager.getTransponders(satlist[satnum][1])
                        list = []
@@ -217,11 +216,11 @@ class Satfinder(ScanSetup):
                                elif x[4] == 6:
                                        fec = "FEC_None"
                                list.append(str(x[1]) + "," + str(x[2]) + "," + pol + "," + fec)
                                elif x[4] == 6:
                                        fec = "FEC_None"
                                list.append(str(x[1]) + "," + str(x[2]) + "," + pol + "," + fec)
-                       config.tuning.transponder = configElement_nonSave("config.tuning.transponder", configSelection, 0, list)
-                       config.tuning.transponder.addNotifier(self.retune)
+                       self.tuning_transponder = ConfigSelection(choices = list)
+                       self.tuning_transponder.addNotifier(self.retune)
        
        def keyGo(self):
        
        def keyGo(self):
-               self.retune(config.tuning.type)
+               self.retune(self.tuning_type)
 
        def keyCancel(self):
                if self.oldref:
 
        def keyCancel(self):
                if self.oldref:
index a8d605eadcaa901774dc32708459509ebdda4139..6c3abb5d52954a198e71aae7550329a200888c21 100644 (file)
@@ -5,7 +5,7 @@ from Components.ActionMap import NumberActionMap, ActionMap
 from Components.MenuList import MenuList
 from EpgSelection import EPGSelection
 from enigma import eServiceReference, eEPGCache, eServiceCenter, eServiceCenterPtr, iMutableServiceListPtr, iStaticServiceInformationPtr, eTimer, eDVBDB
 from Components.MenuList import MenuList
 from EpgSelection import EPGSelection
 from enigma import eServiceReference, eEPGCache, eServiceCenter, eServiceCenterPtr, iMutableServiceListPtr, iStaticServiceInformationPtr, eTimer, eDVBDB
-from Components.config import config, configElement, ConfigSubsection, configText, currentConfigSelectionElement
+from Components.config import config, ConfigSubsection, ConfigText
 from Screens.FixedMenu import FixedMenu
 from Tools.NumericalTextInput import NumericalTextInput
 from Components.NimManager import nimmanager
 from Screens.FixedMenu import FixedMenu
 from Tools.NumericalTextInput import NumericalTextInput
 from Components.NimManager import nimmanager
@@ -87,7 +87,7 @@ class ChannelContextMenu(Screen):
                                                menu.append((_("remove all new found flags"), self.removeAllNewFoundFlags))
                                if inBouquet:
                                        menu.append((_("remove entry"), self.removeCurrentService))
                                                menu.append((_("remove all new found flags"), self.removeAllNewFoundFlags))
                                if inBouquet:
                                        menu.append((_("remove entry"), self.removeCurrentService))
-                               if current_root.getPath().find("flags == %d" %(FLAG_SERVICE_NEW_FOUND)) != -1:
+                               if current_root is not None and current_root.getPath().find("flags == %d" %(FLAG_SERVICE_NEW_FOUND)) != -1:
                                        menu.append((_("remove new found flag"), self.removeNewFoundFlag))
                        else:
                                        menu.append((_("add bouquet"), self.showBouquetInputBox))
                                        menu.append((_("remove new found flag"), self.removeNewFoundFlag))
                        else:
                                        menu.append((_("add bouquet"), self.showBouquetInputBox))
@@ -513,6 +513,7 @@ class ChannelSelectionBase(Screen):
                                "9": self.keyNumberGlobal,
                                "0": self.keyNumber0
                        })
                                "9": self.keyNumberGlobal,
                                "0": self.keyNumber0
                        })
+               self.recallBouquetMode()
 
        def appendDVBTypes(self, ref):
                path = ref.getPath()
 
        def appendDVBTypes(self, ref):
                path = ref.getPath()
@@ -553,13 +554,13 @@ class ChannelSelectionBase(Screen):
        def recallBouquetMode(self):
                if self.mode == MODE_TV:
                        self.service_types = self.service_types_tv
        def recallBouquetMode(self):
                if self.mode == MODE_TV:
                        self.service_types = self.service_types_tv
-                       if currentConfigSelectionElement(config.usage.multibouquet) == "yes":
+                       if config.usage.multibouquet.value:
                                self.bouquet_rootstr = '1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "bouquets.tv" ORDER BY bouquet'
                        else:
                                self.bouquet_rootstr = '%s FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet'%(self.service_types)
                else:
                        self.service_types = self.service_types_radio
                                self.bouquet_rootstr = '1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "bouquets.tv" ORDER BY bouquet'
                        else:
                                self.bouquet_rootstr = '%s FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet'%(self.service_types)
                else:
                        self.service_types = self.service_types_radio
-                       if currentConfigSelectionElement(config.usage.multibouquet) == "yes":
+                       if config.usage.multibouquet.value:
                                self.bouquet_rootstr = '1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "bouquets.radio" ORDER BY bouquet'
                        else:
                                self.bouquet_rootstr = '%s FROM BOUQUET "userbouquet.favourites.radio" ORDER BY bouquet'%(self.service_types)
                                self.bouquet_rootstr = '1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "bouquets.radio" ORDER BY bouquet'
                        else:
                                self.bouquet_rootstr = '%s FROM BOUQUET "userbouquet.favourites.radio" ORDER BY bouquet'%(self.service_types)
@@ -876,13 +877,13 @@ HISTORYSIZE = 20
 
 #config for lastservice
 config.tv = ConfigSubsection()
 
 #config for lastservice
 config.tv = ConfigSubsection()
-config.tv.lastservice = configElement("config.tv.lastservice", configText, "", 0)
-config.tv.lastroot = configElement("config.tv.lastroot", configText, "", 0)
+config.tv.lastservice = ConfigText()
+config.tv.lastroot = ConfigText()
 config.radio = ConfigSubsection()
 config.radio = ConfigSubsection()
-config.radio.lastservice = configElement("config.radio.lastservice", configText, "", 0)
-config.radio.lastroot = configElement("config.radio.lastroot", configText, "", 0)
+config.radio.lastservice = ConfigText()
+config.radio.lastroot = ConfigText()
 config.servicelist = ConfigSubsection()
 config.servicelist = ConfigSubsection()
-config.servicelist.lastmode = configElement("config.servicelist.lastmode", configText, "tv", 0)
+config.servicelist.lastmode = ConfigText(default = "tv")
 
 class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG):
        def __init__(self, session):
 
 class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG):
        def __init__(self, session):
@@ -932,7 +933,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect
        def setModeRadio(self):
                if self.revertMode is None and config.servicelist.lastmode.value == "tv":
                        self.revertMode = MODE_TV
        def setModeRadio(self):
                if self.revertMode is None and config.servicelist.lastmode.value == "tv":
                        self.revertMode = MODE_TV
-               if currentConfigSelectionElement(config.usage.e1like_radio_mode) == "yes":
+               if config.usage.e1like_radio_mode.value == "yes":
                        self.history = self.history_radio
                        self.lastservice = config.radio.lastservice
                        self.lastroot = config.radio.lastroot
                        self.history = self.history_radio
                        self.lastservice = config.radio.lastservice
                        self.lastroot = config.radio.lastroot
@@ -941,7 +942,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect
                        self.setMode()
 
        def __onCreate(self):
                        self.setMode()
 
        def __onCreate(self):
-               if currentConfigSelectionElement(config.usage.e1like_radio_mode) == "yes":
+               if config.usage.e1like_radio_mode.value == "yes":
                        if config.servicelist.lastmode.value == "tv":
                                self.setModeTv()
                        else:
                        if config.servicelist.lastmode.value == "tv":
                                self.setModeTv()
                        else:
@@ -1130,8 +1131,8 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS
                ChannelSelectionEPG.__init__(self)
 
                config.radio = ConfigSubsection();
                ChannelSelectionEPG.__init__(self)
 
                config.radio = ConfigSubsection();
-               config.radio.lastservice = configElement("config.radio.lastservice", configText, "", 0);
-               config.radio.lastroot = configElement("config.radio.lastroot", configText, "", 0);
+               config.radio.lastservice = ConfigText()
+               config.radio.lastroot = ConfigText()
                self.onLayoutFinish.append(self.onCreate)
 
                self.info = session.instantiateDialog(RadioInfoBar)
                self.onLayoutFinish.append(self.onCreate)
 
                self.info = session.instantiateDialog(RadioInfoBar)
index b516ec70a3781eab9fb49deabce2563a012e6f85..f43ce0e03a078ba5cc81e33533d9b2d52fa0d1a7 100644 (file)
@@ -8,7 +8,7 @@ from Components.Label import Label
 
 from Components.HTMLComponent import *
 from Components.GUIComponent import *
 
 from Components.HTMLComponent import *
 from Components.GUIComponent import *
-from Components.config import *
+from Components.config import config, ConfigSubsection, ConfigSelection, ConfigSubList, getConfigListEntry, KEY_LEFT, KEY_RIGHT, KEY_0
 from Components.ConfigList import ConfigList
 
 from enigma import eTimer, eDVBCI_UI, eListboxPythonStringContent, eListboxPythonConfigContent
 from Components.ConfigList import ConfigList
 
 from enigma import eTimer, eDVBCI_UI, eListboxPythonStringContent, eListboxPythonConfigContent
@@ -18,10 +18,10 @@ TYPE_CONFIG = 1
 MAX_NUM_CI = 4
 
 def InitCiConfig():
 MAX_NUM_CI = 4
 
 def InitCiConfig():
-       config.ci = [ ]
+       config.ci = ConfigSubList()
        for slot in range(MAX_NUM_CI):
                config.ci.append(ConfigSubsection())
        for slot in range(MAX_NUM_CI):
                config.ci.append(ConfigSubsection())
-               config.ci[slot].canDescrambleMultipleServices = configElement("config.ci%d.canDescrambleMultipleServices"%(slot), configSelection, 0, (("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))))
+               config.ci[slot].canDescrambleMultipleServices = ConfigSelection(choices = [("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))], default = "auto")
 
 class CiMmi(Screen):
        def __init__(self, session, slotid, action):
 
 class CiMmi(Screen):
        def __init__(self, session, slotid, action):
@@ -76,12 +76,12 @@ class CiMmi(Screen):
                        self.pinlength = entry[1]
                        if entry[3] == 1:
                                # masked pins:
                        self.pinlength = entry[1]
                        if entry[3] == 1:
                                # masked pins:
-                               x = configElement_nonSave("", configSequence, [1234], configsequencearg.get("PINCODE", (self.pinlength, "*")))
-                       else:                           
+                               x = ConfigPIN(len = self.pinlength, censor = "*")
+                       else:
                                # unmasked pins:
                                # unmasked pins:
-                               x = configElement_nonSave("", configSequence, [1234], configsequencearg.get("PINCODE", (self.pinlength, "")))
+                               x = ConfigPIN(len = self.pinlength)
                        self["subtitle"].setText(entry[2])
                        self["subtitle"].setText(entry[2])
-                       self.pin = getConfigListEntry("",x)
+                       self.pin = getConfigListEntry("", x)
                        list.append( self.pin )
                        self["bottom"].setText(_("please press OK when ready"))
 
                        list.append( self.pin )
                        self["bottom"].setText(_("please press OK when ready"))
 
@@ -143,15 +143,15 @@ class CiMmi(Screen):
 
        def keyNumberGlobal(self, number):
                self.timer.stop()
 
        def keyNumberGlobal(self, number):
                self.timer.stop()
-               self.keyConfigEntry(config.key[str(number)])
+               self.keyConfigEntry(KEY_0 + number)
 
        def keyLeft(self):
                self.timer.stop()
 
        def keyLeft(self):
                self.timer.stop()
-               self.keyConfigEntry(config.key["prevElement"])
+               self.keyConfigEntry(KEY_LEFT)
 
        def keyRight(self):
                self.timer.stop()
 
        def keyRight(self):
                self.timer.stop()
-               self.keyConfigEntry(config.key["nextElement"])
+               self.keyConfigEntry(KEY_RIGHT)
 
        def updateList(self, list):
                List = self["entries"]
 
        def updateList(self, list):
                List = self["entries"]
@@ -302,10 +302,10 @@ class CiSelection(Screen):
                        pass
 
        def keyLeft(self):
                        pass
 
        def keyLeft(self):
-               self.keyConfigEntry(config.key["prevElement"])
+               self.keyConfigEntry(KEY_LEFT)
 
        def keyRight(self):
 
        def keyRight(self):
-               self.keyConfigEntry(config.key["nextElement"])
+               self.keyConfigEntry(KEY_RIGHT)
 
        def appendEntries(self, slot, state):
                self.state[slot] = state
 
        def appendEntries(self, slot, state):
                self.state[slot] = state
index 57bdda556f6f29a904f05d9d0f017c99ee3195fd..3bd0ac69da8c2be26ad6f3a62637e804d1fd2e1e 100644 (file)
@@ -1,6 +1,6 @@
 from Screen import Screen
 from Components.ConfigList import ConfigList
 from Screen import Screen
 from Components.ConfigList import ConfigList
-from Components.config import *
+from Components.config import config
 from Components.ActionMap import ActionMap
 
 class ConfigMenu(Screen):
 from Components.ActionMap import ActionMap
 
 class ConfigMenu(Screen):
index c8e9b6c74ee456ccb8e5b55b5524ef015b7690cc..bcc35807fdb522a0055a0cc2f9279fda6350a642 100644 (file)
@@ -3,7 +3,7 @@ from Screen import Screen
 from Components.BlinkingPixmap import BlinkingPixmapConditional
 from Components.Pixmap import Pixmap
 from Components.Button import Button
 from Components.BlinkingPixmap import BlinkingPixmapConditional
 from Components.Pixmap import Pixmap
 from Components.Button import Button
-from Components.config import config, currentConfigSelectionElement
+from Components.config import config
 
 from enigma import *
 
 
 from enigma import *
 
@@ -14,7 +14,7 @@ class Dish(Screen):
                self["transparent"] = Button("")
                self["Dishpixmap"] = BlinkingPixmapConditional()
                #self["Dishpixmap"] = Pixmap()
                self["transparent"] = Button("")
                self["Dishpixmap"] = BlinkingPixmapConditional()
                #self["Dishpixmap"] = Pixmap()
-               if currentConfigSelectionElement(config.usage.showdish) == "no":
+               if not config.usage.showdish.value:
                        self["Dishpixmap"].setConnect(lambda: False)
                else:
                        self["Dishpixmap"].setConnect(eDVBSatelliteEquipmentControl.getInstance().isRotorMoving)
                        self["Dishpixmap"].setConnect(lambda: False)
                else:
                        self["Dishpixmap"].setConnect(eDVBSatelliteEquipmentControl.getInstance().isRotorMoving)
index ba49f3147ba5eecae70949485bdc9e661c45b0bc..5d29df0d1410e0875c7081081f240657a720b2c9 100644 (file)
@@ -13,7 +13,6 @@ from RecordTimer import RecordTimerEntry, parseEvent
 from TimerEdit import TimerEditList
 from TimerEntry import TimerEntry
 from ServiceReference import ServiceReference
 from TimerEdit import TimerEditList
 from TimerEntry import TimerEntry
 from ServiceReference import ServiceReference
-from Components.config import config, currentConfigSelectionElement
 from time import localtime, time
 
 import xml.dom.minidom
 from time import localtime, time
 
 import xml.dom.minidom
index 5617e8f183b88f070d3ac9cc1efb7cb2cba9c062..461fa31886cf274b6d6e0063dc1be606f1c54a10 100644 (file)
@@ -1,6 +1,5 @@
 from Wizard import Wizard, wizardManager
 
 from Wizard import Wizard, wizardManager
 
-from Components.config import configElementBoolean, config
 from Components.Pixmap import *
 
 from LanguageSelection import LanguageSelection
 from Components.Pixmap import *
 
 from LanguageSelection import LanguageSelection
index 4a1f318a7b7f13cd73f87b8ed59428a488010c99..410837778c2e1da88fb67f70039b90206c0c71f8 100644 (file)
@@ -8,7 +8,7 @@ from ServiceReference import ServiceReference
 
 from Components.Sources.Clock import Clock
 from Components.ActionMap import ActionMap, HelpableActionMap
 
 from Components.Sources.Clock import Clock
 from Components.ActionMap import ActionMap, HelpableActionMap
-from Components.config import currentConfigSelectionElement, config
+from Components.config import config
 
 from Tools.Notifications import AddNotificationWithCallback
 
 
 from Tools.Notifications import AddNotificationWithCallback
 
@@ -69,7 +69,7 @@ class InfoBar(InfoBarShowHide,
                self.showTvChannelList(True)
 
        def showRadio(self):
                self.showTvChannelList(True)
 
        def showRadio(self):
-               if currentConfigSelectionElement(config.usage.e1like_radio_mode) == "yes":
+               if config.usage.e1like_radio_mode.value:
                        self.showRadioChannelList(True)
                else:
                        self.session.open(ChannelSelectionRadio)
                        self.showRadioChannelList(True)
                else:
                        self.session.open(ChannelSelectionRadio)
index c5018c2f0fc1f8cdd50b55e6124781636fd6da99..49d82477b1be75fe2a07fa7c0049ca682ab1b703 100644 (file)
@@ -16,8 +16,7 @@ from Components.Sources.FrontendStatus import FrontendStatus
 from Components.Sources.Boolean import Boolean
 from Components.Sources.Clock import Clock
 from Components.TimerList import TimerEntryComponent
 from Components.Sources.Boolean import Boolean
 from Components.Sources.Clock import Clock
 from Components.TimerList import TimerEntryComponent
-from Components.config import config, configElement, ConfigSubsection, configSequence, configElementBoolean, configSelection, configElement_nonSave, getConfigListEntry
-from Components.config import configfile, configsequencearg
+from Components.config import config, ConfigBoolean
 
 from EpgSelection import EPGSelection
 from Plugins.Plugin import PluginDescriptor
 
 from EpgSelection import EPGSelection
 from Plugins.Plugin import PluginDescriptor
@@ -44,8 +43,6 @@ import time
 import os
 import bisect
 
 import os
 import bisect
 
-from Components.config import config, currentConfigSelectionElement
-
 # hack alert!
 from Menu import MainMenu, mdom
 
 # hack alert!
 from Menu import MainMenu, mdom
 
@@ -240,7 +237,7 @@ class InfoBarNumberZap:
                        self.servicelist.setCurrentSelection(service) #select the service in servicelist
                        self.servicelist.zap()
 
                        self.servicelist.setCurrentSelection(service) #select the service in servicelist
                        self.servicelist.zap()
 
-config.misc.initialchannelselection = configElementBoolean("config.misc.initialchannelselection", 1);
+config.misc.initialchannelselection = ConfigBoolean(default = True)
 
 class InfoBarChannelSelection:
        """ ChannelSelection - handles the channelSelection dialog and the initial 
 
 class InfoBarChannelSelection:
        """ ChannelSelection - handles the channelSelection dialog and the initial 
@@ -249,7 +246,8 @@ class InfoBarChannelSelection:
                #instantiate forever
                self.servicelist = self.session.instantiateDialog(ChannelSelection)
                
                #instantiate forever
                self.servicelist = self.session.instantiateDialog(ChannelSelection)
                
-               if config.misc.initialchannelselection.value == 1:
+               print "__init__: servicelist is", self.servicelist
+               if config.misc.initialchannelselection.value:
                        self.onShown.append(self.firstRun)
 
                self["ChannelSelectActions"] = HelpableActionMap(self, "InfobarChannelSelection",
                        self.onShown.append(self.firstRun)
 
                self["ChannelSelectActions"] = HelpableActionMap(self, "InfobarChannelSelection",
@@ -277,8 +275,9 @@ class InfoBarChannelSelection:
 
        def firstRun(self):
                self.onShown.remove(self.firstRun)
 
        def firstRun(self):
                self.onShown.remove(self.firstRun)
-               config.misc.initialchannelselection.value = 0
+               config.misc.initialchannelselection.value = False
                config.misc.initialchannelselection.save()
                config.misc.initialchannelselection.save()
+               print "servicelist is", self.servicelist
                self.switchChannelDown()
 
        def historyBack(self):
                self.switchChannelDown()
 
        def historyBack(self):
@@ -304,7 +303,7 @@ class InfoBarChannelSelection:
                        if prev:
                                prev = prev.toString()
                                while True:
                        if prev:
                                prev = prev.toString()
                                while True:
-                                       if currentConfigSelectionElement(config.usage.quickzap_bouquet_change) == "yes":
+                                       if config.usage.quickzap_bouquet_change.value:
                                                if self.servicelist.atBegin():
                                                        self.servicelist.prevBouquet()
                                        self.servicelist.moveUp()
                                                if self.servicelist.atBegin():
                                                        self.servicelist.prevBouquet()
                                        self.servicelist.moveUp()
@@ -322,7 +321,7 @@ class InfoBarChannelSelection:
                        if prev:
                                prev = prev.toString()
                                while True:
                        if prev:
                                prev = prev.toString()
                                while True:
-                                       if currentConfigSelectionElement(config.usage.quickzap_bouquet_change) == "yes" and self.servicelist.atEnd():
+                                       if config.usage.quickzap_bouquet_change.value and self.servicelist.atEnd():
                                                self.servicelist.nextBouquet()
                                        else:
                                                self.servicelist.moveDown()
                                                self.servicelist.nextBouquet()
                                        else:
                                                self.servicelist.moveDown()
@@ -827,6 +826,11 @@ class InfoBarSeek:
                if seekable is not None:
                        seekable.seekRelative(1, diff)
 
                if seekable is not None:
                        seekable.seekRelative(1, diff)
 
+       def seekAbsolute(self, abs):
+               seekable = self.getSeek()
+               if seekable is not None:
+                       seekable.seekTo(abs)
+
 from Screens.PVRState import PVRState, TimeshiftState
 
 class InfoBarPVRState:
 from Screens.PVRState import PVRState, TimeshiftState
 
 class InfoBarPVRState:
@@ -1710,10 +1714,10 @@ class InfoBarCueSheetSupport:
 class InfoBarSummary(Screen):
        skin = """
        <screen position="0,0" size="132,64">
 class InfoBarSummary(Screen):
        skin = """
        <screen position="0,0" size="132,64">
-               <widget source="CurrentTime" render="Label" position="50,46" size="82,18" font="Regular;16" >
+               <widget source="CurrentTime" render="Label" position="56,46" size="82,18" font="Regular;16" >
                        <convert type="ClockToText">WithSeconds</convert>
                </widget>
                        <convert type="ClockToText">WithSeconds</convert>
                </widget>
-               <widget source="CurrentService" render="Label" position="0,4" size="132,42" font="Regular;18" >
+               <widget source="CurrentService" render="Label" position="6,4" size="120,42" font="Regular;18" >
                        <convert type="ServiceName">Name</convert>
                </widget>
        </screen>"""
                        <convert type="ServiceName">Name</convert>
                </widget>
        </screen>"""
index 2e998db7c90f174768c0ecaa9431de5153f32026..0d253d5e13ff46870e4d4f61f2ffcbbae53ceb81 100644 (file)
@@ -11,5 +11,4 @@ install_PYTHON = \
        TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \
        Console.py InputBox.py ChoiceBox.py SimpleSummary.py ImageWizard.py \
        MediaPlayer.py TimerSelection.py PictureInPicture.py TimeDateInput.py \
        TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \
        Console.py InputBox.py ChoiceBox.py SimpleSummary.py ImageWizard.py \
        MediaPlayer.py TimerSelection.py PictureInPicture.py TimeDateInput.py \
-       SubtitleDisplay.py SubservicesQuickzap.py
-
+       SubtitleDisplay.py SubservicesQuickzap.py NumericalTextInputHelpDialog.py
index 1390b51a74ad0e99d2f14cbf177829fccae10c4d..6ef4cc4e9e2a692a2e46b9c189f032b6c2aceb28 100644 (file)
@@ -62,9 +62,9 @@ menuupdater = MenuUpdater()
 class MenuSummary(Screen):
        skin = """
        <screen position="0,0" size="132,64">
 class MenuSummary(Screen):
        skin = """
        <screen position="0,0" size="132,64">
-               <widget name="MenuTitle" position="0,4" size="132,21" font="Regular;18" />
-               <widget name="MenuEntry" position="0,25" size="132,21" font="Regular;16" />
-               <widget source="CurrentTime" render="Label" position="50,46" size="82,18" font="Regular;16" >
+               <widget name="MenuTitle" position="6,4" size="120,21" font="Regular;18" />
+               <widget name="MenuEntry" position="6,25" size="120,21" font="Regular;16" />
+               <widget source="CurrentTime" render="Label" position="56,46" size="82,18" font="Regular;16" >
                        <convert type="ClockToText">WithSeconds</convert>
                </widget>
        </screen>"""
                        <convert type="ClockToText">WithSeconds</convert>
                </widget>
        </screen>"""
index 0317975851553d6d335884aa4f9ead988d1903b4..3bdfe163150ca1731ed3c2581ab2b10e8bc15c9e 100644 (file)
@@ -1,12 +1,11 @@
 from Screen import Screen
 from Components.ActionMap import NumberActionMap
 from Screen import Screen
 from Components.ActionMap import NumberActionMap
-from Components.ConfigList import ConfigList
-from Components.config import config
-from Components.config import getConfigListEntry
+from Components.ConfigList import ConfigList, ConfigListScreen
+from Components.config import config, getConfigListEntry
 from Components.Network import iNetwork
 from Components.Label import Label
 
 from Components.Network import iNetwork
 from Components.Label import Label
 
-class NetworkSetup(Screen):
+class NetworkSetup(Screen, ConfigListScreen):
        def __init__(self, session):
                Screen.__init__(self, session)
         
        def __init__(self, session):
                Screen.__init__(self, session)
         
@@ -14,62 +13,45 @@ class NetworkSetup(Screen):
                {
                        "ok": self.keySave,
                        "cancel": self.keyCancel,
                {
                        "ok": self.keySave,
                        "cancel": self.keyCancel,
-                       "left": self.keyLeft,
-                       "right": self.keyRight,
-                       "1": self.keyNumberGlobal,
-                       "2": self.keyNumberGlobal,
-                       "3": self.keyNumberGlobal,
-                       "4": self.keyNumberGlobal,
-                       "5": self.keyNumberGlobal,
-                       "6": self.keyNumberGlobal,
-                       "7": self.keyNumberGlobal,
-                       "8": self.keyNumberGlobal,
-                       "9": self.keyNumberGlobal,
-                       "0": self.keyNumberGlobal
                }, -1)
 
                self.list = []
                }, -1)
 
                self.list = []
-               self["config"] = ConfigList(self.list)
+               ConfigListScreen.__init__(self, self.list)
                self.createSetup()
                self.createSetup()
-        
+
                self["introduction"] = Label(_("Press OK to activate the settings."))
                self["introduction"] = Label(_("Press OK to activate the settings."))
-        
+
        def createSetup(self):
                self.list = []
        def createSetup(self):
                self.list = []
-        
+
                self.dhcpEntry = getConfigListEntry(_("Use DHCP"), config.network.dhcp)
                self.list.append(self.dhcpEntry)
                self.list.append(getConfigListEntry(_('IP Address'), config.network.ip))
                self.dhcpEntry = getConfigListEntry(_("Use DHCP"), config.network.dhcp)
                self.list.append(self.dhcpEntry)
                self.list.append(getConfigListEntry(_('IP Address'), config.network.ip))
-               if (config.network.dhcp.value == 0):
+               if not config.network.dhcp.value:
                        self.list.append(getConfigListEntry(_('Netmask'), config.network.netmask))
                        self.list.append(getConfigListEntry(_('Gateway'), config.network.gateway))
                        self.list.append(getConfigListEntry(_('Nameserver'), config.network.dns))
                        self.list.append(getConfigListEntry(_('Netmask'), config.network.netmask))
                        self.list.append(getConfigListEntry(_('Gateway'), config.network.gateway))
                        self.list.append(getConfigListEntry(_('Nameserver'), config.network.dns))
-        
+
                self["config"].list = self.list
                self["config"].l.setList(self.list)
                self["config"].list = self.list
                self["config"].l.setList(self.list)
-        
+
        def newConfig(self):
                print self["config"].getCurrent()
                if self["config"].getCurrent() == self.dhcpEntry:
                        self.createSetup()
 
        def keyLeft(self):
        def newConfig(self):
                print self["config"].getCurrent()
                if self["config"].getCurrent() == self.dhcpEntry:
                        self.createSetup()
 
        def keyLeft(self):
-               self["config"].handleKey(config.key["prevElement"])
-               self.newConfig()
+               ConfigListScreen.keyLeft(self)
+               self.createSetup()
 
        def keyRight(self):
 
        def keyRight(self):
-               self["config"].handleKey(config.key["nextElement"])
-               self.newConfig()
-    
-       def keyNumberGlobal(self, number):
-               print "You pressed number " + str(number)
-               if (self["config"].getCurrent()[1].parent.enabled == True):
-                       self["config"].handleKey(config.key[str(number)])
-        
+               ConfigListScreen.keyRight(self)
+               self.createSetup()
+
        def keySave(self):
                #for x in self["config"].list:
                        #x[1].save()
        def keySave(self):
                #for x in self["config"].list:
                        #x[1].save()
-        
+
                iNetwork.writeNetworkConfig()    
                iNetwork.activateNetworkConfig()
                self.close()
                iNetwork.writeNetworkConfig()    
                iNetwork.activateNetworkConfig()
                self.close()
index fdb0418546185bf9b37e1d36a40760d7ed595972..ce959209733c87de0c160b50d89eff5f83109fd5 100644 (file)
@@ -1,14 +1,14 @@
 from Screens.Screen import Screen
 from enigma import ePoint, eSize, eServiceCenter
 from Components.VideoWindow import VideoWindow
 from Screens.Screen import Screen
 from enigma import ePoint, eSize, eServiceCenter
 from Components.VideoWindow import VideoWindow
-from Components.config import config, configElement, configSequence, configsequencearg
+from Components.config import config, ConfigPosition
 
 class PictureInPicture(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
                self["video"] = VideoWindow()
                self.currentService = None
 
 class PictureInPicture(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
                self["video"] = VideoWindow()
                self.currentService = None
-               config.av.pip = configElement("config.av.pip", configSequence, [-1, -1, -1, -1], configsequencearg.get("POSITION", (719, 567, 720, 568)))
+               config.av.pip = ConfigPosition(default=[-1, -1, -1, -1], limits = (719, 567, 720, 568))
                self.onLayoutFinish.append(self.LayoutFinished)
 
        def LayoutFinished(self):
                self.onLayoutFinish.append(self.LayoutFinished)
 
        def LayoutFinished(self):
index 0a76e4919882e9943c93dc04fc3f8231d86d262a..9e692e63bb7bad1f0ce7bb20a4bbf842c7674789 100644 (file)
@@ -1,33 +1,31 @@
 from Screen import Screen
 from Screen import Screen
-from Components.ActionMap import NumberActionMap
 from Components.ActionMap import ActionMap
 from Components.ActionMap import ActionMap
-from Components.ConfigList import ConfigList
-from Components.config import *
+from Components.ConfigList import ConfigList, ConfigListScreen
 from Components.MenuList import MenuList
 from Components.NimManager import nimmanager
 from Components.MenuList import MenuList
 from Components.NimManager import nimmanager
-from Components.config import getConfigListEntry
+from Components.config import getConfigListEntry, config, ConfigDummy
 
 
-class NimSetup(Screen):
+class NimSetup(Screen, ConfigListScreen):
        def createSimpleSetup(self, list, mode):
        def createSimpleSetup(self, list, mode):
-               if mode == 0:                   #single Sat
+               if mode == "single":
                        list.append(getConfigListEntry(_("Satellite"), self.nimConfig.diseqcA))
                        list.append(getConfigListEntry(_("Satellite"), self.nimConfig.diseqcA))
-               else:                                                   # > 1 Sats
+               else:
                        list.append(getConfigListEntry(_("Port A"), self.nimConfig.diseqcA))
 
                        list.append(getConfigListEntry(_("Port A"), self.nimConfig.diseqcA))
 
-               if mode >= 1:                   # > 1 Sats
+               if mode in ["toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
                        list.append(getConfigListEntry(_("Port B"), self.nimConfig.diseqcB))
                        list.append(getConfigListEntry(_("Port B"), self.nimConfig.diseqcB))
-                       if mode >= 3:           # > 2 Sats
+                       if mode == "diseqc_a_b_c_d":
                                list.append(getConfigListEntry(_("Port C"), self.nimConfig.diseqcC))
                                list.append(getConfigListEntry(_("Port D"), self.nimConfig.diseqcD))
 
        def createPositionerSetup(self, list):
 #              list.append(getConfigListEntry(_("Positioner mode"), self.nimConfig.positionerMode))
                                list.append(getConfigListEntry(_("Port C"), self.nimConfig.diseqcC))
                                list.append(getConfigListEntry(_("Port D"), self.nimConfig.diseqcD))
 
        def createPositionerSetup(self, list):
 #              list.append(getConfigListEntry(_("Positioner mode"), self.nimConfig.positionerMode))
-#              if (currentConfigSelectionElement(self.nimConfig.positionerMode) == "usals"): # USALS
+#              if self.nimConfig.positionerMode.value == "usals": # USALS
                list.append(getConfigListEntry(_("Longitude"), self.nimConfig.longitude))
                list.append(getConfigListEntry(" ", self.nimConfig.longitudeOrientation))
                list.append(getConfigListEntry(_("Latitude"), self.nimConfig.latitude))
                list.append(getConfigListEntry(" ", self.nimConfig.latitudeOrientation))
                list.append(getConfigListEntry(_("Longitude"), self.nimConfig.longitude))
                list.append(getConfigListEntry(" ", self.nimConfig.longitudeOrientation))
                list.append(getConfigListEntry(_("Latitude"), self.nimConfig.latitude))
                list.append(getConfigListEntry(" ", self.nimConfig.latitudeOrientation))
-#              elif (currentConfigSelectionElement(self.nimConfig.positionerMode) == "manual"): # manual
+#              elif self.nimConfig.positionerMode.value == "manual": # manual
 #                      pass
 
        def createSetup(self):
 #                      pass
 
        def createSetup(self):
@@ -48,21 +46,22 @@ class NimSetup(Screen):
                if self.nim_type == nimmanager.nimType["DVB-S"]:
                        self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
                        self.list.append(self.configMode)
                if self.nim_type == nimmanager.nimType["DVB-S"]:
                        self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
                        self.list.append(self.configMode)
-
-                       if currentConfigSelectionElement(self.nimConfig.configMode) == "simple":                        #simple setup
+                       
+                       if self.nimConfig.configMode.value == "simple":                 #simple setup
                                self.diseqcModeEntry = getConfigListEntry(_("DiSEqC Mode"), self.nimConfig.diseqcMode)
                                self.list.append(self.diseqcModeEntry)
                                self.diseqcModeEntry = getConfigListEntry(_("DiSEqC Mode"), self.nimConfig.diseqcMode)
                                self.list.append(self.diseqcModeEntry)
-                               if (0 <= self.nimConfig.diseqcMode.value < 4):
+                               if self.nimConfig.diseqcMode.value in ["single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
                                        self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value)
                                        self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value)
-                               if (self.nimConfig.diseqcMode.value == 4):
+                               if self.nimConfig.diseqcMode.value == "positioner":
                                        self.createPositionerSetup(self.list)
                                        self.createPositionerSetup(self.list)
-                       elif currentConfigSelectionElement(self.nimConfig.configMode) in ["loopthrough", "satposdepends", "nothing", "equal"]:
+                       elif self.nimConfig.configMode.value in ["loopthrough", "satposdepends", "nothing", "equal"]:
                                pass
                                pass
-                       elif currentConfigSelectionElement(self.nimConfig.configMode) == "advanced": # advanced
+                       elif self.nimConfig.configMode.value == "advanced": # advanced
                                # SATs
                                self.advancedSatsEntry = getConfigListEntry(_("Satellite"), self.nimConfig.advanced.sats)
                                self.list.append(self.advancedSatsEntry)
                                # SATs
                                self.advancedSatsEntry = getConfigListEntry(_("Satellite"), self.nimConfig.advanced.sats)
                                self.list.append(self.advancedSatsEntry)
-                               currSat = self.nimConfig.advanced.sat[nimmanager.satList[self.nimConfig.advanced.sats.value][1]]
+                               print "blub", self.nimConfig.advanced.sat
+                               currSat = self.nimConfig.advanced.sat[self.nimConfig.advanced.sats.orbital_position]
                                self.fillListWithAdvancedSatEntrys(currSat)
                        self.have_advanced = True
                elif self.nim_type == nimmanager.nimType["DVB-C"]:
                                self.fillListWithAdvancedSatEntrys(currSat)
                        self.have_advanced = True
                elif self.nim_type == nimmanager.nimType["DVB-C"]:
@@ -84,66 +83,56 @@ class NimSetup(Screen):
                        if self["config"].getCurrent() == x:
                                self.createSetup()
 
                        if self["config"].getCurrent() == x:
                                self.createSetup()
 
-       def keyLeft(self):
-               self["config"].handleKey(config.key["prevElement"])
-               self.newConfig()
-
-       def keyRight(self):
-               self["config"].handleKey(config.key["nextElement"])
-               self.newConfig()
-
-       def keyNumberGlobal(self, number):
-               print "You pressed number " + str(number)
-               if (self["config"].getCurrent()[1].parent.enabled == True):
-                       self["config"].handleKey(config.key[str(number)])
-
        def run(self):
        def run(self):
-               if self.have_advanced and currentConfigSelectionElement(config.Nims[self.nim.slotid].configMode) == "advanced":
+               if self.have_advanced and config.Nims[self.nim.slotid].configMode.value == "advanced":
                        self.fillAdvancedList()
                for x in self["config"].list:
                        x[1].save()
                nimmanager.sec.update()
 
        def fillListWithAdvancedSatEntrys(self, Sat):
                        self.fillAdvancedList()
                for x in self["config"].list:
                        x[1].save()
                nimmanager.sec.update()
 
        def fillListWithAdvancedSatEntrys(self, Sat):
-               currLnb = self.nimConfig.advanced.lnb[Sat.lnb.value]
+               currLnb = self.nimConfig.advanced.lnb[int(Sat.lnb.value)]
+               
+               if isinstance(currLnb, ConfigDummy):
+                       currLnb = None
 
                self.list.append(getConfigListEntry(_("Voltage mode"), Sat.voltage))
                self.list.append(getConfigListEntry(_("Tone mode"), Sat.tonemode))
 
                self.list.append(getConfigListEntry(_("Voltage mode"), Sat.voltage))
                self.list.append(getConfigListEntry(_("Tone mode"), Sat.tonemode))
-               if (currLnb != 0 and currentConfigSelectionElement(currLnb.diseqcMode) == "1_2"):
+               if currLnb and currLnb.diseqcMode.value == "1_2":
                        self.advancedUsalsEntry = getConfigListEntry(_("Use usals for this sat"), Sat.usals)
                        self.list.append(self.advancedUsalsEntry)
                        self.advancedUsalsEntry = getConfigListEntry(_("Use usals for this sat"), Sat.usals)
                        self.list.append(self.advancedUsalsEntry)
-                       if (currentConfigSelectionElement(Sat.usals) == "no"):
+                       if not Sat.usals.value:
                                self.list.append(getConfigListEntry(_("Stored position"), Sat.rotorposition))
 
                # LNBs
                self.advancedLnbsEntry = getConfigListEntry(_("LNB"), Sat.lnb)
                self.list.append(self.advancedLnbsEntry)
                                self.list.append(getConfigListEntry(_("Stored position"), Sat.rotorposition))
 
                # LNBs
                self.advancedLnbsEntry = getConfigListEntry(_("LNB"), Sat.lnb)
                self.list.append(self.advancedLnbsEntry)
-               if currLnb != 0:
+               if currLnb:
                        self.advancedDiseqcMode = getConfigListEntry(_("DiSEqC mode"), currLnb.diseqcMode)
                        self.list.append(self.advancedDiseqcMode)
                        self.advancedDiseqcMode = getConfigListEntry(_("DiSEqC mode"), currLnb.diseqcMode)
                        self.list.append(self.advancedDiseqcMode)
-                       if currentConfigSelectionElement(currLnb.diseqcMode) != "none":
+                       if currLnb.diseqcMode.value != "none":
                                self.list.append(getConfigListEntry(_("Toneburst"), currLnb.toneburst))
                                self.list.append(getConfigListEntry(_("Committed DiSEqC command"), currLnb.commitedDiseqcCommand))
                                self.list.append(getConfigListEntry(_("Fast DiSEqC"), currLnb.fastDiseqc))
                                self.list.append(getConfigListEntry(_("Sequence repeat"), currLnb.sequenceRepeat))
                                self.list.append(getConfigListEntry(_("Toneburst"), currLnb.toneburst))
                                self.list.append(getConfigListEntry(_("Committed DiSEqC command"), currLnb.commitedDiseqcCommand))
                                self.list.append(getConfigListEntry(_("Fast DiSEqC"), currLnb.fastDiseqc))
                                self.list.append(getConfigListEntry(_("Sequence repeat"), currLnb.sequenceRepeat))
-                               if currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
+                               if currLnb.diseqcMode.value == "1_0":
                                        self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder1_0))
                                else:
                                        self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder))
                                        self.list.append(getConfigListEntry(_("Uncommitted DiSEqC command"), currLnb.uncommittedDiseqcCommand))
                                        self.list.append(getConfigListEntry(_("DiSEqC repeats"), currLnb.diseqcRepeats))
                                        self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder1_0))
                                else:
                                        self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder))
                                        self.list.append(getConfigListEntry(_("Uncommitted DiSEqC command"), currLnb.uncommittedDiseqcCommand))
                                        self.list.append(getConfigListEntry(_("DiSEqC repeats"), currLnb.diseqcRepeats))
-                               if currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
+                               if currLnb.diseqcMode.value == "1_2":
                                        self.list.append(getConfigListEntry(_("Longitude"), currLnb.longitude))
                                        self.list.append(getConfigListEntry(" ", currLnb.longitudeOrientation))
                                        self.list.append(getConfigListEntry(_("Latitude"), currLnb.latitude))
                                        self.list.append(getConfigListEntry(" ", currLnb.latitudeOrientation))
                                        self.advancedPowerMeasurement = getConfigListEntry("Use Power Measurement", currLnb.powerMeasurement)
                                        self.list.append(self.advancedPowerMeasurement)
                                        self.list.append(getConfigListEntry(_("Longitude"), currLnb.longitude))
                                        self.list.append(getConfigListEntry(" ", currLnb.longitudeOrientation))
                                        self.list.append(getConfigListEntry(_("Latitude"), currLnb.latitude))
                                        self.list.append(getConfigListEntry(" ", currLnb.latitudeOrientation))
                                        self.advancedPowerMeasurement = getConfigListEntry("Use Power Measurement", currLnb.powerMeasurement)
                                        self.list.append(self.advancedPowerMeasurement)
-                                       if currentConfigSelectionElement(currLnb.powerMeasurement) == "yes":
+                                       if currLnb.powerMeasurement.value == "yes":
                                                self.list.append(getConfigListEntry("Power Threshold in mA", currLnb.powerThreshold))
                        self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof)
                        self.list.append(self.advancedLof)
                                                self.list.append(getConfigListEntry("Power Threshold in mA", currLnb.powerThreshold))
                        self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof)
                        self.list.append(self.advancedLof)
-                       if currentConfigSelectionElement(currLnb.lof) == "user_defined":
+                       if currLnb.lof.value == "user_defined":
                                self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl))
                                self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh))
                                self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold))
                                self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl))
                                self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh))
                                self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold))
@@ -157,7 +146,7 @@ class NimSetup(Screen):
                self.advancedSatsEntry = getConfigListEntry(_("Satellite"), self.nimConfig.advanced.sats)
                self.list.append(self.advancedSatsEntry)
                for x in nimmanager.satList:
                self.advancedSatsEntry = getConfigListEntry(_("Satellite"), self.nimConfig.advanced.sats)
                self.list.append(self.advancedSatsEntry)
                for x in nimmanager.satList:
-                       Sat = self.nimConfig.advanced.sat[x[1]]
+                       Sat = self.nimConfig.advanced.sat[x[0]]
                        self.fillListWithAdvancedSatEntrys(Sat)
                self["config"].list = self.list
 
                        self.fillListWithAdvancedSatEntrys(Sat)
                self["config"].list = self.list
 
@@ -172,31 +161,28 @@ class NimSetup(Screen):
 
        def __init__(self, session, slotid):
                Screen.__init__(self, session)
 
        def __init__(self, session, slotid):
                Screen.__init__(self, session)
+               self.list = [ ]
+
+               ConfigListScreen.__init__(self, self.list)
 
 
-               self["actions"] = NumberActionMap(["SetupActions"],
+               self["actions"] = ActionMap(["SetupActions"],
                {
                        "ok": self.keySave,
                        "cancel": self.keyCancel,
                {
                        "ok": self.keySave,
                        "cancel": self.keyCancel,
-                       "left": self.keyLeft,
-                       "right": self.keyRight,
-                       "1": self.keyNumberGlobal,
-                       "2": self.keyNumberGlobal,
-                       "3": self.keyNumberGlobal,
-                       "4": self.keyNumberGlobal,
-                       "5": self.keyNumberGlobal,
-                       "6": self.keyNumberGlobal,
-                       "7": self.keyNumberGlobal,
-                       "8": self.keyNumberGlobal,
-                       "9": self.keyNumberGlobal,
-                       "0": self.keyNumberGlobal
                }, -1)
 
                self.nim = nimmanager.nimList()[slotid][1]
                self.nimConfig = config.Nims[self.nim.slotid]
                }, -1)
 
                self.nim = nimmanager.nimList()[slotid][1]
                self.nimConfig = config.Nims[self.nim.slotid]
-               self.list = [ ]
-               self["config"] = ConfigList(self.list)
                self.createSetup()
 
                self.createSetup()
 
+       def keyLeft(self):
+               ConfigListScreen.keyLeft(self)
+               self.newConfig()
+
+       def keyRight(self):
+               ConfigListScreen.keyRight(self)
+               self.newConfig()
+
 class NimSelection(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
 class NimSelection(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
index 3120a57311a60e5db43ca6b22d296cad4f626265..7aaca3829d349da21b4ac779c068c1f9c14790de 100644 (file)
@@ -1,8 +1,8 @@
 from Screen import Screen
 from ServiceScan import *
 from Screen import Screen
 from ServiceScan import *
-from Components.config import *
+from Components.config import config, ConfigSubsection, ConfigSelection, ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigSatlist, ConfigEnableDisable
 from Components.ActionMap import NumberActionMap
 from Components.ActionMap import NumberActionMap
-from Components.ConfigList import ConfigList
+from Components.ConfigList import ConfigList, ConfigListScreen
 from Components.NimManager import nimmanager
 from Components.Label import Label
 from Screens.MessageBox import MessageBox
 from Components.NimManager import nimmanager
 from Components.Label import Label
 from Screens.MessageBox import MessageBox
@@ -115,7 +115,7 @@ def getInitialTerrestrialTransponderList(tlist, region):
                        tlist.append(parm)
 
 
                        tlist.append(parm)
 
 
-class ScanSetup(Screen):
+class ScanSetup(ConfigListScreen, Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
 
        def __init__(self, session):
                Screen.__init__(self, session)
 
@@ -135,26 +135,14 @@ class ScanSetup(Screen):
                {
                        "ok": self.keyGo,
                        "cancel": self.keyCancel,
                {
                        "ok": self.keyGo,
                        "cancel": self.keyCancel,
-                       "left": self.keyLeft,
-                       "right": self.keyRight,
-                       "1": self.keyNumberGlobal,
-                       "2": self.keyNumberGlobal,
-                       "3": self.keyNumberGlobal,
-                       "4": self.keyNumberGlobal,
-                       "5": self.keyNumberGlobal,
-                       "6": self.keyNumberGlobal,
-                       "7": self.keyNumberGlobal,
-                       "8": self.keyNumberGlobal,
-                       "9": self.keyNumberGlobal,
-                       "0": self.keyNumberGlobal
                }, -1)
                }, -1)
-               
+
                self.statusTimer = eTimer()
                self.statusTimer.timeout.get().append(self.updateStatus)
                #self.statusTimer.start(5000, True)
 
                self.list = []
                self.statusTimer = eTimer()
                self.statusTimer.timeout.get().append(self.updateStatus)
                #self.statusTimer.start(5000, True)
 
                self.list = []
-               self["config"] = ConfigList(self.list)
+               ConfigListScreen.__init__(self, self.list)
                self.createSetup()
 
                self["introduction"] = Label(_("Press OK to start the scan"))
                self.createSetup()
 
                self["introduction"] = Label(_("Press OK to start the scan"))
@@ -173,95 +161,94 @@ class ScanSetup(Screen):
        def createSetup(self):
                self.list = []
                self.multiscanlist = []
        def createSetup(self):
                self.list = []
                self.multiscanlist = []
-               print "ID: " + str(config.scan.nims.value)
+               print "ID: ", self.scan_nims.index
 
 
-               self.tunerEntry = getConfigListEntry(_("Tuner"), config.scan.nims)
+               self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
                self.list.append(self.tunerEntry)
                
                self.typeOfScanEntry = None
                self.systemEntry = None
                self.list.append(self.tunerEntry)
                
                self.typeOfScanEntry = None
                self.systemEntry = None
-               if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
-                       self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.type)
+               if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-S"]:
+                       self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_type)
                        self.list.append(self.typeOfScanEntry)
                        self.list.append(self.typeOfScanEntry)
-               elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
-                       self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.typecable)
+               elif nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-C"]:
+                       self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typecable)
                        self.list.append(self.typeOfScanEntry)
                        self.list.append(self.typeOfScanEntry)
-               elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
-                       self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.typeterrestrial)
+               elif nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-T"]:
+                       self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typeterrestrial)
                        self.list.append(self.typeOfScanEntry)
 
                        self.list.append(self.typeOfScanEntry)
 
+               if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-S"]:
 
 
-               if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
-
-                       if currentConfigSelectionElement(config.scan.type) == "single_transponder":
-                               self.systemEntry = getConfigListEntry(_('Transpondertype'), config.scan.sat.system)
+                       if self.scan_type.value == "single_transponder":
+                               self.systemEntry = getConfigListEntry(_('Transpondertype'), self.scan_sat.system)
                                self.list.append(self.systemEntry)
                                self.list.append(self.systemEntry)
-                               self.list.append(getConfigListEntry(_('Satellite'), config.scan.satselection[config.scan.nims.value]))
-                               self.list.append(getConfigListEntry(_('Frequency'), config.scan.sat.frequency))
-                               self.list.append(getConfigListEntry(_('Inversion'), config.scan.sat.inversion))
-                               self.list.append(getConfigListEntry(_('Symbol Rate'), config.scan.sat.symbolrate))
-                               self.list.append(getConfigListEntry(_("Polarity"), config.scan.sat.polarization))
-                               if currentConfigSelectionElement(config.scan.sat.system) == "dvb-s":
-                                       self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec))
-                               elif currentConfigSelectionElement(config.scan.sat.system) == "dvb-s2":
-                                       self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec_s2))
-                                       self.list.append(getConfigListEntry(_('Modulation'), config.scan.sat.modulation))
-                       elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
+                               self.list.append(getConfigListEntry(_('Satellite'), self.scan_satselection[self.scan_nims.index]))
+                               self.list.append(getConfigListEntry(_('Frequency'), self.scan_sat.frequency))
+                               self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
+                               self.list.append(getConfigListEntry(_('Symbol Rate'), self.scan_sat.symbolrate))
+                               self.list.append(getConfigListEntry(_("Polarity"), self.scan_sat.polarization))
+                               if self.scan_sat.system.value == "dvb-s":
+                                       self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec))
+                               elif self.scan_sat.system.value == "dvb-s2":
+                                       self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec_s2))
+                                       self.list.append(getConfigListEntry(_('Modulation'), self.scan_sat.modulation))
+                       elif self.scan_type.value == "single_satellite":
                                self.updateSatList()
                                self.updateSatList()
-                               print config.scan.satselection[config.scan.nims.value]
-                               self.list.append(getConfigListEntry(_("Satellite"), config.scan.satselection[config.scan.nims.value]))
-                               self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
-                       elif currentConfigSelectionElement(config.scan.type) == "multisat":
+                               print self.scan_satselection[self.scan_nims.index]
+                               self.list.append(getConfigListEntry(_("Satellite"), self.scan_satselection[self.scan_nims.index]))
+                               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
+                       elif self.scan_type.value == "multisat":
                                # if (norotor)
                                tlist = []
                                # if (norotor)
                                tlist = []
-                               SatList = nimmanager.getSatListForNim(config.scan.nims.value)
-                               self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
+                               SatList = nimmanager.getSatListForNim(self.scan_nims.index)
+                               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
                                for x in SatList:
                                for x in SatList:
-                                       if self.Satexists(tlist, x[1]) == 0:
-                                               tlist.append(x[1])
-                                               sat = configElement_nonSave(x[1], configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))))
-                                               configEntry = getConfigListEntry(nimmanager.getSatDescription(x[1]), sat)
+                                       if self.Satexists(tlist, x[0]) == 0:
+                                               tlist.append(x[0])
+                                               sat = ConfigEnableDisable(default = True)
+                                               configEntry = getConfigListEntry(nimmanager.getSatDescription(x[0]), sat)
                                                self.list.append(configEntry)
                                                self.list.append(configEntry)
-                                               self.multiscanlist.append(configEntry)
+                                               self.multiscanlist.append((x[0], sat))
                                # if (rotor):
                           # for sat in nimmanager.satList:
                                # if (rotor):
                           # for sat in nimmanager.satList:
-                               #       self.list.append(getConfigListEntry(sat[0], config.scan.scansat[sat[1]]))
-
-
-               if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
-                       if currentConfigSelectionElement(config.scan.typecable) == "single_transponder":
-                               self.list.append(getConfigListEntry(_("Frequency"), config.scan.cab.frequency))
-                               self.list.append(getConfigListEntry(_("Inversion"), config.scan.cab.inversion))
-                               self.list.append(getConfigListEntry(_("Symbol Rate"), config.scan.cab.symbolrate))
-                               self.list.append(getConfigListEntry(_("Modulation"), config.scan.cab.modulation))
-                               self.list.append(getConfigListEntry(_("FEC"), config.scan.cab.fec))
-                               self.list.append(getConfigListEntry(_("Network scan"), config.scan.cab.networkScan))
-                       elif currentConfigSelectionElement(config.scan.typecable) == "complete":
-                               self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
+                               #       self.list.append(getConfigListEntry(sat[1], self.scan_scansat[sat[0]]))
+
+
+               if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-C"]:
+                       if self.scan_typecable.value == "single_transponder":
+                               self.list.append(getConfigListEntry(_("Frequency"), self.scan_cab.frequency))
+                               self.list.append(getConfigListEntry(_("Inversion"), self.scan_cab.inversion))
+                               self.list.append(getConfigListEntry(_("Symbol Rate"), self.scan_cab.symbolrate))
+                               self.list.append(getConfigListEntry(_("Modulation"), self.scan_cab.modulation))
+                               self.list.append(getConfigListEntry(_("FEC"), self.scan_cab.fec))
+                               self.list.append(getConfigListEntry(_("Network scan"), self.scan_cab.networkScan))
+                       elif self.scan_typecable.value == "complete":
+                               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
                                
                                
-               if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
-                       if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
-                               self.list.append(getConfigListEntry(_("Frequency"), config.scan.ter.frequency))
-                               self.list.append(getConfigListEntry(_("Network scan"), config.scan.ter.networkScan))
-                               self.list.append(getConfigListEntry(_("Inversion"), config.scan.ter.inversion))
-                               self.list.append(getConfigListEntry(_("Bandwidth"), config.scan.ter.bandwidth))
-                               self.list.append(getConfigListEntry(_("Code rate high"), config.scan.ter.fechigh))
-                               self.list.append(getConfigListEntry(_("Code rate low"), config.scan.ter.feclow))
-                               self.list.append(getConfigListEntry(_("Modulation"), config.scan.ter.modulation))
-                               self.list.append(getConfigListEntry(_("Transmission mode"), config.scan.ter.transmission))
-                               self.list.append(getConfigListEntry(_("Guard interval mode"), config.scan.ter.guard))
-                               self.list.append(getConfigListEntry(_("Hierarchy mode"), config.scan.ter.hierarchy))
-                       elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
-                               self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
-
-#              if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \
-#                      (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \
-#                      (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"] and currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder"):
-#                              self.configElementSNR = getConfigListEntry(_("SNR"), config.scan.snr)
+               if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-T"]:
+                       if self.scan_typeterrestrial.value == "single_transponder":
+                               self.list.append(getConfigListEntry(_("Frequency"), self.scan_ter.frequency))
+                               self.list.append(getConfigListEntry(_("Network scan"), self.scan_ter.networkScan))
+                               self.list.append(getConfigListEntry(_("Inversion"), self.scan_ter.inversion))
+                               self.list.append(getConfigListEntry(_("Bandwidth"), self.scan_ter.bandwidth))
+                               self.list.append(getConfigListEntry(_("Code rate high"), self.scan_ter.fechigh))
+                               self.list.append(getConfigListEntry(_("Code rate low"), self.scan_ter.feclow))
+                               self.list.append(getConfigListEntry(_("Modulation"), self.scan_ter.modulation))
+                               self.list.append(getConfigListEntry(_("Transmission mode"), self.scan_ter.transmission))
+                               self.list.append(getConfigListEntry(_("Guard interval mode"), self.scan_ter.guard))
+                               self.list.append(getConfigListEntry(_("Hierarchy mode"), self.scan_ter.hierarchy))
+                       elif self.scan_typeterrestrial.value == "complete":
+                               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
+
+#              if (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-S"] and self.scan_type.type == "single_transponder") or \
+#                      (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-C"] and self.scan_typecable.type == "single_transponder") or \
+#                      (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-T"] and self.scan_typeterrestrial.type == "single_transponder"):
+#                              self.configElementSNR = getConfigListEntry(_("SNR"), self.scan_snr)
 #                              self.list.append(self.configElementSNR)
 #                              self.list.append(self.configElementSNR)
-#                              self.configElementACG = getConfigListEntry(_("AGC"), config.scan.agc)
+#                              self.configElementACG = getConfigListEntry(_("AGC"), self.scan_agc)
 #                              self.list.append(self.configElementACG)
 #                              self.list.append(self.configElementACG)
-#                              self.configElementBER = getConfigListEntry(_("BER"), config.scan.ber)
+#                              self.configElementBER = getConfigListEntry(_("BER"), self.scan_ber)
 #                              self.list.append(self.configElementBER)
 #                              self.statusTimer.start(500, False)
 #              else:
 #                              self.list.append(self.configElementBER)
 #                              self.statusTimer.start(500, False)
 #              else:
@@ -316,110 +303,105 @@ class ScanSetup(Screen):
                                           #("Transmission Mode", frontendData["transmission_mode"], TYPE_TEXT),
                                           #("Guard Interval", frontendData["guard_interval"], TYPE_TEXT),
                                           #("Hierarchy Inform.", frontendData["hierarchy_information"], TYPE_TEXT),
                                           #("Transmission Mode", frontendData["transmission_mode"], TYPE_TEXT),
                                           #("Guard Interval", frontendData["guard_interval"], TYPE_TEXT),
                                           #("Hierarchy Inform.", frontendData["hierarchy_information"], TYPE_TEXT),
-                       defaultSat = { "orbpos": 192, "system": 0, "frequency": [11836], "inversion": 2, "symbolrate": [27500], "polarization": 0, "fec": 0, "fec_s2": 8, "modulation": 0 }
-                       defaultCab = {"frequency": [466], "inversion": 2, "modulation": 2, "fec": 0, "symbolrate": [6900]}
+                       defaultSat = { "orbpos": 192, "system": "dvb-s", "frequency": 11836, "inversion": "auto", "symbolrate": 27500, "polarization": "horizontal", "fec": "auto", "fec_s2": "9_10", "modulation": "qpsk" }
+                       defaultCab = {"frequency": 466, "inversion": "auto", "modulation": "64qam", "fec": "auto", "symbolrate": 6900}
                        if frontendData is not None:
                                if frontendData["tuner_type"] == "DVB-S":
                        if frontendData is not None:
                                if frontendData["tuner_type"] == "DVB-S":
-                                       defaultSat["system"] = {"DVB-S": 0, "DVB-S2": 1}[frontendData["system"]]
-                                       defaultSat["frequency"] = [int(frontendData["frequency"] / 1000)]
-                                       defaultSat["inversion"] = {"INVERSION_OFF": 0, "INVERSION_ON": 1, "INVERSION_AUTO": 2}[frontendData["inversion"]]
-                                       defaultSat["symbolrate"] = [int(frontendData["symbol_rate"] / 1000)]
-                                       defaultSat["polarization"] = {"HORIZONTAL": 0, "VERTICAL": 1, "CIRCULAR_LEFT": 2, "CIRCULAR_RIGHT": 3, "UNKNOWN": 0}[frontendData["polarization"]]
-                                       defaultSat["fec"] = {"DVB-S": {"FEC_AUTO": 0, "FEC_1_2": 1, "FEC_2_3": 2, "FEC_3_4": 3, "FEC_5_6": 4, "FEC_7_8": 5, "FEC_NONE": 6}, "DVB-S2": {"FEC_1_2": 0, "FEC_2_3": 1, "FEC_3_4": 2, "FEC_4_5": 3, "FEC_5_6": 4, "FEC_7_8": 5, "FEC_8_9": 6, "FEC_9_10": 7}}[frontendData["system"]][frontendData["fec_inner"]]
-                                       defaultSat["modulation"] = {"QPSK": 0, "8PSK": 1}[frontendData["modulation"]]
+                                       defaultSat["system"] = {"DVB-S": "dvb-s", "DVB-S2": "dvb-s2"}[frontendData["system"]]
+                                       defaultSat["frequency"] = int(frontendData["frequency"] / 1000)
+                                       defaultSat["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData["inversion"]]
+                                       defaultSat["symbolrate"] = int(frontendData["symbol_rate"] / 1000)
+                                       defaultSat["polarization"] = {"HORIZONTAL": "horizontal", "VERTICAL": "vertical", "CIRCULAR_LEFT": "circular_left", "CIRCULAR_RIGHT": "circular_right", "UNKNOWN": None}[frontendData["polarization"]]
+                                       defaultSat["fec"] = {"DVB-S": {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_NONE": "none"}, "DVB-S2": {"FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_4_5": "4_5", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_9_10": "9_10"}}[frontendData["system"]][frontendData["fec_inner"]]
+                                       defaultSat["modulation"] = {"QPSK": "qpsk", "8PSK": "8psk"}[frontendData["modulation"]]
                                        defaultSat["orbpos"] = frontendData["orbital_position"]
                                elif frontendData["tuner_type"] == "DVB-C":
                                        defaultSat["orbpos"] = frontendData["orbital_position"]
                                elif frontendData["tuner_type"] == "DVB-C":
-                                       defaultCab["frequency"] = [int(frontendData["frequency"] / 1000)]
-                                       defaultCab["symbolrate"] = [int(frontendData["symbol_rate"] / 1000)]
-                                       defaultSat["inversion"] = {"INVERSION_OFF": 0, "INVERSION_ON": 1, "INVERSION_AUTO": 2}[frontendData["inversion"]]
-                                       defaultSat["fec"] = {"FEC_AUTO": 0, "FEC_1_2": 1, "FEC_2_3": 2, "FEC_3_4": 3, "FEC_5_6": 4, "FEC_7_8": 5, "FEC_8_9": 6, "FEC_NONE": 7}[frontendData["fec_inner"]]
-                                       defaultSat["modulation"] = {"QAM_AUTO": 0, "QAM_16": 1, "QAM_16": 2, "QAM_32": 3, "QAM_64": 4, "QAM_128": 5, "QAM_256": 6}[frontendData["modulation"]]
-                                                                               
-                       config.scan = ConfigSubsection()
-                       config.scan.sat = ConfigSubsection()
-                       config.scan.cab = ConfigSubsection()
-                       config.scan.ter = ConfigSubsection()
-
-                       config.scan.type = configElement_nonSave("config.scan.type", configSelection, 0, (("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))))
-                       config.scan.typecable = configElement_nonSave("config.scan.typecable", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete"))))
-                       config.scan.typeterrestrial = configElement_nonSave("config.scan.typeterrestrial", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete"))))
-                       config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))))
+                                       defaultCab["frequency"] = int(frontendData["frequency"] / 1000)
+                                       defaultCab["symbolrate"] = int(frontendData["symbol_rate"] / 1000)
+                                       defaultSat["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData["inversion"]]
+                                       defaultSat["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_NONE": "none"}[frontendData["fec_inner"]]
+                                       defaultSat["modulation"] = {"QAM_AUTO": "auto", "QAM_16": "16qam", "QAM_32": "32qam", "QAM_64": "64qam", "QAM_128": "128qam", "QAM_256": "256qam"}[frontendData["modulation"]]
+
+                       self.scan_sat = ConfigSubsection()
+                       self.scan_cab = ConfigSubsection()
+                       self.scan_ter = ConfigSubsection()
+
+                       self.scan_type = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))])
+                       self.scan_typecable = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
+                       self.scan_typeterrestrial = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
+                       self.scan_clearallservices = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
 
                        nimList = [ ]
                        for nim in nimmanager.nimList():
                                nimList.append(nim[0])
                        #nimList.append("all")
 
                        nimList = [ ]
                        for nim in nimmanager.nimList():
                                nimList.append(nim[0])
                        #nimList.append("all")
-                       config.scan.nims = configElement_nonSave("config.scan.nims", configSelection, 0, nimList)
+                       self.scan_nims = ConfigSelection(choices = nimList)
                        
                        # status
                        
                        # status
-                       config.scan.snr = configElement_nonSave("config.scan.snr", configSlider, 0, (1, 100))
-                       config.scan.snr.enabled = False
-                       config.scan.agc = configElement_nonSave("config.scan.agc", configSlider, 0, (1, 100))
-                       config.scan.agc.enabled = False
-                       config.scan.ber = configElement_nonSave("config.scan.ber", configSlider, 0, (1, 100))
-                       config.scan.ber.enabled = False
+                       self.scan_snr = ConfigSlider()
+                       self.scan_snr.enabled = False
+                       self.scan_agc = ConfigSlider()
+                       self.scan_agc.enabled = False
+                       self.scan_ber = ConfigSlider()
+                       self.scan_ber.enabled = False
 
                        # sat
 
                        # sat
-                       config.scan.sat.system = configElement_nonSave("config.scan.sat.system", configSelection, defaultSat["system"], (("dvb-s", _("DVB-S")), ("dvb-s2", _("DVB-S2"))))
-                       config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, defaultSat["frequency"], configsequencearg.get("INTEGER", (1, 99999)))
-                       config.scan.sat.inversion = configElement_nonSave("config.scan.sat.inversion", configSelection, defaultSat["inversion"], (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
-                       config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, defaultSat["symbolrate"], configsequencearg.get("INTEGER", (1, 99999)))
-                       config.scan.sat.polarization = configElement_nonSave("config.scan.sat.polarization", configSelection, defaultSat["polarization"], (("horizontal", _("horizontal")), ("vertical", _("vertical")),  ("circular_left", _("circular left")), ("circular_right", _("circular right"))))
-                       config.scan.sat.fec = configElement_nonSave("config.scan.sat.fec", configSelection, defaultSat["fec"], (("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("none", _("None"))))
-                       config.scan.sat.fec_s2 = configElement_nonSave("config.scan.sat.fec_s2", configSelection, defaultSat["fec_s2"], (("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("3_5", "3/5"), ("4_5", "4/5"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("9_10", "9/10")))
-                       config.scan.sat.modulation = configElement_nonSave("config.scan.sat.modulation", configSelection, defaultSat["modulation"], (("qpsk", "QPSK"), ("8psk", "8PSK")))
+                       self.scan_sat.system = ConfigSelection(default = defaultSat["system"], choices = [("dvb-s", _("DVB-S")), ("dvb-s2", _("DVB-S2"))])
+                       self.scan_sat.frequency = ConfigInteger(default = defaultSat["frequency"], limits = (1, 99999))
+                       self.scan_sat.inversion = ConfigSelection(default = defaultSat["inversion"], choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
+                       self.scan_sat.symbolrate = ConfigInteger(default = defaultSat["symbolrate"], limits = (1, 99999))
+                       self.scan_sat.polarization = ConfigSelection(default = defaultSat["polarization"], choices = [("horizontal", _("horizontal")), ("vertical", _("vertical")),  ("circular_left", _("circular left")), ("circular_right", _("circular right"))])
+                       self.scan_sat.fec = ConfigSelection(default = defaultSat["fec"], choices = [("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("none", _("None"))])
+                       self.scan_sat.fec_s2 = ConfigSelection(default = defaultSat["fec_s2"], choices = [("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("3_5", "3/5"), ("4_5", "4/5"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("9_10", "9/10")])
+                       self.scan_sat.modulation = ConfigSelection(default = defaultSat["modulation"], choices = [("qpsk", "QPSK"), ("8psk", "8PSK")])
        
                        # cable
        
                        # cable
-                       config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, defaultCab["frequency"], configsequencearg.get("INTEGER", (50, 999)))
-                       config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, defaultCab["inversion"], (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
-                       config.scan.cab.modulation = configElement_nonSave("config.scan.cab.modulation", configSelection, defaultCab["modulation"], (("16qam", "16-QAM"), ("32qam", "32-QAM"), ("64qam", "64-QAM"), ("128qam", "128-QAM"), ("256qam", "256-QAM")))
-                       config.scan.cab.fec = configElement_nonSave("config.scan.cab.fec", configSelection, defaultCab["fec"], (("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("none", _("None"))))
-                       config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, defaultCab["symbolrate"], configsequencearg.get("INTEGER", (1, 9999)))
-                       config.scan.cab.networkScan = configElement_nonSave("config.scan.cab.networkScan", configSelection, 0, (("no", _("no")), ("yes", _("yes"))))
+                       self.scan_cab.frequency = ConfigInteger(default = defaultCab["frequency"], limits = (50, 999))
+                       self.scan_cab.inversion = ConfigSelection(default = defaultCab["inversion"], choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
+                       self.scan_cab.modulation = ConfigSelection(default = defaultCab["modulation"], choices = [("16qam", "16-QAM"), ("32qam", "32-QAM"), ("64qam", "64-QAM"), ("128qam", "128-QAM"), ("256qam", "256-QAM")])
+                       self.scan_cab.fec = ConfigSelection(default = defaultCab["fec"], choices = [("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("none", _("None"))])
+                       self.scan_cab.symbolrate = ConfigInteger(default = defaultCab["symbolrate"], limits = (1, 99999))
+                       self.scan_cab.networkScan = ConfigYesNo(default = False)
 
                        # terrestial
 
                        # terrestial
-                       config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], configsequencearg.get("INTEGER", (100, 900)))
-                       config.scan.ter.inversion = configElement_nonSave("config.scan.ter.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
+                       self.scan_ter.frequency = ConfigInteger(default = 466, limits = (100, 999))
+                       self.scan_ter.inversion = ConfigSelection(default = "auto", choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))])
                        # WORKAROUND: we can't use BW-auto
                        # WORKAROUND: we can't use BW-auto
-                       config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 0, (("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz")))
+                       self.scan_ter.bandwidth = ConfigSelection(default = "8MHz", choices = [("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz")])
                        #, ("auto", _("Auto"))))
                        #, ("auto", _("Auto"))))
-                       config.scan.ter.fechigh = configElement_nonSave("config.scan.ter.fechigh", configSelection, 5, (("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto"))))
-                       config.scan.ter.feclow = configElement_nonSave("config.scan.ter.feclow", configSelection, 5, (("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto"))))
-                       config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 3, (("qpsk", "QPSK"), ("qam16", "QAM16"), ("qam64", "QAM64"), ("auto", _("Auto"))))
-                       config.scan.ter.transmission = configElement_nonSave("config.scan.ter.transmission", configSelection, 2, (("2k", "2K"), ("8k", "8K"), ("auto", _("Auto"))))
-                       config.scan.ter.guard = configElement_nonSave("config.scan.ter.guard", configSelection, 4, (("1_32", "1/32"), ("1_16", "1/16"), ("1_8", "1/8"), ("1_4", "1/4"), ("auto", _("Auto"))))
-                       config.scan.ter.hierarchy = configElement_nonSave("config.scan.ter.hierarchy", configSelection, 4, (("none", _("None")), ("1", "1"), ("2", "2"), ("4", "4"), ("auto", _("Auto"))))
-                       config.scan.ter.networkScan = configElement_nonSave("config.scan.cab.networkScan", configSelection, 0, (("no", _("no")), ("yes", _("yes"))))
-
-                       config.scan.scansat = {}
+                       self.scan_ter.fechigh = ConfigSelection(default = "auto", choices = [("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto"))])
+                       self.scan_ter.feclow = ConfigSelection(default = "auto", choices = [("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto"))])
+                       self.scan_ter.modulation = ConfigSelection(default = "auto", choices = [("qpsk", "QPSK"), ("qam16", "QAM16"), ("qam64", "QAM64"), ("auto", _("Auto"))])
+                       self.scan_ter.transmission = ConfigSelection(default = "auto", choices = [("2k", "2K"), ("8k", "8K"), ("auto", _("Auto"))])
+                       self.scan_ter.guard = ConfigSelection(default = "auto", choices = [("1_32", "1/32"), ("1_16", "1/16"), ("1_8", "1/8"), ("1_4", "1/4"), ("auto", _("Auto"))])
+                       self.scan_ter.hierarchy = ConfigSelection(default = "auto", choices = [("none", _("None")), ("1", "1"), ("2", "2"), ("4", "4"), ("auto", _("Auto"))])
+                       self.scan_ter.networkScan = ConfigYesNo(default = False)
+
+                       self.scan_scansat = {}
                        for sat in nimmanager.satList:
                                #print sat[1]
                        for sat in nimmanager.satList:
                                #print sat[1]
-                               config.scan.scansat[sat[1]] = configElement_nonSave("config.scan.scansat[" + str(sat[1]) + "]", configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
+                               self.scan_scansat[sat[0]] = ConfigYesNo(default = False)
 
 
-                       config.scan.satselection = []
+                       self.scan_satselection = []
                        slotid = 0
                        for slot in nimmanager.nimslots:
                                if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
                                        print str(slot.slotid) + " : " + str(self.satList)
                        slotid = 0
                        for slot in nimmanager.nimslots:
                                if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
                                        print str(slot.slotid) + " : " + str(self.satList)
-                                       config.scan.satselection.append(configElement_nonSave("config.scan.satselection[" + str(slot.slotid) + "]", configSatlist, defaultSat["orbpos"], self.satList[slot.slotid]))
+                                       self.scan_satselection.append(ConfigSatlist(default = defaultSat["orbpos"], list = self.satList[slot.slotid]))
                                else:
                                else:
-                                       config.scan.satselection.append(None)
+                                       self.scan_satselection.append(None)
+
        def keyLeft(self):
        def keyLeft(self):
-               self["config"].handleKey(config.key["prevElement"])
+               ConfigListScreen.keyLeft(self)
                self.newConfig()
 
        def keyRight(self):
                self.newConfig()
 
        def keyRight(self):
-               self["config"].handleKey(config.key["nextElement"])
+               ConfigListScreen.keyRight(self)
                self.newConfig()
 
        def updateStatus(self):
                print "updatestatus"
 
                self.newConfig()
 
        def updateStatus(self):
                print "updatestatus"
 
-       def keyNumberGlobal(self, number):
-               print "You pressed number " + str(number)
-               if (self["config"].getCurrent()[1].parent.enabled == True):
-                       self["config"].handleKey(config.key[str(number)])
-
        fecmap = { "auto": 0,
                           "1_2": 1,
                           "2_3": 2,
        fecmap = { "auto": 0,
                           "1_2": 1,
                           "2_3": 2,
@@ -466,91 +448,91 @@ class ScanSetup(Screen):
        def keyGo(self):
                tlist = []
                flags = 0
        def keyGo(self):
                tlist = []
                flags = 0
-               if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
-                       if currentConfigSelectionElement(config.scan.type) == "single_transponder":
+               if nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-S"]:
+                       if self.scan_type.value == "single_transponder":
                                l = len(self.satList)
                                l = len(self.satList)
-                               if l and l > config.scan.nims.value:
-                                       nimsats=self.satList[config.scan.nims.value]
-                                       l = len(config.scan.satselection)
-                                       if l and l > config.scan.nims.value:
-                                               selsatidx=config.scan.satselection[config.scan.nims.value].value
+                               if l and l > self.scan_nims.index:
+                                       nimsats=self.satList[self.scan_nims.index]
+                                       l = len(self.scan_satselection)
+                                       if l and l > self.scan_nims.index:
+                                               selsatidx=self.scan_satselection[self.scan_nims.index].index
                                                l = len(nimsats)
                                                if l and l > selsatidx:
                                                l = len(nimsats)
                                                if l and l > selsatidx:
-                                                       orbpos=nimsats[selsatidx][1]
-                                                       if currentConfigSelectionElement(config.scan.sat.system) == "dvb-s":
-                                                               fec = currentConfigSelectionElement(config.scan.sat.fec)
+                                                       orbpos=nimsats[selsatidx][0]
+                                                       if self.scan_sat.system.value == "dvb-s":
+                                                               fec = self.scan_sat.fec.value
                                                        else:
                                                        else:
-                                                               fec = currentConfigSelectionElement(config.scan.sat.fec_s2)
-                                                       self.addSatTransponder(tlist, config.scan.sat.frequency.value[0],
-                                                                               config.scan.sat.symbolrate.value[0],
-                                                                               config.scan.sat.polarization.value,
+                                                               fec = self.scan_sat.fec_s2.value
+                                                       self.addSatTransponder(tlist, self.scan_sat.frequency.value,
+                                                                               self.scan_sat.symbolrate.value,
+                                                                               self.scan_sat.polarization.index,
                                                                                fec,
                                                                                fec,
-                                                                               config.scan.sat.inversion.value,
+                                                                               self.scan_sat.inversion.index,
                                                                                orbpos,
                                                                                orbpos,
-                                                                               config.scan.sat.system.value,
-                                                                               config.scan.sat.modulation.value)
-                       elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
-                               sat = self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value]
-                               getInitialTransponderList(tlist, int(sat[1]))
+                                                                               self.scan_sat.system.index,
+                                                                               self.scan_sat.modulation.index)
+                       elif self.scan_type.value == "single_satellite":
+                               sat = self.satList[self.scan_nims.index][self.scan_satselection[self.scan_nims.index].index]
+                               getInitialTransponderList(tlist, sat[0])
                                flags |= eComponentScan.scanNetworkSearch
                                flags |= eComponentScan.scanNetworkSearch
-                               tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                               tmp = self.scan_clearallservices.value
                                if tmp == "yes":
                                        flags |= eComponentScan.scanRemoveServices
                                elif tmp == "yes_hold_feeds":
                                        flags |= eComponentScan.scanRemoveServices
                                        flags |= eComponentScan.scanDontRemoveFeeds
                                if tmp == "yes":
                                        flags |= eComponentScan.scanRemoveServices
                                elif tmp == "yes_hold_feeds":
                                        flags |= eComponentScan.scanRemoveServices
                                        flags |= eComponentScan.scanDontRemoveFeeds
-                       elif currentConfigSelectionElement(config.scan.type) == "multisat":
-                               SatList = nimmanager.getSatListForNim(config.scan.nims.value)
+                       elif self.scan_type.value == "multisat":
+                               SatList = nimmanager.getSatListForNim(self.scan_nims.index)
                                for x in self.multiscanlist:
                                for x in self.multiscanlist:
-                                       if x[1].parent.value == 0:
-                                               print "   " + str(x[1].parent.configPath)
-                                               getInitialTransponderList(tlist, x[1].parent.configPath)
+                                       if x[1].value:
+                                               print "   " + str(x[0])
+                                               getInitialTransponderList(tlist, x[0])
                                flags |= eComponentScan.scanNetworkSearch
                                flags |= eComponentScan.scanNetworkSearch
-                               tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                               tmp = self.scan_clearallservices.value
                                if tmp == "yes":
                                        flags |= eComponentScan.scanRemoveServices
                                elif tmp == "yes_hold_feeds":
                                        flags |= eComponentScan.scanRemoveServices
                                        flags |= eComponentScan.scanDontRemoveFeeds
 
                                if tmp == "yes":
                                        flags |= eComponentScan.scanRemoveServices
                                elif tmp == "yes_hold_feeds":
                                        flags |= eComponentScan.scanRemoveServices
                                        flags |= eComponentScan.scanDontRemoveFeeds
 
-               elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
-                       if currentConfigSelectionElement(config.scan.typecable) == "single_transponder":
-                               fec = currentConfigSelectionElement(config.scan.cab.fec)
-                               self.addCabTransponder(tlist, config.scan.cab.frequency.value[0],
-                                                                                         config.scan.cab.symbolrate.value[0],
-                                                                                         config.scan.cab.modulation.value + 1,
+               elif (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-C"]):
+                       if self.scan_typecable.value == "single_transponder":
+                               fec = self.scan_cab.fec.value
+                               self.addCabTransponder(tlist, self.scan_cab.frequency.value,
+                                                                                         self.scan_cab.symbolrate.value,
+                                                                                         self.scan_cab.modulation.index + 1,
                                                                                          fec,
                                                                                          fec,
-                                                                                         config.scan.cab.inversion.value)
-                               if currentConfigSelectionElement(config.scan.cab.networkScan) == "yes":
+                                                                                         self.scan_cab.inversion.index)
+                               if self.scan_cab.networkScan.value:
                                        flags |= eComponentScan.scanNetworkSearch
                                        flags |= eComponentScan.scanNetworkSearch
-                       elif currentConfigSelectionElement(config.scan.typecable) == "complete":
-                               getInitialCableTransponderList(tlist, nimmanager.getCableDescription(config.scan.nims.value))
+                       elif self.scan_typecable.value == "complete":
+                               getInitialCableTransponderList(tlist, nimmanager.getCableDescription(self.scan_nims.index))
                                flags |= eComponentScan.scanNetworkSearch
                                flags |= eComponentScan.scanNetworkSearch
-                               tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                               tmp = self.scan_clearallservices
                                if tmp == "yes":
                                        flags |= eComponentScan.scanRemoveServices
                                elif tmp == "yes_hold_feeds":
                                        flags |= eComponentScan.scanRemoveServices
                                        flags |= eComponentScan.scanDontRemoveFeeds
 
                                if tmp == "yes":
                                        flags |= eComponentScan.scanRemoveServices
                                elif tmp == "yes_hold_feeds":
                                        flags |= eComponentScan.scanRemoveServices
                                        flags |= eComponentScan.scanDontRemoveFeeds
 
-               elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
-                       if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
+               elif (nimmanager.getNimType(self.scan_nims.index) == nimmanager.nimType["DVB-T"]):
+                       if self.scan_typeterrestrial.value == "single_transponder":
                                self.addTerTransponder(tlist,
                                self.addTerTransponder(tlist,
-                                               config.scan.ter.frequency.value[0] * 1000000,
-                                               inversion = config.scan.ter.inversion.value,
-                                               bandwidth = config.scan.ter.bandwidth.value,
-                                               fechigh = config.scan.ter.fechigh.value,
-                                               feclow = config.scan.ter.feclow.value,
-                                               modulation = config.scan.ter.modulation.value,
-                                               transmission = config.scan.ter.transmission.value,
-                                               guard = config.scan.ter.guard.value,
-                                               hierarchy = config.scan.ter.hierarchy.value)
-                               if currentConfigSelectionElement(config.scan.ter.networkScan) == "yes":
+                                               self.scan_ter.frequency.value * 1000000,
+                                               inversion = self.scan_ter.inversion.index,
+                                               bandwidth = self.scan_ter.bandwidth.index,
+                                               fechigh = self.scan_ter.fechigh.index,
+                                               feclow = self.scan_ter.feclow.index,
+                                               modulation = self.scan_ter.modulation.index,
+                                               transmission = self.scan_ter.transmission.index,
+                                               guard = self.scan_ter.guard.index,
+                                               hierarchy = self.scan_ter.hierarchy.index)
+                               if self.scan_ter.networkScan.value:
                                        flags |= eComponentScan.scanNetworkSearch
                                        flags |= eComponentScan.scanNetworkSearch
-                       elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
-                               getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(config.scan.nims.value))
+                       elif self.scan_typeterrestrial.value == "complete":
+                               getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(self.scan_nims.index))
                                flags |= eComponentScan.scanNetworkSearch
                                flags |= eComponentScan.scanNetworkSearch
-                               tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                               tmp = self.scan_clearallservices.value
                                if tmp == "yes":
                                        flags |= eComponentScan.scanRemoveServices
                                elif tmp == "yes_hold_feeds":
                                if tmp == "yes":
                                        flags |= eComponentScan.scanRemoveServices
                                elif tmp == "yes_hold_feeds":
@@ -561,7 +543,7 @@ class ScanSetup(Screen):
                        x[1].save()
 
                if len(tlist):
                        x[1].save()
 
                if len(tlist):
-                       feid = config.scan.nims.value
+                       feid = self.scan_nims.index
                        # flags |= eComponentScan.scanSearchBAT
                        self.session.openWithCallback(self.doNothing, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
                else:
                        # flags |= eComponentScan.scanSearchBAT
                        self.session.openWithCallback(self.doNothing, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
                else:
@@ -575,7 +557,41 @@ class ScanSetup(Screen):
                        x[1].cancel()
                self.close()
 
                        x[1].cancel()
                self.close()
 
-class ScanSimple(Screen):
+class ScanSimple(ConfigListScreen, Screen):
+       def __init__(self, session):
+               Screen.__init__(self, session)
+
+               self["actions"] = ActionMap(["SetupActions"],
+               {
+                       "ok": self.keyGo,
+                       "cancel": self.keyCancel,
+               }, -1)
+
+               self.list = []
+               tlist = []
+
+               nimcount = nimmanager.getNimSocketCount()
+               if nimcount > 0:
+                       nimtype = nimmanager.getNimType(0)
+                       scan_possible=True
+                       self.scan_clearallservices = ConfigSelection(default = "yes", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
+                       self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
+                       nim = ConfigYesNo(default = True)
+                       nim.nim_index = 0
+                       if nimtype == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)):
+                               scan_possible=False
+                       if scan_possible:
+                               self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim))
+
+               if nimcount > 1 and self.ScanNimTwoNeeded():
+                       nim = ConfigYesNo(default = True)
+                       nim.nim_index = 1
+                       self.list.append(getConfigListEntry(_("Scan NIM") + " 1 (" + nimmanager.getNimTypeName(1) + ")", nim))
+
+               ConfigListScreen.__init__(self, self.list)
+               self["header"] = Label(_("Automatic Scan"))
+               self["footer"] = Label(_("Press OK to scan"))
+
        def run(self):
                self.keyGo()
 
        def run(self):
                self.keyGo()
 
@@ -592,13 +608,14 @@ class ScanSimple(Screen):
                else:
                        two_sat_tuners = False
 
                else:
                        two_sat_tuners = False
 
-               for x in self.list:
-                       slotid = x[1].parent.configPath
-                       print "Scan Tuner", slotid, "-", currentConfigSelectionElement(x[1].parent)
-                       if currentConfigSelectionElement(x[1].parent) == "yes":
+               for (x, c) in self.list[1:]:
+                       slotid = c.nim_index
+                       print "Scan Tuner", slotid, "-", c.value
+                       if c.value:
                                scanPossible = False
                                tlist = [ ]
                                scanPossible = False
                                tlist = [ ]
-                               if nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-S"]:
+                               if nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-S"]:
+                                       print "is sat"
                                        if two_sat_tuners:
                                                if slotid > 0:
                                                        idx = exclusive_satellites[0]+1
                                        if two_sat_tuners:
                                                if slotid > 0:
                                                        idx = exclusive_satellites[0]+1
@@ -608,19 +625,22 @@ class ScanSimple(Screen):
                                                print "exclusive_nim_sats", exclusive_nim_sats
                                        SatList = nimmanager.getSatListForNim(slotid)
                                        for sat in SatList:
                                                print "exclusive_nim_sats", exclusive_nim_sats
                                        SatList = nimmanager.getSatListForNim(slotid)
                                        for sat in SatList:
-                                               if not two_sat_tuners or (sat[1] in exclusive_nim_sats or slotid == 0):
+                                               if not two_sat_tuners or (sat[0] in exclusive_nim_sats or slotid == 0):
                                                        scanPossible = True
                                                        print sat
                                                        scanPossible = True
                                                        print sat
-                                                       getInitialTransponderList(tlist, sat[1])
-                               elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-C"]:
+                                                       getInitialTransponderList(tlist, sat[0])
+                               elif nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-C"]:
                                        scanPossible = True
                                        getInitialCableTransponderList(tlist, nimmanager.getCableDescription(slotid))
                                        scanPossible = True
                                        getInitialCableTransponderList(tlist, nimmanager.getCableDescription(slotid))
-                               elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-T"]:
+                               elif nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-T"]:
                                        scanPossible = True
                                        getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid))
                                        scanPossible = True
                                        getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid))
+                               else:
+                                       assert False
+
                                if scanPossible:
                                        flags=eComponentScan.scanNetworkSearch
                                if scanPossible:
                                        flags=eComponentScan.scanNetworkSearch
-                                       tmp = currentConfigSelectionElement(config.scan.clearallservices)
+                                       tmp = self.scan_clearallservices.value
                                        if tmp == "yes":
                                                flags |= eComponentScan.scanRemoveServices
                                        elif tmp == "yes_hold_feeds":
                                        if tmp == "yes":
                                                flags |= eComponentScan.scanRemoveServices
                                        elif tmp == "yes_hold_feeds":
@@ -638,12 +658,6 @@ class ScanSimple(Screen):
        def keyCancel(self):
                self.close()
 
        def keyCancel(self):
                self.close()
 
-       def keyLeft(self):
-               self["config"].handleKey(config.key["prevElement"])
-
-       def keyRight(self):
-               self["config"].handleKey(config.key["nextElement"])
-
        def Satexists(self, tlist, pos):
                for x in tlist:
                        if x == pos:
        def Satexists(self, tlist, pos):
                for x in tlist:
                        if x == pos:
@@ -667,37 +681,3 @@ class ScanSimple(Screen):
                                        return True
                return False # two -C or two -T tuners
 
                                        return True
                return False # two -C or two -T tuners
 
-       def __init__(self, session):
-               Screen.__init__(self, session)
-
-               self["actions"] = ActionMap(["SetupActions"],
-               {
-                       "ok": self.keyGo,
-                       "cancel": self.keyCancel,
-                       "left": self.keyLeft,
-                       "right": self.keyRight,
-               }, -1)
-
-               self.list = []
-               tlist = []
-
-               nimcount = nimmanager.getNimSocketCount()
-               if nimcount > 0:
-                       nimtype = nimmanager.getNimType(0)
-                       scan_possible=True
-                       config.scan = ConfigSubsection()
-                       config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))))
-                       self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
-                       nim = configElement_nonSave(0, configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
-                       if nimtype == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)):
-                               scan_possible=False
-                       if scan_possible:
-                               self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim))
-       
-               if nimcount > 1 and self.ScanNimTwoNeeded():
-                       nim = configElement_nonSave(1, configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
-                       self.list.append(getConfigListEntry(_("Scan NIM") + " 1 (" + nimmanager.getNimTypeName(1) + ")", nim))
-
-               self["config"] = ConfigList(self.list)
-               self["header"] = Label(_("Automatic Scan"))
-               self["footer"] = Label(_("Press OK to scan"))
index 746c26d304af5bf78ad7f50d87ac1d889230c3d7..b36a6b4541480b4503c1f5e62a76d6bf590f262b 100644 (file)
@@ -1,8 +1,7 @@
 from Screen import Screen
 from Components.ActionMap import NumberActionMap
 from Screen import Screen
 from Components.ActionMap import NumberActionMap
-from Components.config import config                           #global config instance
-from Components.config import configSelection
-from Components.ConfigList import ConfigList
+from Components.config import config, KEY_LEFT, KEY_RIGHT, KEY_OK
+from Components.ConfigList import ConfigList, ConfigListScreen
 from Components.Label import Label
 from Components.Pixmap import Pixmap
 
 from Components.Label import Label
 from Components.Pixmap import Pixmap
 
@@ -25,10 +24,10 @@ setupfile.close()
 
 class SetupSummary(Screen):
        skin = """
 
 class SetupSummary(Screen):
        skin = """
-       <screen position="0,0" size="132,64">
-               <widget name="SetupTitle" position="0,0" size="132,16" font="Regular;12" />
-               <widget name="SetupEntry" position="0,16" size="132,32" font="Regular;12" />
-               <widget name="SetupValue" position="0,48" size="132,16" font="Regular;12" />
+       <screen position="6,0" size="120,64">
+               <widget name="SetupTitle" position="6,0" size="120,16" font="Regular;12" />
+               <widget name="SetupEntry" position="6,16" size="120,32" font="Regular;12" />
+               <widget name="SetupValue" position="6,48" size="120,16" font="Regular;12" />
        </screen>"""
 
        def __init__(self, session, parent):
        </screen>"""
 
        def __init__(self, session, parent):
@@ -53,7 +52,7 @@ class SetupSummary(Screen):
                self["SetupEntry"].text = self.parent.getCurrentEntry()
                self["SetupValue"].text = self.parent.getCurrentValue()
 
                self["SetupEntry"].text = self.parent.getCurrentEntry()
                self["SetupValue"].text = self.parent.getCurrentValue()
 
-class Setup(Screen):
+class Setup(ConfigListScreen, Screen):
 
        ALLOW_SUSPEND = True
 
 
        ALLOW_SUSPEND = True
 
@@ -78,8 +77,6 @@ class Setup(Screen):
 
                #check for list.entries > 0 else self.close
                
 
                #check for list.entries > 0 else self.close
                
-               self["config"] = ConfigList(list)
-
                self.setup_title = myTitle
                self["title"] = Label(_(self.setup_title))
 
                self.setup_title = myTitle
                self["title"] = Label(_(self.setup_title))
 
@@ -91,22 +88,11 @@ class Setup(Screen):
                self["actions"] = NumberActionMap(["SetupActions"], 
                        {
                                "cancel": self.keyCancel,
                self["actions"] = NumberActionMap(["SetupActions"], 
                        {
                                "cancel": self.keyCancel,
-                               "ok": self.keyOk,
-                               "left": self.keyLeft,
-                               "right": self.keyRight,
                                "save": self.keySave,
                                "save": self.keySave,
-                               "1": self.keyNumberGlobal,
-                               "2": self.keyNumberGlobal,
-                               "3": self.keyNumberGlobal,
-                               "4": self.keyNumberGlobal,
-                               "5": self.keyNumberGlobal,
-                               "6": self.keyNumberGlobal,
-                               "7": self.keyNumberGlobal,
-                               "8": self.keyNumberGlobal,
-                               "9": self.keyNumberGlobal,
-                               "0": self.keyNumberGlobal
                        }, -1)
 
                        }, -1)
 
+               ConfigListScreen.__init__(self, list, session = session)
+
                self.changedEntry()
 
        # for summary:
                self.changedEntry()
 
        # for summary:
@@ -118,7 +104,7 @@ class Setup(Screen):
                return self["config"].getCurrent()[0]
 
        def getCurrentValue(self):
                return self["config"].getCurrent()[0]
 
        def getCurrentValue(self):
-               return str(self["config"].getCurrent()[1].parent.value)
+               return str(self["config"].getCurrent()[1].value)
 
        def createSummary(self):
                return SetupSummary
 
        def createSummary(self):
                return SetupSummary
@@ -130,32 +116,14 @@ class Setup(Screen):
                        elif x.tagName == 'item':
                                item_text = _(x.getAttribute("text").encode("UTF-8") or "??")
                                b = eval(XMLTools.mergeText(x.childNodes));
                        elif x.tagName == 'item':
                                item_text = _(x.getAttribute("text").encode("UTF-8") or "??")
                                b = eval(XMLTools.mergeText(x.childNodes));
-                               print "item " + item_text + " " + b.configPath
                                if b == "":
                                        continue
                                #add to configlist
                                if b == "":
                                        continue
                                #add to configlist
-                               item = b.controlType(b)
-                               
+                               item = b
                                # the first b is the item itself, ignored by the configList.
                                # the second one is converted to string.
                                list.append( (item_text, item) )
 
                                # the first b is the item itself, ignored by the configList.
                                # the second one is converted to string.
                                list.append( (item_text, item) )
 
-       def handleKey(self, key):
-               # ignore keys when not enabled
-               if self["config"].getCurrent()[1].parent.enabled:
-                       self["config"].handleKey(config.key[key])
-                       print self["config"].getCurrent()
-                       self.changedEntry()
-
-       def keyOk(self):
-               self.handleKey("choseElement")
-
-       def keyLeft(self):
-               self.handleKey("prevElement")
-
-       def keyRight(self):
-               self.handleKey("nextElement")
-
        def keySave(self):
                print "save requested"
                for x in self["config"].list:
        def keySave(self):
                print "save requested"
                for x in self["config"].list:
@@ -168,9 +136,6 @@ class Setup(Screen):
                        x[1].cancel()
                self.close()
                
                        x[1].cancel()
                self.close()
                
-       def keyNumberGlobal(self, number):
-               self.handleKey(str(number))
-
 def getSetupTitle(id):
        xmldata = setupdom.childNodes[0].childNodes
        for x in elementsWithTag(xmldata, "setup"):
 def getSetupTitle(id):
        xmldata = setupdom.childNodes[0].childNodes
        for x in elementsWithTag(xmldata, "setup"):
index f4502a7628bdea84d5a2f3dce951ba9e05adb1cb..1a5fe88752e3eac93c602789b8213a57837d8cfc 100644 (file)
@@ -4,10 +4,10 @@ from Components.Sources.Clock import Clock
 class SimpleSummary(Screen):
        skin = """
        <screen position="0,0" size="132,64">
 class SimpleSummary(Screen):
        skin = """
        <screen position="0,0" size="132,64">
-               <widget name="Clock" position="50,46" size="82,18" font="Regular;16">
+               <widget name="Clock" position="56,46" size="82,18" font="Regular;16">
                        <convert type="ClockToText">WithSeconds</convert>
                </widget>
                        <convert type="ClockToText">WithSeconds</convert>
                </widget>
-               <widget name="Title" position="0,4" size="132,42" font="Regular;18" />
+               <widget name="Title" position="6,4" size="120,42" font="Regular;18" />
        </screen>"""
        def __init__(self, session, root_screen):
                from Components.Label import Label
        </screen>"""
        def __init__(self, session, root_screen):
                from Components.Label import Label
index 8fc4ecdfddddb790521e0fe4ef103067d9a85de9..b67ca9d47a76f789819e13aff9455d9c35b32529 100644 (file)
@@ -1,12 +1,12 @@
 from Wizard import Wizard, wizardManager
 
 from Components.Pixmap import *
 from Wizard import Wizard, wizardManager
 
 from Components.Pixmap import *
-from Components.config import configElementBoolean, config, configfile
+from Components.config import config, ConfigBoolean, configfile
 
 from LanguageSelection import LanguageSelection
 
 
 from LanguageSelection import LanguageSelection
 
-config.misc.firstrun = configElementBoolean("config.misc.firstrun", 1);
-config.misc.languageselected = configElementBoolean("config.misc.languageselected", 1);
+config.misc.firstrun = ConfigBoolean(default = True)
+config.misc.languageselected = ConfigBoolean(default = True)
 
 class StartWizard(Wizard):
        skin = """
 
 class StartWizard(Wizard):
        skin = """
index 4ea67b74619e60adc143ba55d7c4e1bdf7470a2f..c7a66641fdd8d1c0cdc674e985b57078318236be 100644 (file)
@@ -1,14 +1,14 @@
 from Screen import Screen
 from Components.config import *
 from Components.ActionMap import ActionMap, NumberActionMap
 from Screen import Screen
 from Components.config import *
 from Components.ActionMap import ActionMap, NumberActionMap
-from Components.ConfigList import ConfigList
+from Components.ConfigList import ConfigList, ConfigListScreen
 from Components.Button import Button
 from Components.Label import Label
 from Components.Pixmap import Pixmap
 import time
 import datetime
 
 from Components.Button import Button
 from Components.Label import Label
 from Components.Pixmap import Pixmap
 import time
 import datetime
 
-class TimeDateInput(Screen):
+class TimeDateInput(Screen, ConfigListScreen):
        def __init__(self, session):
                Screen.__init__(self, session)
 
        def __init__(self, session):
                Screen.__init__(self, session)
 
@@ -19,35 +19,22 @@ class TimeDateInput(Screen):
 
                self.createConfig()
 
 
                self.createConfig()
 
-               self["actions"] = NumberActionMap(["SetupActions", "TextEntryActions"],
+               self["actions"] = NumberActionMap(["SetupActions"],
                {
                        "ok": self.keySelect,
                        "save": self.keyGo,
                        "cancel": self.keyCancel,
                {
                        "ok": self.keySelect,
                        "save": self.keyGo,
                        "cancel": self.keyCancel,
-                       "left": self.keyLeft,
-                       "right": self.keyRight,
-                       "delete": self.keyDelete,
-                       "1": self.keyNumberGlobal,
-                       "2": self.keyNumberGlobal,
-                       "3": self.keyNumberGlobal,
-                       "4": self.keyNumberGlobal,
-                       "5": self.keyNumberGlobal,
-                       "6": self.keyNumberGlobal,
-                       "7": self.keyNumberGlobal,
-                       "8": self.keyNumberGlobal,
-                       "9": self.keyNumberGlobal,
-                       "0": self.keyNumberGlobal
                }, -1)
 
                self.list = []
                }, -1)
 
                self.list = []
-               self["config"] = ConfigList(self.list)
+               ConfigListScreen.__init__(self, self.list)
                self.createSetup(self["config"])
 
        def createConfig(self):
                self.createSetup(self["config"])
 
        def createConfig(self):
-                       config.timeinput = ConfigSubsection()
-                       nowtime = time.time()
-                       config.timeinput.date = configElement_nonSave("config.timeinput.date", configDateTime, nowtime, (_("%d.%B %Y"), 86400))
-                       config.timeinput.time = configElement_nonSave("config.timeinput.time", configSequence, [int(time.strftime("%H", time.localtime(nowtime))), int(time.strftime("%M", time.localtime(nowtime)))], configsequencearg.get("CLOCK"))
+               nowtime = time.time()
+               self.timeinput_date = ConfigDateTime(default = nowtime, formatstring = (_("%d.%B %Y"), 86400))
+#              self.timeinput_time = ConfigSequence(default = [int(time.strftime("%H", time.localtime(nowtime))), int(time.strftime("%M", time.localtime(nowtime)))]
+               assert False, "fixme"
 
        def createSetup(self, configlist):
                self.list = []
 
        def createSetup(self, configlist):
                self.list = []
@@ -56,29 +43,15 @@ class TimeDateInput(Screen):
                configlist.list = self.list
                configlist.l.setList(self.list)
 
                configlist.list = self.list
                configlist.l.setList(self.list)
 
-       def keyLeft(self):
-               self["config"].handleKey(config.key["prevElement"])
-
-       def keyDelete(self):
-               self["config"].handleKey(config.key["delete"])
-
        def keyRightCallback(self, configPath):
                currentConfigPath = self["config"].getCurrent()[1].parent.getConfigPath()
                # check if we are still on the same config entry
                if (currentConfigPath == configPath):
                        self.keyRight()
 
        def keyRightCallback(self, configPath):
                currentConfigPath = self["config"].getCurrent()[1].parent.getConfigPath()
                # check if we are still on the same config entry
                if (currentConfigPath == configPath):
                        self.keyRight()
 
-       def keyRight(self):
-               self["config"].handleKey(config.key["nextElement"])
-
        def keySelect(self):
                self.keyGo()
 
        def keySelect(self):
                self.keyGo()
 
-       def keyNumberGlobal(self, number):
-               print "You pressed number " + str(number)
-               if (self["config"].getCurrent()[1].parent.enabled == True):
-                       self["config"].handleKey(config.key[str(number)])
-
        def getTimestamp(self, date, mytime):
                d = time.localtime(date)
                dt = datetime.datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1])
        def getTimestamp(self, date, mytime):
                d = time.localtime(date)
                dt = datetime.datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1])
index 4a4185c31758e1b28172520a692739efcb0b3664..ed11874e6a0999d32fbfd34f6b43702d42de6787 100644 (file)
@@ -1,6 +1,5 @@
 from Screen import Screen
 from Components.TimerList import TimerList, TimerEntryComponent
 from Screen import Screen
 from Components.TimerList import TimerList, TimerEntryComponent
-from Components.ConfigList import ConfigList
 from Components.MenuList import MenuList
 from Components.ActionMap import ActionMap
 from Components.Label import Label
 from Components.MenuList import MenuList
 from Components.ActionMap import ActionMap
 from Components.Label import Label
@@ -10,7 +9,6 @@ from TimerEntry import TimerEntry, TimerLog
 from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT
 from time import *
 from ServiceReference import ServiceReference
 from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT
 from time import *
 from ServiceReference import ServiceReference
-from Components.config import *
 from Components.TimerSanityCheck import TimerSanityCheck
 
 class TimerEditList(Screen):
 from Components.TimerSanityCheck import TimerSanityCheck
 
 class TimerEditList(Screen):
index 85f41fb2bfb43815c363e407b45c66ab61299009..fa75b5c0963c6b7d8bf62e06aa87e2933d55eb11 100644 (file)
@@ -1,9 +1,9 @@
 from Screen import Screen
 import ChannelSelection
 from ServiceReference import ServiceReference
 from Screen import Screen
 import ChannelSelection
 from ServiceReference import ServiceReference
-from Components.config import *
+from Components.config import ConfigSelection, ConfigText, ConfigSubList, ConfigSubsection, ConfigDateTime, ConfigClock, ConfigYesNo, getConfigListEntry
 from Components.ActionMap import ActionMap, NumberActionMap
 from Components.ActionMap import ActionMap, NumberActionMap
-from Components.ConfigList import ConfigList
+from Components.ConfigList import ConfigList, ConfigListScreen
 from Components.MenuList import MenuList
 from Components.Button import Button
 from Components.NimManager import nimmanager
 from Components.MenuList import MenuList
 from Components.Button import Button
 from Components.NimManager import nimmanager
@@ -16,7 +16,7 @@ from enigma import eEPGCache
 import time
 import datetime
 
 import time
 import datetime
 
-class TimerEntry(Screen):
+class TimerEntry(Screen, ConfigListScreen):
        def __init__(self, session, timer):
                Screen.__init__(self, session)
                self.timer = timer
        def __init__(self, session, timer):
                Screen.__init__(self, session)
                self.timer = timer
@@ -28,93 +28,76 @@ class TimerEntry(Screen):
 
                self.createConfig()
 
 
                self.createConfig()
 
-               self["actions"] = NumberActionMap(["SetupActions", "TextEntryActions"],
+               self["actions"] = NumberActionMap(["SetupActions"],
                {
                        "ok": self.keySelect,
                        "save": self.keyGo,
                        "cancel": self.keyCancel,
                {
                        "ok": self.keySelect,
                        "save": self.keyGo,
                        "cancel": self.keyCancel,
-                       "left": self.keyLeft,
-                       "right": self.keyRight,
-                       "delete": self.keyDelete,
-                       "1": self.keyNumberGlobal,
-                       "2": self.keyNumberGlobal,
-                       "3": self.keyNumberGlobal,
-                       "4": self.keyNumberGlobal,
-                       "5": self.keyNumberGlobal,
-                       "6": self.keyNumberGlobal,
-                       "7": self.keyNumberGlobal,
-                       "8": self.keyNumberGlobal,
-                       "9": self.keyNumberGlobal,
-                       "0": self.keyNumberGlobal
                }, -1)
 
                self.list = []
                }, -1)
 
                self.list = []
-               self["config"] = ConfigList(self.list)
+               ConfigListScreen.__init__(self, self.list, session = session)
                self.createSetup("config")
 
        def createConfig(self):
                self.createSetup("config")
 
        def createConfig(self):
-                       config.timerentry = ConfigSubsection()
-                       
-                       if (self.timer.justplay):
-                               justplay = 0
-                       else:
-                               justplay = 1
+                       justplay = self.timer.justplay
                                
                                
-                       afterevent = { AFTEREVENT.NONE: 0, AFTEREVENT.DEEPSTANDBY: 1, AFTEREVENT.STANDBY: 2}[self.timer.afterEvent]
+                       afterevent = { AFTEREVENT.NONE: "nothing", AFTEREVENT.DEEPSTANDBY: "deepstandby", AFTEREVENT.STANDBY: "standby"}[self.timer.afterEvent]
+                       
+                       weekday_table = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]
 
                        # calculate default values
                        day = []
                        weekday = 0
                        for x in range(0,7):
 
                        # calculate default values
                        day = []
                        weekday = 0
                        for x in range(0,7):
-                               day.append(1)
-                       if (self.timer.repeated != 0): # repeated
-                               type = 1 # repeated
+                               day.append(0)
+                       if self.timer.repeated: # repeated
+                               type = "repeated"
                                if (self.timer.repeated == 31): # Mon-Fri
                                if (self.timer.repeated == 31): # Mon-Fri
-                                       repeated = 2 # Mon - Fri
+                                       repeated = "weekdays"
                                elif (self.timer.repeated == 127): # daily
                                elif (self.timer.repeated == 127): # daily
-                                       repeated = 0 # daily
+                                       repeated = "daily"
                                else:
                                        flags = self.timer.repeated
                                else:
                                        flags = self.timer.repeated
-                                       repeated = 3 # user defined
+                                       repeated = "user"
                                        count = 0
                                        for x in range(0, 7):
                                        count = 0
                                        for x in range(0, 7):
-                                               if (flags == 1): # weekly
+                                               if flags == 1: # weekly
                                                        print "Set to weekday " + str(x)
                                                        weekday = x
                                                        print "Set to weekday " + str(x)
                                                        weekday = x
-                                               if (flags & 1 == 1): # set user defined flags
-                                                       day[x] = 0
+                                               if flags & 1 == 1: # set user defined flags
+                                                       day[x] = 1
                                                        count += 1
                                                else:
                                                        count += 1
                                                else:
-                                                       day[x] = 1
+                                                       day[x] = 0
                                                flags = flags >> 1
                                                flags = flags >> 1
-                                       if (count == 1):
-                                               repeated = 1 # weekly
+                                       if count == 1:
+                                               repeated = "weekly"
                        else: # once
                        else: # once
-                               type = 0
-                               repeated = 0
-                               weekday = (int(strftime("%w", time.localtime(self.timer.begin))) - 1) % 7
-                               day[weekday] = 0
+                               type = "once"
+                               repeated = None
+                               weekday = (int(time.strftime("%w", time.localtime(self.timer.begin))) - 1) % 7
+                               day[weekday] = 1
                        
                        
-                       config.timerentry.justplay = configElement_nonSave("config.timerentry.justplay", configSelection, justplay, (("zap", _("zap")), ("record", _("record"))))
-                       config.timerentry.afterevent = configElement_nonSave("config.timerentry.afterevent", configSelection, afterevent, (("nothing", _("do nothing")), ("deepstandby", _("go to deep standby"))))
-                       config.timerentry.type = configElement_nonSave("config.timerentry.type", configSelection, type, (_("once"), _("repeated")))
-                       config.timerentry.name = configElement_nonSave("config.timerentry.name", configText, self.timer.name, (configText.extendableSize, self.keyRightCallback))
-                       config.timerentry.description = configElement_nonSave("config.timerentry.description", configText, self.timer.description, (configText.extendableSize, self.keyRightCallback))
+                       self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "record"}[justplay])
+                       self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("deepstandby", _("go to deep standby"))], default = afterevent)
+                       self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
+                       self.timerentry_name = ConfigText(default = self.timer.name, fixed_size = False)
+                       self.timerentry_description = ConfigText(default = self.timer.description, fixed_size = False)
 
 
-                       config.timerentry.repeated = configElement_nonSave("config.timerentry.repeated", configSelection, repeated, (_("daily"), _("weekly"), _("Mon-Fri"), _("user defined")))
+                       self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
 
 
-                       config.timerentry.startdate = configElement_nonSave("config.timerentry.startdate", configDateTime, self.timer.begin, (_("%d.%B %Y"), 86400))
-                       config.timerentry.starttime = configElement_nonSave("config.timerentry.starttime", configSequence, [int(time.strftime("%H", time.localtime(self.timer.begin))), int(time.strftime("%M", time.localtime(self.timer.begin)))], configsequencearg.get("CLOCK"))
+                       self.timerentry_startdate = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
+                       self.timerentry_starttime = ConfigClock(default = [int(time.strftime("%H", time.localtime(self.timer.begin))), int(time.strftime("%M", time.localtime(self.timer.begin)))])
 
 
-                       config.timerentry.enddate = configElement_nonSave("config.timerentry.enddate", configDateTime, self.timer.end, (_("%d.%B %Y"), 86400))
-                       config.timerentry.endtime = configElement_nonSave("config.timerentry.endtime", configSequence, [int(time.strftime("%H", time.localtime(self.timer.end))), int(time.strftime("%M", time.localtime(self.timer.end)))], configsequencearg.get("CLOCK"))
+                       self.timerentry_enddate = ConfigDateTime(default = self.timer.end, formatstring =  _("%d.%B %Y"), increment = 86400)
+                       self.timerentry_endtime = ConfigClock(default = [int(time.strftime("%H", time.localtime(self.timer.end))), int(time.strftime("%M", time.localtime(self.timer.end)))])
 
 
-                       config.timerentry.weekday = configElement_nonSave("config.timerentry.weekday", configSelection, weekday, (_("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday"), _("Sunday")))
+                       self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
 
 
-                       config.timerentry.day = []
+                       self.timerentry_day = ConfigSubList()
                        for x in range(0,7):
                        for x in range(0,7):
-                               config.timerentry.day.append(configElement_nonSave("config.timerentry.day[" + str(x) + "]", configSelection, day[x], (_("yes"), _("no"))))
-
+                               self.timerentry_day.append(ConfigYesNo(default = day[x]))
 
                        # FIXME some service-chooser needed here
                        servicename = "N/A"
 
                        # FIXME some service-chooser needed here
                        servicename = "N/A"
@@ -122,79 +105,72 @@ class TimerEntry(Screen):
                                servicename = str(self.timer.service_ref.getServiceName())
                        except:
                                pass
                                servicename = str(self.timer.service_ref.getServiceName())
                        except:
                                pass
-                       config.timerentry.service = configElement_nonSave("config.timerentry.service", configSelection, 0, ((servicename),))
+                       self.timerentry_service = ConfigSelection([servicename])
                        
                        
-                       config.timerentry.startdate.addNotifier(self.checkDate)
-                       config.timerentry.enddate.addNotifier(self.checkDate)
+                       self.timerentry_startdate.addNotifier(self.checkDate)
+                       self.timerentry_enddate.addNotifier(self.checkDate)
 
        def checkDate(self, configElement):
 
        def checkDate(self, configElement):
-               if (configElement.getConfigPath() == "config.timerentry.startdate"):
-                       if (config.timerentry.enddate.value < config.timerentry.startdate.value):
-                               config.timerentry.enddate.value = config.timerentry.startdate.value
-                               config.timerentry.enddate.change()
-                               try:
-                                       self["config"].invalidate(config.timerentry.enddate)
-                               except: # FIXME: what could go wrong here?
-                                       pass
-               if (configElement.getConfigPath() == "config.timerentry.enddate"):
-                       if (config.timerentry.enddate.value < config.timerentry.startdate.value):
-                               config.timerentry.startdate.value = config.timerentry.enddate.value
-                               config.timerentry.startdate.change()
-                               try:
-                                       self["config"].invalidate(config.timerentry.startdate)
-                               except: # FIXME: what could go wrong here?
-                                       pass
+               if configElement is self.timerentry_startdate:
+                       if self.timerentry_enddate.value < self.timerentry_startdate.value:
+                               self.timerentry_enddate.value = self.timerentry_startdate.value
+                               self["config"].invalidate(self.timerentry_enddate)
+               if configElement is self.timerentry_enddate:
+                       if (self.timerentry_enddate.value < self.timerentry_startdate.value):
+                               self.timerentry_startdate.value = self.timerentry_enddate.value
+                               self["config"].invalidate(self.timerentry_startdate)
 
        def createSetup(self, widget):
                self.list = []
 
        def createSetup(self, widget):
                self.list = []
-               self.list.append(getConfigListEntry(_("Name"), config.timerentry.name))
-               self.list.append(getConfigListEntry(_("Description"), config.timerentry.description))
-               self.timerJustplayEntry = getConfigListEntry(_("Timer Type"), config.timerentry.justplay)
+               self.list.append(getConfigListEntry(_("Name"), self.timerentry_name))
+               self.list.append(getConfigListEntry(_("Description"), self.timerentry_description))
+               self.timerJustplayEntry = getConfigListEntry(_("Timer Type"), self.timerentry_justplay)
                self.list.append(self.timerJustplayEntry)
                self.list.append(self.timerJustplayEntry)
-               self.timerTypeEntry = getConfigListEntry(_("Repeat Type"), config.timerentry.type)
+               self.timerTypeEntry = getConfigListEntry(_("Repeat Type"), self.timerentry_type)
                self.list.append(self.timerTypeEntry)
 
                self.list.append(self.timerTypeEntry)
 
-               if (config.timerentry.type.value == 0): # once
+               if self.timerentry_type.value == "once":
                        self.frequencyEntry = None
                else: # repeated
                        self.frequencyEntry = None
                else: # repeated
-                       self.frequencyEntry = getConfigListEntry(_("Frequency"), config.timerentry.repeated)
+                       self.frequencyEntry = getConfigListEntry(_("Frequency"), self.timerentry_repeated)
                        self.list.append(self.frequencyEntry)
                        self.list.append(self.frequencyEntry)
-                       if (config.timerentry.repeated.value == 0): # daily
+                       if self.timerentry_repeated.value == "daily":
                                pass
                                pass
-                       if (config.timerentry.repeated.value == 2): # Mon-Fri
+                       if self.timerentry_repeated.value == "weekdays":
                                pass
                                pass
-                       if (config.timerentry.repeated.value == 1): # weekly
-                               self.list.append(getConfigListEntry(_("Weekday"), config.timerentry.weekday))
-
-                       if (config.timerentry.repeated.value == 3): # user defined
-                               self.list.append(getConfigListEntry(_("Monday"), config.timerentry.day[0]))
-                               self.list.append(getConfigListEntry(_("Tuesday"), config.timerentry.day[1]))
-                               self.list.append(getConfigListEntry(_("Wednesday"), config.timerentry.day[2]))
-                               self.list.append(getConfigListEntry(_("Thursday"), config.timerentry.day[3]))
-                               self.list.append(getConfigListEntry(_("Friday"), config.timerentry.day[4]))
-                               self.list.append(getConfigListEntry(_("Saturday"), config.timerentry.day[5]))
-                               self.list.append(getConfigListEntry(_("Sunday"), config.timerentry.day[6]))
-
-                       #self.list.append(getConfigListEntry("StartDate", config.timerentry.startdate))
-#              self.list.append(getConfigListEntry("Weekday", config.timerentry.weekday))
-
-               if (config.timerentry.type.value == 0): # once
-                       self.list.append(getConfigListEntry(_("Start"), config.timerentry.startdate))
-                       self.list.append(getConfigListEntry(" ", config.timerentry.starttime))
+                       if self.timerentry_repeated.value == "weekly":
+                               self.list.append(getConfigListEntry(_("Weekday"), self.timerentry_weekday))
+
+                       if self.timerentry_repeated.value == "user":
+                               self.list.append(getConfigListEntry(_("Monday"), self.timerentry_day[0]))
+                               self.list.append(getConfigListEntry(_("Tuesday"), self.timerentry_day[1]))
+                               self.list.append(getConfigListEntry(_("Wednesday"), self.timerentry_day[2]))
+                               self.list.append(getConfigListEntry(_("Thursday"), self.timerentry_day[3]))
+                               self.list.append(getConfigListEntry(_("Friday"), self.timerentry_day[4]))
+                               self.list.append(getConfigListEntry(_("Saturday"), self.timerentry_day[5]))
+                               self.list.append(getConfigListEntry(_("Sunday"), self.timerentry_day[6]))
+
+                       #self.list.append(getConfigListEntry("StartDate", self.timerentry_startdate))
+#              self.list.append(getConfigListEntry("Weekday", self.timerentry_weekday))
+
+               if self.timerentry_type.value == "once":
+                       self.list.append(getConfigListEntry(_("Start"), self.timerentry_startdate))
+                       self.list.append(getConfigListEntry(" ", self.timerentry_starttime))
                else:
                else:
-                       self.list.append(getConfigListEntry(_("StartTime"), config.timerentry.starttime))
-               if (config.timerentry.type.value == 0): # once
-                       if currentConfigSelectionElement(config.timerentry.justplay) != "zap":
-                               self.list.append(getConfigListEntry(_("End"), config.timerentry.enddate))
-                               self.list.append(getConfigListEntry(" ", config.timerentry.endtime))
+                       self.list.append(getConfigListEntry(_("StartTime"), self.timerentry_starttime))
+
+               if self.timerentry_type.value == "once":
+                       if self.timerentry_justplay.value != "zap":
+                               self.list.append(getConfigListEntry(_("End"), self.timerentry_enddate))
+                               self.list.append(getConfigListEntry(" ", self.timerentry_endtime))
                else:
                else:
-                       if currentConfigSelectionElement(config.timerentry.justplay) != "zap":
-                               self.list.append(getConfigListEntry(_("EndTime"), config.timerentry.endtime))
+                       if self.timerentry_justplay.value != "zap":
+                               self.list.append(getConfigListEntry(_("EndTime"), self.timerentry_endtime))
 
 
-               if currentConfigSelectionElement(config.timerentry.justplay) != "zap":
-                       self.list.append(getConfigListEntry(_("After event"), config.timerentry.afterevent))
+               if self.timerentry_justplay.value != "zap":
+                       self.list.append(getConfigListEntry(_("After event"), self.timerentry_afterevent))
 
 
-               self.channelEntry = getConfigListEntry(_("Channel"), config.timerentry.service)
+               self.channelEntry = getConfigListEntry(_("Channel"), self.timerentry_service)
                self.list.append(self.channelEntry)
 
                self[widget].list = self.list
                self.list.append(self.channelEntry)
 
                self[widget].list = self.list
@@ -210,15 +186,12 @@ class TimerEntry(Screen):
                        self.createSetup("config")
 
        def keyLeft(self):
                        self.createSetup("config")
 
        def keyLeft(self):
-               if self["config"].getCurrent() == self.channelEntry:
+               if self["config"].getCurrent() is self.channelEntry:
                        self.keySelect()
                else:
                        self.keySelect()
                else:
-                       self["config"].handleKey(config.key["prevElement"])
+                       ConfigListScreen.keyLeft(self)
                        self.newConfig()
 
                        self.newConfig()
 
-       def keyDelete(self):
-               self["config"].handleKey(config.key["delete"])
-                       
        def keyRightCallback(self, configPath):
                currentConfigPath = self["config"].getCurrent()[1].parent.getConfigPath()
                # check if we are still on the same config entry
        def keyRightCallback(self, configPath):
                currentConfigPath = self["config"].getCurrent()[1].parent.getConfigPath()
                # check if we are still on the same config entry
@@ -226,10 +199,10 @@ class TimerEntry(Screen):
                        self.keyRight()
 
        def keyRight(self):
                        self.keyRight()
 
        def keyRight(self):
-               if self["config"].getCurrent() == self.channelEntry:
+               if self["config"].getCurrent() is self.channelEntry:
                        self.keySelect()
                else:
                        self.keySelect()
                else:
-                       self["config"].handleKey(config.key["nextElement"])
+                       ConfigListScreen.keyRight(self)
                        self.newConfig()
                
        def keySelect(self):
                        self.newConfig()
                
        def keySelect(self):
@@ -241,25 +214,20 @@ class TimerEntry(Screen):
        def finishedChannelSelection(self, *args):
                if len(args):
                        self.timer.service_ref = ServiceReference(args[0])
        def finishedChannelSelection(self, *args):
                if len(args):
                        self.timer.service_ref = ServiceReference(args[0])
-                       config.timerentry.service.vals = (str(self.timer.service_ref.getServiceName()),)
-                       self["config"].invalidate(config.timerentry.service)
-
-       def keyNumberGlobal(self, number):
-               print "You pressed number " + str(number)
-               if (self["config"].getCurrent()[1].parent.enabled == True):
-                       self["config"].handleKey(config.key[str(number)])
+                       self.timerentry_service.vals = (str(self.timer.service_ref.getServiceName()),)
+                       self["config"].invalidate(self.timerentry_service)
 
        def getTimestamp(self, date, mytime):
                d = time.localtime(date)
                dt = datetime.datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1])
 
        def getTimestamp(self, date, mytime):
                d = time.localtime(date)
                dt = datetime.datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1])
-               return int(mktime(dt.timetuple()))
+               return int(time.mktime(dt.timetuple()))
 
        def getBeginEnd(self):
 
        def getBeginEnd(self):
-               enddate = config.timerentry.enddate.value
-               endtime = config.timerentry.endtime.value
+               enddate = self.timerentry_enddate.value
+               endtime = self.timerentry_endtime.value
                
                
-               startdate = config.timerentry.startdate.value
-               starttime = config.timerentry.starttime.value
+               startdate = self.timerentry_startdate.value
+               starttime = self.timerentry_starttime.value
                
                begin = self.getTimestamp(startdate, starttime)
                end = self.getTimestamp(enddate, endtime)
                
                begin = self.getTimestamp(startdate, starttime)
                end = self.getTimestamp(enddate, endtime)
@@ -272,32 +240,33 @@ class TimerEntry(Screen):
                return begin, end
 
        def keyGo(self):
                return begin, end
 
        def keyGo(self):
-               self.timer.name = config.timerentry.name.value
-               self.timer.description = config.timerentry.description.value
-               self.timer.justplay = (currentConfigSelectionElement(config.timerentry.justplay) == "zap")
+               self.timer.name = self.timerentry_name.value
+               self.timer.description = self.timerentry_description.value
+               self.timer.justplay = self.timerentry_justplay.value == "zap"
                self.timer.resetRepeated()
                self.timer.resetRepeated()
-               self.timer.afterEvent = { 0: AFTEREVENT.NONE, 1: AFTEREVENT.DEEPSTANDBY, 2: AFTEREVENT.STANDBY}[config.timerentry.afterevent.value]
+               self.timer.afterEvent = {"nothing": AFTEREVENT.NONE, "deepstandby": AFTEREVENT.DEEPSTANDBY, "standby": AFTEREVENT.STANDBY}[self.timerentry_afterevent.value]
                
                
-               if (config.timerentry.type.value == 0): # once
+               if self.timerentry_type.value == "once":
                        self.timer.begin, self.timer.end = self.getBeginEnd()
                        self.timer.begin, self.timer.end = self.getBeginEnd()
-               if (config.timerentry.type.value == 1): # repeated
-                       if (config.timerentry.repeated.value == 0): # daily
+               if self.timerentry_type.value == "repeated":
+                       if self.timerentry_repeated.value == "daily":
                                for x in range(0,7):
                                        self.timer.setRepeated(x)
 
                                for x in range(0,7):
                                        self.timer.setRepeated(x)
 
-                       if (config.timerentry.repeated.value == 1): # weekly
-                               self.timer.setRepeated(config.timerentry.weekday.value)
+                       if self.timerentry_repeated.value == "weekly":
+                               self.timer.setRepeated(self.timerentry_weekday.index)
                                
                                
-                       if (config.timerentry.repeated.value == 2): # Mon-Fri
+                       if self.timerentry_repeated.value == "weekdays":
                                for x in range(0,5):
                                        self.timer.setRepeated(x)
                                
                                for x in range(0,5):
                                        self.timer.setRepeated(x)
                                
-                       if (config.timerentry.repeated.value == 3): # user defined
+                       if self.timerentry_repeated.value == "user":
                                for x in range(0,7):
                                for x in range(0,7):
-                                       if (config.timerentry.day[x].value == 0): self.timer.setRepeated(x)
+                                       if self.timerentry_day[x].value:
+                                               self.timer.setRepeated(x)
 
 
-                       self.timer.begin = self.getTimestamp(time.time(), config.timerentry.starttime.value)
-                       self.timer.end = self.getTimestamp(time.time(), config.timerentry.endtime.value)
+                       self.timer.begin = self.getTimestamp(time.time(), self.timerentry_starttime.value)
+                       self.timer.end = self.getTimestamp(time.time(), self.timerentry_endtime.value)
                        
                        # when a timer end is set before the start, add 1 day
                        if self.timer.end < self.timer.begin:
                        
                        # when a timer end is set before the start, add 1 day
                        if self.timer.end < self.timer.begin:
@@ -368,7 +337,7 @@ class TimerLog(Screen):
        def fillLogList(self):
                self.list = [ ]
                for x in self.log_entries:
        def fillLogList(self):
                self.list = [ ]
                for x in self.log_entries:
-                       self.list.append((str(strftime("%Y-%m-%d %H-%M", localtime(x[0])) + " - " + x[2]), x))
+                       self.list.append((str(time.strftime("%Y-%m-%d %H-%M", localtime(x[0])) + " - " + x[2]), x))
        
        def clearLog(self):             
                self.log_entries = []
        
        def clearLog(self):             
                self.log_entries = []
index 3febb1af0b1b0e1b4e97e8b1fb9711df9c0aaf31..bab07f2021b92f0170033fe5498a52d29182d28d 100644 (file)
@@ -1,12 +1,11 @@
 from Wizard import Wizard, wizardManager
 
 from Wizard import Wizard, wizardManager
 
-from Components.config import configElementBoolean, config
+from Components.config import ConfigBoolean, config
 from Components.Pixmap import *
 
 from LanguageSelection import LanguageSelection
 
 from Components.Pixmap import *
 
 from LanguageSelection import LanguageSelection
 
-
-config.misc.firstruntutorial = configElementBoolean("config.misc.firstruntutorial", 1);
+config.misc.firstruntutorial = ConfigBoolean(default = True)
 
 class TutorialWizard(Wizard):
        skin = """
 
 class TutorialWizard(Wizard):
        skin = """
@@ -30,7 +29,7 @@ class TutorialWizard(Wizard):
                self["arrowup2"] = MovingPixmap()
                
        def markDone(self):
                self["arrowup2"] = MovingPixmap()
                
        def markDone(self):
-               config.misc.firstruntutorial.value = 1;
+               config.misc.firstruntutorial.value = False
                config.misc.firstruntutorial.save()
                config.misc.firstruntutorial.save()
-                       
-#wizardManager.registerWizard(TutorialWizard, config.misc.firstruntutorial.value)
\ No newline at end of file
+
+#wizardManager.registerWizard(TutorialWizard, config.misc.firstruntutorial.value)
index 0c1d4ceadd2cb85f5382b0a5b848f3a1b8702382..1205748feb503bcc6cad1e9b6e9f23a73a53d98b 100644 (file)
@@ -1,13 +1,14 @@
 from Screen import Screen
 from Components.VolumeBar import VolumeBar
 from Screen import Screen
 from Components.VolumeBar import VolumeBar
-        
+               
 class Volume(Screen):
 class Volume(Screen):
-    def __init__(self, session):
-        Screen.__init__(self, session)
-        
-        self.volumeBar = VolumeBar()
-        
-        self["Volume"] = self.volumeBar
-        
-    def setValue(self, vol):
-        self.volumeBar.setValue(vol)
+       def __init__(self, session):
+               Screen.__init__(self, session)
+               
+               self.volumeBar = VolumeBar()
+               
+               self["Volume"] = self.volumeBar
+               
+       def setValue(self, vol):
+               print "setValue", vol
+               self.volumeBar.setValue(vol)
index 87ac5486280b6c727844b6ad6b726fd12e41ab48..7c61d263439920334e2f1698b64fcef5135633aa 100644 (file)
@@ -1,9 +1,9 @@
 # -*- coding: latin-1 -*-
 # -*- coding: latin-1 -*-
-from enigma import *
+from enigma import eTimer
 from Components.Language import language
 
 class NumericalTextInput:
 from Components.Language import language
 
 class NumericalTextInput:
-       def __init__(self, nextFunc=None):
+       def __init__(self, nextFunc=None, handleTimeout = True):
                self.mapping = []
                self.lang = language.getLanguage()
                self.useableChars=None
                self.mapping = []
                self.lang = language.getLanguage()
                self.useableChars=None
@@ -43,8 +43,11 @@ class NumericalTextInput:
                        self.mapping.append (u"tuv8TUV") # 8
                        self.mapping.append (u"wxyz9WXYZ") # 9
 
                        self.mapping.append (u"tuv8TUV") # 8
                        self.mapping.append (u"wxyz9WXYZ") # 9
 
-               self.Timer = eTimer()
-               self.Timer.timeout.get().append(self.nextChar)
+               if handleTimeout:
+                       self.timer = eTimer()
+                       self.timer.timeout.get().append(self.timeout)
+               else:
+                       self.timer = None
                self.lastKey = -1
                self.pos = -1
 
                self.lastKey = -1
                self.pos = -1
 
@@ -53,13 +56,14 @@ class NumericalTextInput:
 
        def getKey(self, num):
                cnt=0
 
        def getKey(self, num):
                cnt=0
-               self.Timer.start(1000, True)
-               if (self.lastKey != num):
+               if self.timer is not None:
+                       self.timer.start(1000, True)
+               if self.lastKey != num:
                        self.lastKey = num
                        self.pos = -1
                        self.lastKey = num
                        self.pos = -1
-               while(True):
+               while True:
                        self.pos += 1
                        self.pos += 1
-                       if (len(self.mapping[num]) <= self.pos):
+                       if len(self.mapping[num]) <= self.pos:
                                self.pos = 0
                        if self.useableChars:
                                pos = self.useableChars.find(self.mapping[num][self.pos])
                                self.pos = 0
                        if self.useableChars:
                                pos = self.useableChars.find(self.mapping[num][self.pos])
@@ -73,10 +77,14 @@ class NumericalTextInput:
                return self.mapping[num][self.pos]
 
        def nextKey(self):
                return self.mapping[num][self.pos]
 
        def nextKey(self):
-               self.Timer.stop()
+               if self.timer is not None:
+                       self.timer.stop()
                self.lastKey = -1
 
        def nextChar(self):
                self.nextKey()
                if self.nextFunction:
                        self.nextFunction()
                self.lastKey = -1
 
        def nextChar(self):
                self.nextKey()
                if self.nextFunction:
                        self.nextFunction()
+
+       def timeout(self):
+               self.nextChar()
diff --git a/skin.py b/skin.py
index c95d049dd4974ed4f466e506de65b39707c9b965..9c18fda6bfaa3a57c8006a9deecb06a5eaf6a199 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -4,7 +4,7 @@ from xml.dom import EMPTY_NAMESPACE
 from Tools.Import import my_import
 import os
 
 from Tools.Import import my_import
 import os
 
-from Components.config import ConfigSubsection, configElement, configText, config
+from Components.config import ConfigSubsection, ConfigText, config
 from Components.Element import Element
 from Components.Converter.Converter import Converter
 
 from Components.Element import Element
 from Components.Converter.Converter import Converter
 
@@ -49,7 +49,7 @@ def loadSkin(name):
 
 # example: loadSkin("nemesis_greenline/skin.xml")
 config.skin = ConfigSubsection()
 
 # example: loadSkin("nemesis_greenline/skin.xml")
 config.skin = ConfigSubsection()
-config.skin.primary_skin = configElement("config.skin.primary_skin", configText, "skin.xml", 0)
+config.skin.primary_skin = ConfigText(default = "skin.xml")
 
 try:
        loadSkin(config.skin.primary_skin.value)
 
 try:
        loadSkin(config.skin.primary_skin.value)
@@ -89,7 +89,7 @@ def collectAttributes(skinAttributes, node, skin_path_prefix=None, ignore=[]):
                # TODO: localization? as in e1?
                value = a.value.encode("utf-8")
                
                # TODO: localization? as in e1?
                value = a.value.encode("utf-8")
                
-               if attrib in ["pixmap", "pointer"]:
+               if attrib in ["pixmap", "pointer", "seek_pointer"]:
                        value = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix)
                
                if attrib not in ignore:
                        value = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix)
                
                if attrib not in ignore:
@@ -184,12 +184,12 @@ def applySingleAttribute(guiObject, desktop, attrib, value):
                                }[value])
                elif attrib == "enableWrapAround":
                        guiObject.setWrapAround(True)
                                }[value])
                elif attrib == "enableWrapAround":
                        guiObject.setWrapAround(True)
-               elif attrib == "pointer":
+               elif attrib == "pointer" or attrib == "seek_pointer":
                        (name, pos) = value.split(':')
                        pos = parsePosition(pos)
                        ptr = loadPixmap(name)
                        desktop.makeCompatiblePixmap(ptr.__deref__())
                        (name, pos) = value.split(':')
                        pos = parsePosition(pos)
                        ptr = loadPixmap(name)
                        desktop.makeCompatiblePixmap(ptr.__deref__())
-                       guiObject.setPointer(ptr.__deref__(), pos)
+                       guiObject.setPointer({"pointer": 0, "seek_pointer": 1}[attrib], ptr.__deref__(), pos)
                elif attrib == 'shadowOffset':
                        guiObject.setShadowOffset(parsePosition(value))
                else:
                elif attrib == 'shadowOffset':
                        guiObject.setShadowOffset(parsePosition(value))
                else: