1 from GUIComponent import *
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.conditionalFunction() # check, if the conditionalfunction is still valid
28 self.activateCondition(self.conditionalFunction())
30 self.conditionalFunction = None
31 self.activateCondition(False)
35 class BlinkingWidget(GUIComponent):
37 GUIComponent.__init__(self)
41 self.setBlinkTime(500)
44 self.timer.timeout.get().append(self.blink)
46 def setBlinkTime(self, time):
50 if self.blinking == True:
51 self.visible = not self.visible
53 def startBlinking(self):
55 self.timer.start(self.blinktime)
57 def stopBlinking(self):
63 class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget):
65 BlinkingWidget.__init__(self)
66 ConditionalWidget.__init__(self)
68 def activateCondition(self, condition):
70 if not self.blinking: # we are already blinking
73 if self.blinking: # we are blinking