rename 'state' to 'visible', remove boolean-like constants
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 26 Jun 2006 19:08:53 +0000 (19:08 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 26 Jun 2006 19:08:53 +0000 (19:08 +0000)
lib/python/Components/ConditionalWidget.py
lib/python/Components/GUIComponent.py

index 7e4304a..391b887 100644 (file)
@@ -19,9 +19,9 @@ class ConditionalWidget(GUIComponent):
                
        def activateCondition(self, condition):
                if condition:
                
        def activateCondition(self, condition):
                if condition:
-                       self.state = self.SHOWN
+                       self.visible = 1
                else:
                else:
-                       self.state = self.HIDDEN
+                       self.visible = 0
 
        def update(self):
                if (self.conditionalFunction != None):
 
        def update(self):
                if (self.conditionalFunction != None):
@@ -50,10 +50,7 @@ class BlinkingWidget(GUIComponent):
                
        def blink(self):
                if self.blinking == True:
                
        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
                        
        def startBlinking(self):
                self.blinking = True
@@ -61,7 +58,7 @@ class BlinkingWidget(GUIComponent):
                
        def stopBlinking(self):
                self.blinking = False
                
        def stopBlinking(self):
                self.blinking = False
-               if self.state == self.SHOWN:
+               if self.visible:
                        self.hide()
                self.timer.stop()
                
                        self.hide()
                self.timer.stop()
                
index c3edaa7..4146130 100644 (file)
@@ -5,12 +5,9 @@ from enigma import ePoint
 class GUIComponent(object):
        """ GUI component """
        
 class GUIComponent(object):
        """ GUI component """
        
-       SHOWN = 0
-       HIDDEN = 1
-       
        def __init__(self):
                self.instance = None
        def __init__(self):
                self.instance = None
-               self.state = self.SHOWN
+               self.visible = 1
        
        def execBegin(self):
                pass
        
        def execBegin(self):
                pass
@@ -29,7 +26,7 @@ class GUIComponent(object):
        
        # this works only with normal widgets - if you don't have self.instance, override this.
        def applySkin(self, desktop):
        
        # this works only with normal widgets - if you don't have self.instance, override this.
        def applySkin(self, desktop):
-               if self.state == self.HIDDEN:
+               if not self.visible:
                        self.instance.hide()
                skin.applyAllAttributes(self.instance, desktop, self.skinAttributes)
 
                        self.instance.hide()
                skin.applyAllAttributes(self.instance, desktop, self.skinAttributes)
 
@@ -37,25 +34,25 @@ class GUIComponent(object):
                self.instance.move(ePoint(int(x), int(y)))
 
        def show(self):
                self.instance.move(ePoint(int(x), int(y)))
 
        def show(self):
-               self.__state = self.SHOWN
+               self.__visible = 1
                if self.instance is not None:
                        self.instance.show()
 
        def hide(self):
                if self.instance is not None:
                        self.instance.show()
 
        def hide(self):
-               self.__state = self.HIDDEN
+               self.__visible = 0
                if self.instance is not None:
                        self.instance.hide()
 
                if self.instance is not None:
                        self.instance.hide()
 
-       def getState(self):
-               return self.__state
+       def getVisible(self):
+               return self.__visible
        
        
-       def setState(self, state):
-               if state == self.SHOWN:
+       def setVisible(self, visible):
+               if visible:
                        self.show()
                        self.show()
-               elif state == self.HIDDEN:
+               else:
                        self.hide()
 
                        self.hide()
 
-       state = property(getState, setState)
+       visible = property(getVisible, setVisible)
 
        def setPosition(self, x, y):
                self.instance.move(ePoint(int(x), int(y)))
 
        def setPosition(self, x, y):
                self.instance.move(ePoint(int(x), int(y)))