- split of Components into different files
[enigma2.git] / lib / python / Components / PerServiceDisplay.py
1 from GUIComponent import *
2 from VariableText import *
3
4 from enigma import pNavigation
5 from enigma import eLabel
6
7 class PerServiceDisplay(GUIComponent, VariableText):
8         """Mixin for building components which display something which changes on navigation events, for example "service name" """
9         
10         def __init__(self, navcore, eventmap):
11                 GUIComponent.__init__(self)
12                 VariableText.__init__(self)
13                 self.eventmap = eventmap
14                 self.navcore = navcore
15                 self.navcore.event.append(self.event)
16
17                 # start with stopped state, so simulate that
18                 self.event(pNavigation.evStopService)
19
20         def event(self, ev):
21                 # loop up if we need to handle this event
22                 if self.eventmap.has_key(ev):
23                         # call handler
24                         self.eventmap[ev]()
25         
26         def createWidget(self, parent, skindata):
27                 # by default, we use a label to display our data.
28                 g = eLabel(parent)
29                 return g
30