From 5c27251fa08566a00d124aaf2c02249995dac9cf Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 12 Nov 2005 23:39:22 +0000 Subject: [PATCH] add starttimes to infobar --- data/skin.xml | 2 ++ lib/python/Components/EventInfo.py | 16 +++++++++++----- lib/python/Screens/InfoBar.py | 3 +++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/data/skin.xml b/data/skin.xml index 2a84d043..24c12afc 100644 --- a/data/skin.xml +++ b/data/skin.xml @@ -136,6 +136,8 @@ + + diff --git a/lib/python/Components/EventInfo.py b/lib/python/Components/EventInfo.py index c8e5a13f..6f6d07ff 100644 --- a/lib/python/Components/EventInfo.py +++ b/lib/python/Components/EventInfo.py @@ -1,4 +1,6 @@ from PerServiceDisplay import * +from time import strftime +from time import localtime from enigma import iServiceInformationPtr, eServiceEventPtr @@ -7,6 +9,8 @@ class EventInfo(PerServiceDisplay): Next = 1 Now_Duration = 2 Next_Duration = 3 + Now_StartTime = 4 + Next_StartTime = 5 def __init__(self, navcore, now_or_next): # listen to evUpdatedEventInfo and evStopService @@ -27,12 +31,14 @@ class EventInfo(PerServiceDisplay): if info is not None: ev = info.getEvent(self.now_or_next & 1) if ev is not None: - if self.now_or_next & 2: - self.setText("%d min" % (ev.m_duration / 60)) - else: - self.setText(ev.m_event_name) + if (self.Now_Duration <= self.now_or_next <= self.Next_Duration): + self.setText("%d min" % (ev.getDuration() / 60)) + if (self.Now_StartTime <= self.now_or_next <= self.Next_StartTime): + self.setText(strftime("%H:%M", localtime(ev.getBeginTime()))) + if (self.Now <= self.now_or_next <= self.Next): + self.setText(ev.getEventName()) def stopEvent(self): self.setText( - ("waiting for event data...", "", "--:--", "--:--")[self.now_or_next]); + ("waiting for event data...", "", "--:--", "--:--", "--:--", "--:--")[self.now_or_next]); diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 46ba24b1..62639c04 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -131,6 +131,9 @@ class InfoBar(Screen): self["ServiceName"] = ServiceName(self.session.nav) + self["Event_Now_StartTime"] = EventInfo(self.session.nav, EventInfo.Now_StartTime) + self["Event_Next_StartTime"] = EventInfo(self.session.nav, EventInfo.Next_StartTime) + self["Event_Now"] = EventInfo(self.session.nav, EventInfo.Now) self["Event_Next"] = EventInfo(self.session.nav, EventInfo.Next) -- 2.30.2