cleanup
[enigma2.git] / lib / python / Components / ConditionalWidget.py
index 62daf5e69b6efa06751a610cc2fbb1848b9193c2..c1baceb25400a1c98d0c85c9e499a296e9a5579d 100644 (file)
@@ -1,7 +1,5 @@
-import skin
-from GUIComponent import *
-
-from enigma import *
+from GUIComponent import GUIComponent
+from enigma import eTimer
 
 class ConditionalWidget(GUIComponent):
        def __init__(self, withTimer = True):
@@ -18,21 +16,18 @@ class ConditionalWidget(GUIComponent):
                self.conditionalFunction = conditionalFunction
                
        def activateCondition(self, condition):
-               if (condition):
-                       self.state = self.HIDDEN
+               if condition:
+                       self.visible = 1
                else:
-                       self.state = self.SHOWN
+                       self.visible = 0
 
        def update(self):
                if (self.conditionalFunction != None):
                        try:
-                               self.conditionalFunction() # check, if the conditionalfunction is still valid
                                self.activateCondition(self.conditionalFunction())
                        except:
                                self.conditionalFunction = None
                                self.activateCondition(False)
-                       
-import time
 
 class BlinkingWidget(GUIComponent):
        def __init__(self):
@@ -50,10 +45,7 @@ class BlinkingWidget(GUIComponent):
                
        def blink(self):
                if self.blinking == True:
-                       if self.state == self.SHOWN:
-                               self.hide()
-                       elif self.state == self.HIDDEN:
-                               self.show()
+                       self.visible = not self.visible
                        
        def startBlinking(self):
                self.blinking = True
@@ -61,10 +53,10 @@ class BlinkingWidget(GUIComponent):
                
        def stopBlinking(self):
                self.blinking = False
-               if self.state == self.SHOWN:
+               if self.visible:
                        self.hide()
                self.timer.stop()
-               
+
 class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget):
        def __init__(self):
                BlinkingWidget.__init__(self)