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
16 self["epg_description"] = ScrollLabel()
17 self["datetime"] = Label()
18 self["channel"] = Label()
19 self["duration"] = Label()
20 self["key_red"] = Button("")
21 self["key_green"] = Button(_("Add Timer"))
22 self["key_yellow"] = Button("")
23 self["key_blue"] = Button("")
24 self["actions"] = ActionMap(["OkCancelActions", "EventViewActions"],
28 "pageUp": self.pageUp,
29 "pageDown": self.pageDown,
30 "prevEvent": self.prevEvent,
31 "nextEvent": self.nextEvent,
32 "timerAdd": self.timerAdd
34 self.onShown.append(self.onCreate)
37 self.setEvent(self.event)
38 self.setService(self.currentService)
41 if self.cbFunc is not None:
42 self.cbFunc(self.setEvent, self.setService, -1)
45 if self.cbFunc is not None:
46 self.cbFunc(self.setEvent, self.setService, +1)
49 newEntry = RecordTimerEntry(self.currentService, *parseEvent(self.event))
50 self.session.openWithCallback(self.timerEditFinished, TimerEntry, newEntry)
52 def timerEditFinished(self, answer):
54 self.session.nav.RecordTimer.record(answer[1])
56 print "Timeredit aborted"
58 def setService(self, service):
59 self.currentService=service
60 name = self.currentService.getServiceName()
62 self["channel"].setText(name)
64 self["channel"].setText(_("unknown service"))
66 def setEvent(self, event):
68 text = event.getEventName()
69 short = event.getShortDescription()
70 ext = event.getExtendedDescription()
71 if len(short) > 0 and short != text:
72 text = text + '\n\n' + short
77 self.session.currentDialog.instance.setTitle(event.getEventName())
78 self["epg_description"].setText(text)
79 self["datetime"].setText(event.getBeginTimeString())
80 self["duration"].setText(_("%d min")%(event.getDuration()/60))
83 self["epg_description"].pageUp()
86 self["epg_description"].pageDown()
88 class EventViewSimple(Screen, EventViewBase):
89 def __init__(self, session, Event, Ref, callback=None):
90 Screen.__init__(self, session)
91 self.skinName = "EventView"
92 EventViewBase.__init__(self, Event, Ref, callback)
94 class EventViewEPGSelect(Screen, EventViewBase):
95 def __init__(self, session, Event, Ref, callback=None, singleEPGCB=None, multiEPGCB=None):
96 Screen.__init__(self, session)
97 self.skinName = "EventView"
98 EventViewBase.__init__(self, Event, Ref, callback)
99 self["key_yellow"].setText(_("Single EPG"))
100 self["key_blue"].setText(_("Multi EPG"))
101 self["epgactions"] = ActionMap(["EventViewEPGActions"],
103 "openSingleServiceEPG": singleEPGCB,
104 "openMultiServiceEPG": multiEPGCB