use new ScrollLabel in EPG EventViewer
[enigma2.git] / lib / python / Screens / EventView.py
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 eWidget, eServiceEventPtr, eLabel
6
7 class EventView(Screen):
8         def __init__(self, session, Event, callback=None):
9                 Screen.__init__(self, session)
10                 self.cbFunc = callback
11                 self["epg_description"] = ScrollLabel()
12                 self["datetime"] = Label()
13                 self["channel"] = Label()
14                 self["duration"] = Label()
15                 self["actions"] = ActionMap(["OkCancelActions", "EventViewActions"],
16                         {
17                                 "cancel": self.close,
18                                 "ok": self.close,
19                                 "pageUp": self.pageUp,
20                                 "pageDown": self.pageDown,
21                                 "prevEvent": self.prevEvent,
22                                 "nextEvent": self.nextEvent
23                         })
24                 self.setEvent(Event)
25
26         def prevEvent(self):
27                 if self.cbFunc is not None:
28                         self.cbFunc(self.setEvent, -1)
29
30         def nextEvent(self):
31                 if self.cbFunc is not None:
32                         self.cbFunc(self.setEvent, +1)
33
34         def setEvent(self, event):
35                 text = event.getShortDescription()
36                 if len(text) > 0:
37                         text = text + '\n\n'
38                 text = text + event.getExtendedDescription()
39                 self["epg_description"].setText(text)
40                 self["datetime"].setText(event.getBeginTimeString())
41                 self["channel"].setText("Unknown Service")
42                 self["duration"].setText("%d min"%(event.getDuration()/60))
43
44         def pageUp(self):
45                 self["epg_description"].pageUp()
46         
47         def pageDown(self):
48                 self["epg_description"].pageDown()