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.timeout.get().append(self.update)
13 self.conditionCheckTimer.start(1000)
15 def setConnect(self, conditionalFunction):
16 self.conditionalFunction = conditionalFunction
18 def activateCondition(self, condition):
25 if (self.conditionalFunction != None):
27 self.activateCondition(self.conditionalFunction())
29 self.conditionalFunction = None
30 self.activateCondition(False)
32 class BlinkingWidget(GUIComponent):
34 GUIComponent.__init__(self)
38 self.setBlinkTime(500)
41 self.timer.timeout.get().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