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