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 from RecordTimer import RecordTimerEntry
11 from ServiceReference import ServiceReference
12 from Components.config import *
14 class TimerEditList(Screen):
15 def __init__(self, session):
16 Screen.__init__(self, session)
19 for timer in session.nav.RecordTimer.timer_list:
20 list.append(TimerEntryComponent(timer, 0))
22 for timer in session.nav.RecordTimer.processed_timers:
23 list.append(TimerEntryComponent(timer, 1))
25 self["timerlist"] = TimerList(list)
27 self["key_red"] = Button("Delete")
28 self["key_green"] = Button("Add")
29 self["key_yellow"] = Button("")
30 self["key_blue"] = Button("")
32 self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions"],
36 "red": self.removeTimer,
37 "green": self.addCurrentTimer
41 self.session.openWithCallback(self.finishedEdit, TimerEntry, self["timerlist"].getCurrent()[0])
42 #self.session.open(TimerEdit, self["timerlist"].getCurrent()[0])
44 def removeTimer(self):
45 # FIXME doesn't work...
46 self.session.nav.RecordTimer.removeEntry(self["timerlist"].getCurrent()[0])
48 def addCurrentTimer(self):
54 service = self.session.nav.getCurrentService()
62 description = "unknown event"
64 description = ev.getEventName()
65 # FIXME we need a timestamp here:
66 begin = ev.getBeginTime()
69 print ev.getDuration()
70 end = begin + ev.getDuration()
73 # FIXME only works if already playing a service
74 serviceref = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference())
76 self.addTimer(RecordTimerEntry(begin, end, serviceref, epg, description))
78 def addTimer(self, timer):
79 self.session.openWithCallback(self.finishedAdd, TimerEntry, timer)
81 def finishedEdit(self, answer):
85 print "Timeredit aborted"
87 def finishedAdd(self, answer):
89 self.session.nav.RecordTimer.record(answer[1])
91 print "Timeredit aborted"