1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.Button import Button
4 from Components.Label import Label
5 from Components.ScrollLabel import ScrollLabel
6 from enigma import eServiceEventPtr
7 from ServiceReference import ServiceReference
8 from RecordTimer import RecordTimerEntry, parseEvent
9 from TimerEntry import TimerEntry
12 def __init__(self, Event, Ref, callback=None):
13 self.cbFunc = callback
14 self.currentService=Ref
15 self.isRecording = len(Ref.ref.getPath())
17 self["epg_description"] = ScrollLabel()
18 self["datetime"] = Label()
19 self["channel"] = Label()
20 self["duration"] = Label()
21 self["key_red"] = Button("")
23 self["key_green"] = Button("")
25 self["key_green"] = Button(_("Add timer"))
26 self["key_yellow"] = Button("")
27 self["key_blue"] = Button("")
28 self["actions"] = ActionMap(["OkCancelActions", "EventViewActions"],
32 "pageUp": self.pageUp,
33 "pageDown": self.pageDown,
34 "prevEvent": self.prevEvent,
35 "nextEvent": self.nextEvent,
36 "timerAdd": self.timerAdd
38 self.onShown.append(self.onCreate)
41 self.setEvent(self.event)
42 self.setService(self.currentService)
45 if self.cbFunc is not None:
46 self.cbFunc(self.setEvent, self.setService, -1)
49 if self.cbFunc is not None:
50 self.cbFunc(self.setEvent, self.setService, +1)
53 if not self.isRecording:
54 newEntry = RecordTimerEntry(self.currentService, *parseEvent(self.event))
55 self.session.openWithCallback(self.timerEditFinished, TimerEntry, newEntry)
57 def timerEditFinished(self, answer):
59 self.session.nav.RecordTimer.record(answer[1])
61 print "Timeredit aborted"
63 def setService(self, service):
64 self.currentService=service
66 self["channel"].setText(_("Recording"))
68 name = self.currentService.getServiceName()
70 self["channel"].setText(name)
72 self["channel"].setText(_("unknown service"))
74 def setEvent(self, event):
76 text = event.getEventName()
77 short = event.getShortDescription()
78 ext = event.getExtendedDescription()
79 if len(short) > 0 and short != text:
80 text = text + '\n\n' + short
85 self.setTitle(event.getEventName())
86 self["epg_description"].setText(text)
87 self["datetime"].setText(event.getBeginTimeString())
88 self["duration"].setText(_("%d min")%(event.getDuration()/60))
91 self["epg_description"].pageUp()
94 self["epg_description"].pageDown()
96 class EventViewSimple(Screen, EventViewBase):
97 def __init__(self, session, Event, Ref, callback=None):
98 Screen.__init__(self, session)
99 self.skinName = "EventView"
100 EventViewBase.__init__(self, Event, Ref, callback)
102 class EventViewEPGSelect(Screen, EventViewBase):
103 def __init__(self, session, Event, Ref, callback=None, singleEPGCB=None, multiEPGCB=None):
104 Screen.__init__(self, session)
105 self.skinName = "EventView"
106 EventViewBase.__init__(self, Event, Ref, callback)
107 self["key_yellow"].setText(_("Single EPG"))
108 self["key_blue"].setText(_("Multi EPG"))
109 self["epgactions"] = ActionMap(["EventViewEPGActions"],
111 "openSingleServiceEPG": singleEPGCB,
112 "openMultiServiceEPG": multiEPGCB