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
13 class TimerEdit(Screen):
14 def __init__(self, session, entry):
15 Screen.__init__(self, session)
17 self["actions"] = ActionMap(["OkCancelActions"],
23 self["shortcuts"] = ActionMap(["ShortcutActions"],
25 "red": self.beginFocus,
26 "yellow": self.endFocus,
27 "green": self.descFocus
31 # begin, end, description, service
32 self["begin"] = TimeInput()
33 self["end"] = TimeInput()
35 self["lbegin"] = Label("Begin")
36 self["lend"] = Label("End")
38 self["description"] = TextInput()
39 self["apply"] = Button("Apply")
40 self["service"] = Button()
42 self["description"].setText(entry.description);
45 self.setFocus(self["begin"])
48 self.setFocus(self["end"])
51 self.setFocus(self["description"])
56 class TimerEditList(Screen):
57 def __init__(self, session):
58 Screen.__init__(self, session)
61 for timer in session.nav.RecordTimer.timer_list:
62 list.append(TimerEntryComponent(timer, 0))
64 for timer in session.nav.RecordTimer.processed_timers:
65 list.append(TimerEntryComponent(timer, 1))
67 self["timerlist"] = TimerList(list)
69 self["key_red"] = Button("Delete")
70 self["key_green"] = Button("Add")
71 self["key_yellow"] = Button("")
72 self["key_blue"] = Button("")
74 self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions"],
78 "red": self.removeTimer,
79 "green": self.addTimer
83 self.session.open(TimerEntry, self["timerlist"].getCurrent()[0])
84 #self.session.open(TimerEdit, self["timerlist"].getCurrent()[0])
86 def removeTimer(self):
87 self.session.nav.RecordTimer.removeEntry(self["timerlist"].getCurrent()[0])
95 service = self.session.nav.getCurrentService()
103 description = "unknown event"
105 description = ev.getEventName()
106 # FIXME we need a timestamp here:
107 begin = ev.getBeginTime()
110 print ev.getDuration()
111 end = begin + ev.getDuration()
114 # FIXME only works if already playing a service
115 serviceref = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference())
117 newEntry = RecordTimerEntry(begin, end, serviceref, epg, description)
118 self.session.open(TimerEntry, newEntry)