aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-07-22 17:38:25 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-07-22 17:38:25 +0000
commit1109344c9409572f9829e46971b71a7fe1d3c8cc (patch)
tree2f183531f479e6b94e1bff596b6a84036149296a /lib/python/Components
parente69fde464582ffb74d03510f7ba45542af17d730 (diff)
downloadenigma2-1109344c9409572f9829e46971b71a7fe1d3c8cc.tar.gz
enigma2-1109344c9409572f9829e46971b71a7fe1d3c8cc.zip
show event information of current selected event in channelselection
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Converter/ClockToText.py12
-rw-r--r--lib/python/Components/Converter/EventName.py2
-rw-r--r--lib/python/Components/ServiceList.py15
-rw-r--r--lib/python/Components/Sources/Makefile.am2
4 files changed, 29 insertions, 2 deletions
diff --git a/lib/python/Components/Converter/ClockToText.py b/lib/python/Components/Converter/ClockToText.py
index 5cc709f2..65e431bc 100644
--- a/lib/python/Components/Converter/ClockToText.py
+++ b/lib/python/Components/Converter/ClockToText.py
@@ -7,6 +7,7 @@ class ClockToText(Converter, object):
WITH_SECONDS = 1
IN_MINUTES = 2
DATE = 3
+ FORMAT = 4
# add: date, date as string, weekday, ...
# (whatever you need!)
@@ -19,6 +20,9 @@ class ClockToText(Converter, object):
self.type = self.IN_MINUTES
elif type == "Date":
self.type = self.DATE
+ elif type.find("Format") != -1:
+ self.type = self.FORMAT
+ self.fmt_string = type[7:]
else:
self.type = self.DEFAULT
@@ -40,6 +44,14 @@ class ClockToText(Converter, object):
return "%02d:%02d" % (t.tm_hour, t.tm_min)
elif self.type == self.DATE:
return strftime("%A %B %d, %Y", t)
+ elif self.type == self.FORMAT:
+ spos = self.fmt_string.find('%')
+ if spos > 0:
+ s1 = self.fmt_string[:spos]
+ s2 = strftime(self.fmt_string[spos:], t)
+ return str(s1+s2)
+ else:
+ return strftime(self.fmt_string, t)
else:
return "???"
diff --git a/lib/python/Components/Converter/EventName.py b/lib/python/Components/Converter/EventName.py
index 051e1ea5..b1ec62d0 100644
--- a/lib/python/Components/Converter/EventName.py
+++ b/lib/python/Components/Converter/EventName.py
@@ -22,7 +22,7 @@ class EventName(Converter, object):
def getText(self):
event = self.source.event
if event is None:
- return "N/A"
+ return ""
if self.type == self.NAME:
return event.getEventName()
diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py
index a113eb9b..4a27c768 100644
--- a/lib/python/Components/ServiceList.py
+++ b/lib/python/Components/ServiceList.py
@@ -41,6 +41,19 @@ class ServiceList(HTMLComponent, GUIComponent):
self.root = None
self.mode = self.MODE_NORMAL
+ self.onSelectionChanged = [ ]
+
+ def connectSelChanged(self, fnc):
+ if not fnc in self.onSelectionChanged:
+ self.onSelectionChanged.append(fnc)
+
+ def disconnectSelChanged(self, fnc):
+ if fnc in self.onSelectionChanged:
+ self.onSelectionChanged.remove(fnc)
+
+ def selectionChanged(self):
+ for x in self.onSelectionChanged:
+ x()
def setCurrent(self, ref):
self.l.setCurrent(ref)
@@ -93,6 +106,7 @@ class ServiceList(HTMLComponent, GUIComponent):
def postWidgetCreate(self, instance):
instance.setWrapAround(True)
instance.setContent(self.l)
+ instance.selectionChanged.get().append(self.selectionChanged)
self.setMode(self.mode)
def getRoot(self):
@@ -122,6 +136,7 @@ class ServiceList(HTMLComponent, GUIComponent):
self.l.setRoot(root, justSet)
if not justSet:
self.l.sort()
+ self.selectionChanged()
def removeCurrent(self):
self.l.removeCurrent()
diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am
index 2e0dd449..43efcf5c 100644
--- a/lib/python/Components/Sources/Makefile.am
+++ b/lib/python/Components/Sources/Makefile.am
@@ -3,4 +3,4 @@ installdir = $(LIBDIR)/enigma2/python/Components/Sources
install_PYTHON = \
__init__.py Clock.py EventInfo.py Source.py List.py CurrentService.py \
FrontendStatus.py Boolean.py Config.py ServiceList.py RdsDecoder.py StreamService.py \
- StaticText.py CanvasSource.py
+ StaticText.py CanvasSource.py ServiceEvent.py