config rewrite. some extensions still need to be updated.
[enigma2.git] / lib / python / Screens / TimeDateInput.py
index 4ea67b7..c7a6664 100644 (file)
@@ -1,14 +1,14 @@
 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
 
-class TimeDateInput(Screen):
+class TimeDateInput(Screen, ConfigListScreen):
        def __init__(self, session):
                Screen.__init__(self, session)
 
@@ -19,35 +19,22 @@ class TimeDateInput(Screen):
 
                self.createConfig()
 
-               self["actions"] = NumberActionMap(["SetupActions", "TextEntryActions"],
+               self["actions"] = NumberActionMap(["SetupActions"],
                {
                        "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 = []
-               self["config"] = ConfigList(self.list)
+               ConfigListScreen.__init__(self, self.list)
                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 = []
@@ -56,29 +43,15 @@ class TimeDateInput(Screen):
                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 keyRight(self):
-               self["config"].handleKey(config.key["nextElement"])
-
        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])