add colorbuttons to TimerEditList
[enigma2.git] / lib / python / Screens / TimerEdit.py
1 from Screen import Screen
2 from Components.TimerList import TimerList, TimerEntryComponent
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 from Components.TextInput import TextInput
8 from TimerEntry import TimerEntry
9
10 class TimerEdit(Screen):
11         def __init__(self, session, entry):
12                 Screen.__init__(self, session)
13
14                 self["actions"] = ActionMap(["OkCancelActions"], 
15                         {
16                                 "ok": self.apply,
17                                 "cancel": self.close
18                         })
19                 
20                 self["shortcuts"] = ActionMap(["ShortcutActions"],
21                         {
22                                 "red": self.beginFocus,
23                                 "yellow": self.endFocus,
24                                 "green": self.descFocus
25                         })
26                 
27                 self.entry = entry
28                 # begin, end, description, service
29                 self["begin"] = TimeInput()
30                 self["end"] = TimeInput()
31                 
32                 self["lbegin"] = Label("Begin")
33                 self["lend"] = Label("End")
34                 
35                 self["description"] = TextInput()
36                 self["apply"] = Button("Apply")
37                 self["service"] = Button()
38                 
39                 self["description"].setText(entry.description);
40         
41         def beginFocus(self):
42                 self.setFocus(self["begin"])
43         
44         def endFocus(self):
45                 self.setFocus(self["end"])
46         
47         def descFocus(self):
48                 self.setFocus(self["description"])
49         
50         def apply(self):
51                 print "applied!"
52         
53 class TimerEditList(Screen):
54         def __init__(self, session):
55                 Screen.__init__(self, session)
56                 
57                 list = [ ]
58                 for timer in session.nav.RecordTimer.timer_list:
59                         list.append(TimerEntryComponent(timer, 0))
60                 
61                 for timer in session.nav.RecordTimer.processed_timers:
62                         list.append(TimerEntryComponent(timer, 1))
63                 
64                 self["timerlist"] = TimerList(list)
65                 
66                 self["key_red"] = Button("Delete")
67                 self["key_green"] = Button("Add")
68                 self["key_yellow"] = Button("")
69                 self["key_blue"] = Button("")
70
71                 self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions"], 
72                         {
73                                 "ok": self.openEdit,
74                                 "cancel": self.close,
75                                 "red": self.removeTimer,
76                                 "green": self.addTimer
77                         })
78
79         def openEdit(self):
80                 self.session.open(TimerEntry, self["timerlist"].getCurrent()[0])
81                 #self.session.open(TimerEdit, self["timerlist"].getCurrent()[0])
82                 
83         def removeTimer(self):
84                 pass
85         
86         def addTimer(self):
87                 pass