1 from GUIComponent import GUIComponent
2 from enigma import eTimer
4 class ConditionalWidget(GUIComponent):
5 def __init__(self, withTimer = True):
6 GUIComponent.__init__(self)
11 self.conditionCheckTimer = eTimer()
12 self.conditionCheckTimer.callback.append(self.update)
13 self.conditionCheckTimer.start(1000)
15 def postWidgetCreate(self, instance):
18 def setConnect(self, conditionalFunction):
19 self.conditionalFunction = conditionalFunction
21 def activateCondition(self, condition):
28 if (self.conditionalFunction != None):
30 self.activateCondition(self.conditionalFunction())
32 self.conditionalFunction = None
33 self.activateCondition(False)
35 class BlinkingWidget(GUIComponent):
37 GUIComponent.__init__(self)
39 self.setBlinkTime(500)
41 self.timer.callback.append(self.blink)
43 def setBlinkTime(self, time):
47 if self.blinking == True:
48 self.visible = not self.visible
50 def startBlinking(self):
52 self.timer.start(self.blinktime)
54 def stopBlinking(self):
60 class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget):
62 BlinkingWidget.__init__(self)
63 ConditionalWidget.__init__(self)
65 def activateCondition(self, condition):
67 if not self.blinking: # we are already blinking
70 if self.blinking: # we are blinking