1 from Screen import Screen
2 from Components.config import *
3 from Components.ActionMap import NumberActionMap
4 from Components.ConfigList import ConfigList
5 from Components.NimManager import nimmanager
6 from Components.Label import Label
9 class TimerEntry(Screen):
10 def __init__(self, session, timer):
11 Screen.__init__(self, session)
13 self.createConfig(timer)
15 self["actions"] = NumberActionMap(["SetupActions"],
18 "cancel": self.keyCancel,
20 "right": self.keyRight,
21 "1": self.keyNumberGlobal,
22 "2": self.keyNumberGlobal,
23 "3": self.keyNumberGlobal,
24 "4": self.keyNumberGlobal,
25 "5": self.keyNumberGlobal,
26 "6": self.keyNumberGlobal,
27 "7": self.keyNumberGlobal,
28 "8": self.keyNumberGlobal,
29 "9": self.keyNumberGlobal,
30 "0": self.keyNumberGlobal
34 self["config"] = ConfigList(self.list)
37 self["introduction"] = Label("Press OK to start the scan")
39 def createConfig(self, timer):
40 config.timerentry = ConfigSubsection()
42 config.timerentry.type = configElement_nonSave("config.timerentry.type", configSelection, 0, ("once", "repeated"))
43 config.timerentry.startdate = configElement_nonSave("config.timerentry.startdate", configDateTime, timer.begin, ("%d.%B %Y", 86400))
44 config.timerentry.starttime = configElement_nonSave("config.timerentry.starttime", configSequence, [int(strftime("%H", localtime(timer.begin))), int(strftime("%M", localtime(timer.begin)))], configsequencearg.get("CLOCK"))
45 #config.timerentry.starttime = configElement_nonSave("config.timerentry.starttime", configDateTime, timer.begin, ("%H:%M", 60))
46 config.timerentry.enddate = configElement_nonSave("config.timerentry.enddate", configDateTime, timer.end, ("%d.%B %Y", 86400))
47 config.timerentry.endtime = configElement_nonSave("config.timerentry.endtime", configSequence, [int(strftime("%H", localtime(timer.end))), int(strftime("%M", localtime(timer.end)))], configsequencearg.get("CLOCK"))
48 # config.timerentry.endtime = configElement_nonSave("config.timerentry.endtime", configDateTime, timer.end, ("%H:%M", 60))
49 #config.timerentry.weekday = configElement_nonSave("config.timerentry.weekday", configDateTime, time(), ("%A", 86400))
51 def createSetup(self):
53 self.list.append(getConfigListEntry("TimerType", config.timerentry.type))
55 if (config.timerentry.type.value == 0):
56 self.list.append(getConfigListEntry("StartDate", config.timerentry.startdate))
57 self.list.append(getConfigListEntry("StartTime", config.timerentry.starttime))
58 self.list.append(getConfigListEntry("EndDate", config.timerentry.enddate))
59 self.list.append(getConfigListEntry("EndTime", config.timerentry.endtime))
62 #self.list.append(getConfigListEntry("StartDate", config.timerentry.startdate))
63 # self.list.append(getConfigListEntry("Weekday", config.timerentry.weekday))
65 self["config"].list = self.list
66 self["config"].l.setList(self.list)
69 print self["config"].getCurrent()
70 if self["config"].getCurrent()[0] == "TimerType":
72 if self["config"].getCurrent()[0] == "Tuner":
76 self["config"].handleKey(config.key["prevElement"])
80 self["config"].handleKey(config.key["nextElement"])
83 def keyNumberGlobal(self, number):
84 print "You pressed number " + str(number)
85 if (self["config"].getCurrent()[1].parent.enabled == True):
86 self["config"].handleKey(config.key[str(number)])
89 for x in self["config"].list:
91 self.session.openWithCallback(self.keyCancel, ServiceScan)
96 for x in self["config"].list: