1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.Label import Label
4 from Components.ScrollLabel import ScrollLabel
5 from enigma import eServiceEventPtr
6 from ServiceReference import ServiceReference
8 class EventView(Screen):
9 def __init__(self, session, Event, Ref, callback=None):
10 Screen.__init__(self, session)
11 self.cbFunc = callback
12 self.currentService=None
13 self["epg_description"] = ScrollLabel()
14 self["datetime"] = Label()
15 self["channel"] = Label()
16 self["duration"] = Label()
17 self["actions"] = ActionMap(["OkCancelActions", "EventViewActions"],
21 "pageUp": self.pageUp,
22 "pageDown": self.pageDown,
23 "prevEvent": self.prevEvent,
24 "nextEvent": self.nextEvent
30 if self.cbFunc is not None:
31 self.cbFunc(self.setEvent, -1)
34 if self.cbFunc is not None:
35 self.cbFunc(self.setEvent, +1)
37 def setService(self, service):
38 self.currentService=service
39 name = self.currentService.getServiceName()
41 self["channel"].setText(name)
43 self["channel"].setText("unknown service")
45 def setEvent(self, event):
46 # FIXME .. how to set eWindow titlebar?
47 # self.instance.setTitle(event.getEventName())
48 text = event.getShortDescription()
51 text = text + event.getExtendedDescription()
52 self["epg_description"].setText(text)
53 self["datetime"].setText(event.getBeginTimeString())
54 self["duration"].setText("%d min"%(event.getDuration()/60))
57 self["epg_description"].pageUp()
60 self["epg_description"].pageDown()