- add description for timer entries
[enigma2.git] / lib / python / Screens / TimerEdit.py
1 from Screen import Screen
2 from Components.TimerList import TimerList, TimerEntry
3 from Components.ActionMap import ActionMap
4 from Components.TimeInput import TimeInput
5 from Components.Label import Label
6 from Components.Button import Button
7
8 class TimerEdit(Screen):
9         def __init__(self, session, entry):
10                 Screen.__init__(self, session)
11
12                 self["actions"] = ActionMap(["OkCancelActions"], 
13                         {
14                                 "ok": self.apply,
15                                 "cancel": self.close
16                         })
17                 
18                 self["shortcuts"] = ActionMap(["ShortcutActions"],
19                         {
20                                 "red": self.beginFocus,
21                                 "yellow": self.endFocus
22                         })
23                 
24                 self.entry = entry
25                 # begin, end, description, service
26                 self["begin"] = TimeInput()
27                 self["end"] = TimeInput()
28                 
29                 self["lbegin"] = Label("Begin")
30                 self["lend"] = Label("End")
31                 
32                 self["description"] = Label("bla")
33 # TextInput()
34                 self["apply"] = Button("Apply")
35                 self["service"] = Button()
36         
37         def beginFocus(self):
38                 self.setFocus(self["begin"])
39         
40         def endFocus(self):
41                 self.setFocus(self["end"])
42         
43         def apply(self):
44                 print "applied!"
45         
46 class TimerEditList(Screen):
47         def __init__(self, session):
48                 Screen.__init__(self, session)
49                 
50                 list = [ ]
51                 for timer in session.nav.RecordTimer.timer_list:
52                         list.append(TimerEntry(timer, 0))
53                 
54                 for timer in session.nav.RecordTimer.processed_timers:
55                         list.append(TimerEntry(timer, 1))
56                 
57                 self["timerlist"] = TimerList(list)
58
59                 self["actions"] = ActionMap(["OkCancelActions"], 
60                         {
61                                 "ok": self.openEdit,
62                                 "cancel": self.close
63                         })
64
65         def openEdit(self):
66                 self.session.open(TimerEdit, self["timerlist"].getCurrent())