the long awaited feature "blinking label" is now available
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 6 Dec 2005 20:02:48 +0000 (20:02 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 6 Dec 2005 20:02:48 +0000 (20:02 +0000)
lib/python/Components/BlinkingPixmap.py
lib/python/Components/ConditionalWidget.py
lib/python/Components/Label.py

index c1b4262ff166a90e60dcde58a6c9db5ae17e13e6..fef80620ffa71a07eb8ec9a6c4e56c80085da821 100644 (file)
@@ -1,49 +1,11 @@
 from Pixmap import *
+from ConditionalWidget import *
 
-from enigma import *
-
-import time
-
-class BlinkingPixmap(Pixmap):
+class BlinkingPixmap(BlinkingWidget):
        def __init__(self):
-               Pixmap.__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)
+               Widget.__init__(self)
                
-       def stopBlinking(self):
-               self.blinking = False
-               if (self.state == self.SHOWN):
-                       self.hideWidget()
-               self.timer.stop()
-               
-class BlinkingPixmapConditional(BlinkingPixmap, PixmapConditional):
+class BlinkingPixmapConditional(BlinkingWidgetConditional, PixmapConditional):
        def __init__(self):
-               BlinkingPixmap.__init__(self)
+               BlinkingWidgetConditional.__init__(self)
                PixmapConditional.__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()
index 8fb7c38935437d1d048f771ecfb894a89f7ae1ad..8d4af30a397147a84579dba6209c909ec9d8e223 100644 (file)
@@ -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
index 730a01e594b33b1cfd0c8cb713cfb6a5eaf2ddfa..129180f4e7b7476985785d266f6bb4eb5f955f6b 100644 (file)
@@ -33,4 +33,27 @@ class Label(HTMLComponent, GUIComponent, VariableText):
 class LabelConditional(Label, ConditionalWidget):
        def __init__(self, text = "", withTimer = True):
                ConditionalWidget.__init__(self, withTimer = withTimer)
-               Label.__init__(self, text = text)
\ No newline at end of file
+               Label.__init__(self, text = text)
+               
+class BlinkingLabel(Label, BlinkingWidget):
+       def __init__(self, text = ""):
+               Label.__init__(text = text)
+               BlinkingWidget.__init__()
+
+       def GUIcreate(self, parent):
+               LabelConditional.GUIcreate(self, parent)
+       
+       def GUIdelete(self):
+               LabelConditional.GUIcreate(self)
+               
+class BlinkingLabelConditional(BlinkingWidgetConditional, LabelConditional):
+       def __init__(self, text = ""):
+               LabelConditional.__init__(self, text = text)
+               BlinkingWidgetConditional.__init__(self)
+               
+       def GUIcreate(self, parent):
+               LabelConditional.GUIcreate(self, parent)
+       
+       def GUIdelete(self):
+               LabelConditional.GUIcreate(self)
+               
\ No newline at end of file