don't translate empty string
[enigma2.git] / lib / python / Components / EventInfo.py
1 from PerServiceDisplay import *
2 from time import strftime
3 from time import localtime
4
5 from enigma import iServiceInformationPtr, eServiceEventPtr
6
7 class EventInfo(PerServiceDisplay):
8         Now = 0
9         Next = 1
10         Now_Duration = 2
11         Next_Duration = 3
12         Now_StartTime = 4
13         Next_StartTime = 5
14         
15         def __init__(self, navcore, now_or_next):
16                 # listen to evUpdatedEventInfo and evStopService
17                 # note that evStopService will be called once to establish a known state
18                 self.now_or_next = now_or_next
19                 PerServiceDisplay.__init__(self, navcore, 
20                         { 
21                                 pNavigation.evUpdatedEventInfo: self.ourEvent, 
22                                 pNavigation.evStopService: self.stopEvent 
23                         })
24
25         def ourEvent(self):
26                 info = iServiceInformationPtr()
27                 service = self.navcore.getCurrentService()
28                 
29                 if service != None:
30                         info = service.info()
31                         if info is not None: 
32                                 ev = info.getEvent(self.now_or_next & 1)
33                                 if ev is not None:
34                                         if (self.Now_Duration <= self.now_or_next <= self.Next_Duration):
35                                                 self.setText("%d min" % (ev.getDuration() / 60))
36                                         if (self.Now_StartTime <= self.now_or_next <= self.Next_StartTime):
37                                                 self.setText(strftime("%H:%M", localtime(ev.getBeginTime())))
38                                         if (self.Now <= self.now_or_next <= self.Next):
39                                                 self.setText(ev.getEventName())
40
41         def stopEvent(self):
42                 self.setText(
43                         #(_("waiting for event data..."), "", "--:--",  "--:--", "--:--", "--:--")[self.now_or_next]);
44                         ((""), "", "--:--",  "--:--", "--:--", "--:--")[self.now_or_next]);
45