aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/PerServiceDisplay.py
blob: bd94318e119c688c7c1d58eaa466b5752e72808f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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