diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2005-12-06 20:02:48 +0000 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2005-12-06 20:02:48 +0000 |
| commit | 7aaa13924d6d60f6fb66a262ce6ecd8088aee9b6 (patch) | |
| tree | 902ccc93acf3a23ea8c5bb5c187a889041a213b3 /lib/python/Components/ConditionalWidget.py | |
| parent | 60fb5b95387fb30902240b92deed145720fa867a (diff) | |
| download | enigma2-7aaa13924d6d60f6fb66a262ce6ecd8088aee9b6.tar.gz enigma2-7aaa13924d6d60f6fb66a262ce6ecd8088aee9b6.zip | |
the long awaited feature "blinking label" is now available
Diffstat (limited to 'lib/python/Components/ConditionalWidget.py')
| -rw-r--r-- | lib/python/Components/ConditionalWidget.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py index 8fb7c389..8d4af30a 100644 --- a/lib/python/Components/ConditionalWidget.py +++ b/lib/python/Components/ConditionalWidget.py @@ -62,3 +62,51 @@ class ConditionalWidget(Widget): self.activateCondition(False) self.activateCondition(self.conditionalFunction()) + + + +import time + +class BlinkingWidget(Widget): + def __init__(self): + Widget.__init__(self) + + self.blinking = True + + self.setBlinkTime(500) + + self.timer = eTimer() + self.timer.timeout.get().append(self.blink) + + def setBlinkTime(self, time): + self.blinktime = time + + def blink(self): + if self.blinking == True: + if (self.state == self.SHOWN): + self.hideWidget() + elif (self.state == self.HIDDEN): + self.showWidget() + + def startBlinking(self): + self.blinking = True + self.timer.start(self.blinktime) + + def stopBlinking(self): + self.blinking = False + if (self.state == self.SHOWN): + self.hideWidget() + self.timer.stop() + +class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget): + def __init__(self): + BlinkingWidget.__init__(self) + ConditionalWidget.__init__(self) + + def activateCondition(self, condition): + if (condition): + if not self.blinking: # we are already blinking + self.startBlinking() + else: + if self.blinking: # we are blinking + self.stopBlinking()
\ No newline at end of file |
