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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
from GUIComponent import *
from VariableText import *
from VariableValue import *
from enigma import pNavigation
from enigma import eLabel, eSlider
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):
# by default, we use a label to display our data.
g = eLabel(parent)
return g
class PerServiceDisplayProgress(GUIComponent, VariableValue, PerServiceDisplay):
def __init__(self, navcore, eventmap):
GUIComponent.__init__(self)
VariableValue.__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 createWidget(self, parent):
# by default, we use a label to display our data.
self.g = eSlider(parent)
return self.g
|