1 from Screen import Screen
2 from Components.Button import Button
3 from Components.EpgList import EPGList
4 from Components.ActionMap import ActionMap
5 from Screens.EventView import EventView
6 from enigma import eServiceReference, eServiceEventPtr
7 from Screens.FixedMenu import FixedMenu
8 from RecordTimer import RecordTimerEntry
9 from TimerEdit import TimerEditList
10 from TimerEntry import TimerEntry
11 from ServiceReference import ServiceReference
13 import xml.dom.minidom
15 class EPGSelection(Screen):
16 def __init__(self, session, root):
17 Screen.__init__(self, session)
19 self["list"] = EPGList()
21 class ChannelActionMap(ActionMap):
22 def action(self, contexts, action):
23 ActionMap.action(self, contexts, action)
25 self["actions"] = ChannelActionMap(["EPGSelectActions", "OkCancelActions"],
28 "ok": self.eventSelected,
29 "timerAdd": self.timerAdd
31 self["actions"].csel = self
34 def eventViewCallback(self, setEvent, val):
37 setEvent(self["list"].getCurrent())
40 setEvent(self["list"].getCurrent())
42 def eventSelected(self):
43 event = self["list"].getCurrent()
44 self.session.open(EventView, event, self.currentService, self.eventViewCallback)
47 epg = self["list"].getCurrent()
50 description = "unknown event"
52 description = epg.getEventName()
53 # FIXME we need a timestamp here:
54 begin = epg.getBeginTime()
57 print epg.getDuration()
58 end = begin + epg.getDuration()
61 # FIXME only works if already playing a service
62 serviceref = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference())
64 newEntry = RecordTimerEntry(begin, end, serviceref, epg, description)
65 self.session.openWithCallback(self.timerEditFinished, TimerEntry, newEntry)
67 def timerEditFinished(self, answer):
69 self.session.nav.RecordTimer.record(answer[1])
71 print "Timeredit aborted"
73 def setRoot(self, root):
74 self.currentService=ServiceReference(root)
75 self["list"].setRoot(root)
81 self["list"].moveDown()