1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.ScrollLabel import ScrollLabel
from enigma import eServiceEventPtr
from ServiceReference import ServiceReference
from RecordTimer import RecordTimerEntry
from TimerEntry import TimerEntry
class EventView(Screen):
def __init__(self, session, Event, Ref, callback=None):
Screen.__init__(self, session)
self.cbFunc = callback
self.currentService=None
self["epg_description"] = ScrollLabel()
self["datetime"] = Label()
self["channel"] = Label()
self["duration"] = Label()
self["actions"] = ActionMap(["OkCancelActions", "EventViewActions"],
{
"cancel": self.close,
"ok": self.close,
"pageUp": self.pageUp,
"pageDown": self.pageDown,
"prevEvent": self.prevEvent,
"nextEvent": self.nextEvent,
"timerAdd": self.timerAdd
})
self.setEvent(Event)
self.setService(Ref)
def prevEvent(self):
if self.cbFunc is not None:
self.cbFunc(self.setEvent, -1)
def nextEvent(self):
if self.cbFunc is not None:
self.cbFunc(self.setEvent, +1)
def timerAdd(self):
epg = self.event
if (epg == None):
description = "unknown event"
else:
description = epg.getEventName()
# FIXME we need a timestamp here:
begin = epg.getBeginTime()
print begin
print epg.getDuration()
end = begin + epg.getDuration()
# FIXME only works if already playing a service
serviceref = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference())
newEntry = RecordTimerEntry(begin, end, serviceref, epg, description)
self.session.openWithCallback(self.timerEditFinished, TimerEntry, newEntry)
def timerEditFinished(self, answer):
if (answer[0]):
self.session.nav.RecordTimer.record(answer[1])
else:
print "Timeredit aborted"
def setService(self, service):
self.currentService=service
name = self.currentService.getServiceName()
if name is not None:
self["channel"].setText(name)
else:
self["channel"].setText(_("unknown service"))
def setEvent(self, event):
self.event = event
text = event.getEventName()
short = event.getShortDescription()
ext = event.getExtendedDescription()
if len(short) > 0 and short != text:
text = text + '\n\n' + short
if len(ext) > 0:
if len(text) > 0:
text = text + '\n\n'
text = text + ext
self.session.currentDialog.instance.setTitle(event.getEventName())
self["epg_description"].setText(text)
self["datetime"].setText(event.getBeginTimeString())
self["duration"].setText(_("%d min")%(event.getDuration()/60))
def pageUp(self):
self["epg_description"].pageUp()
def pageDown(self):
self["epg_description"].pageDown()
|