From: Felix Domke Date: Mon, 26 Jun 2006 19:08:53 +0000 (+0000) Subject: rename 'state' to 'visible', remove boolean-like constants X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=d279cc40f4a1d927ad00bfe7b0ee3a303e9aed44 rename 'state' to 'visible', remove boolean-like constants --- diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py index 7e4304a..391b887 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 c3edaa7..4146130 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)))