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, parseEvent
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["key_red"] = Button("")
26 self["key_green"] = Button(_("Add timer"))
27 self["key_yellow"] = Button("")
28 self["key_blue"] = Button("")
30 self["actions"] = ChannelActionMap(["EPGSelectActions", "OkCancelActions"],
33 "ok": self.eventSelected,
34 "timerAdd": self.timerAdd
36 self["actions"].csel = self
39 def eventViewCallback(self, setEvent, val):
42 setEvent(self["list"].getCurrent())
45 setEvent(self["list"].getCurrent())
47 def eventSelected(self):
48 event = self["list"].getCurrent()
49 self.session.open(EventView, event, self.currentService, self.eventViewCallback)
52 event = self["list"].getCurrent()
57 # FIXME only works if already playing a service
58 serviceref = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference())
60 newEntry = RecordTimerEntry(serviceref, *parseEvent(event))
61 self.session.openWithCallback(self.timerEditFinished, TimerEntry, newEntry)
63 def timerEditFinished(self, answer):
65 self.session.nav.RecordTimer.record(answer[1])
67 print "Timeredit aborted"
69 def setRoot(self, root):
70 self.currentService=ServiceReference(root)
71 self["list"].setRoot(root)
77 self["list"].moveDown()