diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-06-26 19:08:53 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-06-26 19:08:53 +0000 |
| commit | d279cc40f4a1d927ad00bfe7b0ee3a303e9aed44 (patch) | |
| tree | d8654fba3f2d84b0c35fb781d9a977c9ee242c9d | |
| parent | 21006e5dadcc191222dd103b163b1bbd9f76c742 (diff) | |
| download | enigma2-d279cc40f4a1d927ad00bfe7b0ee3a303e9aed44.tar.gz enigma2-d279cc40f4a1d927ad00bfe7b0ee3a303e9aed44.zip | |
rename 'state' to 'visible', remove boolean-like constants
| -rw-r--r-- | lib/python/Components/ConditionalWidget.py | 11 | ||||
| -rw-r--r-- | lib/python/Components/GUIComponent.py | 23 |
2 files changed, 14 insertions, 20 deletions
diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py index 7e4304ae..391b8871 100644 --- a/lib/python/Components/ConditionalWidget.py +++ b/lib/python/Components/ConditionalWidget.py @@ -19,9 +19,9 @@ class ConditionalWidget(GUIComponent): def activateCondition(self, condition): if condition: - self.state = self.SHOWN + self.visible = 1 else: - self.state = self.HIDDEN + self.visible = 0 def update(self): if (self.conditionalFunction != None): @@ -50,10 +50,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,7 +58,7 @@ class BlinkingWidget(GUIComponent): def stopBlinking(self): self.blinking = False - if self.state == self.SHOWN: + if self.visible: self.hide() self.timer.stop() diff --git a/lib/python/Components/GUIComponent.py b/lib/python/Components/GUIComponent.py index c3edaa73..41461306 100644 --- a/lib/python/Components/GUIComponent.py +++ b/lib/python/Components/GUIComponent.py @@ -5,12 +5,9 @@ from enigma import ePoint class GUIComponent(object): """ GUI component """ - SHOWN = 0 - HIDDEN = 1 - def __init__(self): self.instance = None - self.state = self.SHOWN + self.visible = 1 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): - if self.state == self.HIDDEN: + if not self.visible: 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.__state = self.SHOWN + self.__visible = 1 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() - 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() - elif state == self.HIDDEN: + else: self.hide() - state = property(getState, setState) + visible = property(getVisible, setVisible) def setPosition(self, x, y): self.instance.move(ePoint(int(x), int(y))) |
