aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/PerServiceDisplay.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/Components/PerServiceDisplay.py')
-rw-r--r--lib/python/Components/PerServiceDisplay.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/python/Components/PerServiceDisplay.py b/lib/python/Components/PerServiceDisplay.py
new file mode 100644
index 00000000..bd94318e
--- /dev/null
+++ b/lib/python/Components/PerServiceDisplay.py
@@ -0,0 +1,30 @@
+from GUIComponent import *
+from VariableText import *
+
+from enigma import pNavigation
+from enigma import eLabel
+
+class PerServiceDisplay(GUIComponent, VariableText):
+ """Mixin for building components which display something which changes on navigation events, for example "service name" """
+
+ def __init__(self, navcore, eventmap):
+ GUIComponent.__init__(self)
+ VariableText.__init__(self)
+ self.eventmap = eventmap
+ self.navcore = navcore
+ self.navcore.event.append(self.event)
+
+ # start with stopped state, so simulate that
+ self.event(pNavigation.evStopService)
+
+ def event(self, ev):
+ # loop up if we need to handle this event
+ if self.eventmap.has_key(ev):
+ # call handler
+ self.eventmap[ev]()
+
+ def createWidget(self, parent, skindata):
+ # by default, we use a label to display our data.
+ g = eLabel(parent)
+ return g
+