1 from GUIComponent import *
2 from VariableText import *
3 from VariableValue import *
5 from enigma import iPlayableService
6 from enigma import eLabel, eSlider, eTimer
8 class PerServiceBase(object):
9 def __init__(self, navcore, eventmap):
10 self.eventmap = eventmap
11 self.navcore = navcore
12 self.navcore.event.append(self.event)
13 self.poll_timer = eTimer()
14 self.poll_timer.timeout.get().append(self.poll)
16 # start with stopped state, so simulate that
17 self.event(iPlayableService.evEnd)
20 self.navcore.event.remove(self.event)
23 # loop up if we need to handle this event
24 if self.eventmap.has_key(ev):
28 def enablePolling(self, interval=60000):
30 self.poll_timer.start(interval)
32 self.poll_timer.stop()
34 def disablePolling(self):
35 self.enablePolling(interval=0)
40 class PerServiceDisplay(PerServiceBase, VariableText, GUIComponent):
41 """Mixin for building components which display something which changes on navigation events, for example "service name" """
42 def __init__(self, navcore, eventmap):
43 GUIComponent.__init__(self)
44 VariableText.__init__(self)
45 PerServiceBase.__init__(self, navcore, eventmap)
49 class PerServiceDisplayProgress(PerServiceBase, VariableValue, GUIComponent):
50 def __init__(self, navcore, eventmap):
51 GUIComponent.__init__(self)
52 VariableValue.__init__(self)
53 self.eventmap = eventmap
54 self.navcore = navcore
55 self.navcore.event.append(self.event)
57 # start with stopped state, so simulate that
58 self.event(iPlayableService.evEnd)