diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-02-24 14:14:57 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-02-24 14:14:57 +0000 |
| commit | df7d9f3578c68b22c95ab9daa23bd0fa168f6d11 (patch) | |
| tree | e02e31f3370f92ecaac63d6824942bafead2fbe6 /lib/python/Components | |
| parent | 00baaebc6c9a408dcde721da3fed8b03a90fd28e (diff) | |
| download | enigma2-df7d9f3578c68b22c95ab9daa23bd0fa168f6d11.tar.gz enigma2-df7d9f3578c68b22c95ab9daa23bd0fa168f6d11.zip | |
generic show/hide support for GUIComponents
Diffstat (limited to 'lib/python/Components')
| -rw-r--r-- | lib/python/Components/ConditionalWidget.py | 38 | ||||
| -rw-r--r-- | lib/python/Components/GUIComponent.py | 18 | ||||
| -rw-r--r-- | lib/python/Components/GUISkin.py | 2 | ||||
| -rw-r--r-- | lib/python/Components/Input.py | 6 | ||||
| -rw-r--r-- | lib/python/Components/Label.py | 6 |
5 files changed, 30 insertions, 40 deletions
diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py index b77d8658..07d59e02 100644 --- a/lib/python/Components/ConditionalWidget.py +++ b/lib/python/Components/ConditionalWidget.py @@ -4,17 +4,13 @@ from GUIComponent import * from enigma import * class Widget(GUIComponent): - - SHOWN = 0 - HIDDEN = 1 - def __init__(self): GUIComponent.__init__(self) - self.instance = None - self.state = self.SHOWN def GUIcreate(self, parent): self.instance = self.createWidget(parent) + if self.state == self.HIDDEN: + self.instance.hide() def GUIdelete(self): self.removeWidget(self.instance) @@ -23,14 +19,6 @@ class Widget(GUIComponent): def removeWidget(self, w): pass - def showWidget(self): - self.state = self.SHOWN - self.instance.show() - - def hideWidget(self): - self.state = self.HIDDEN - self.instance.hide() - def move(self, x, y): self.instance.move(ePoint(int(x), int(y))) @@ -50,11 +38,11 @@ class ConditionalWidget(Widget): def activateCondition(self, condition): if (condition): - if (self.state == self.HIDDEN): - self.showWidget() + if self.state == self.HIDDEN: + self.show() else: - if (self.state == self.SHOWN): - self.hideWidget() + if self.state == self.SHOWN: + self.hide() def update(self): if (self.conditionalFunction != None): @@ -83,10 +71,10 @@ class BlinkingWidget(Widget): def blink(self): if self.blinking == True: - if (self.state == self.SHOWN): - self.hideWidget() - elif (self.state == self.HIDDEN): - self.showWidget() + if self.state == self.SHOWN: + self.hide() + elif self.state == self.HIDDEN: + self.show() def startBlinking(self): self.blinking = True @@ -94,8 +82,8 @@ class BlinkingWidget(Widget): def stopBlinking(self): self.blinking = False - if (self.state == self.SHOWN): - self.hideWidget() + if self.state == self.SHOWN: + self.hide() self.timer.stop() class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget): @@ -109,4 +97,4 @@ class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget): self.startBlinking() else: if self.blinking: # we are blinking - self.stopBlinking()
\ No newline at end of file + self.stopBlinking() diff --git a/lib/python/Components/GUIComponent.py b/lib/python/Components/GUIComponent.py index 5483d181..1476ba83 100644 --- a/lib/python/Components/GUIComponent.py +++ b/lib/python/Components/GUIComponent.py @@ -5,8 +5,12 @@ from enigma import ePoint class GUIComponent: """ GUI component """ + SHOWN = 0 + HIDDEN = 1 + def __init__(self): - pass + self.state = self.SHOWN + self.instance = None def execBegin(self): pass @@ -16,7 +20,19 @@ class GUIComponent: # this works only with normal widgets - if you don't have self.instance, override this. def applySkin(self, desktop): + if self.state == self.HIDDEN: + self.instance.hide() skin.applyAllAttributes(self.instance, desktop, self.skinAttributes) def move(self, x, y): self.instance.move(ePoint(int(x), int(y))) + + def show(self): + self.state = self.SHOWN + if self.instance is not None: + self.instance.show() + + def hide(self): + self.state = self.HIDDEN + if self.instance is not None: + self.instance.hide() diff --git a/lib/python/Components/GUISkin.py b/lib/python/Components/GUISkin.py index cf8e1894..f97dd8bd 100644 --- a/lib/python/Components/GUISkin.py +++ b/lib/python/Components/GUISkin.py @@ -25,8 +25,6 @@ class GUISkin: else: f() - - def deleteGUIScreen(self): for (name, val) in self.items(): if isinstance(val, GUIComponent): diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py index a0252e46..f1a17d90 100644 --- a/lib/python/Components/Input.py +++ b/lib/python/Components/Input.py @@ -78,9 +78,3 @@ class Input(HTMLComponent, GUIComponent, VariableText): if self.type == self.PIN or self.type == self.NUMBER: self.right() self.update() - - def show(self): - self.instance.show() - - def hide(self): - self.instance.hide()
\ No newline at end of file diff --git a/lib/python/Components/Label.py b/lib/python/Components/Label.py index 129180f4..5ad071ab 100644 --- a/lib/python/Components/Label.py +++ b/lib/python/Components/Label.py @@ -24,12 +24,6 @@ class Label(HTMLComponent, GUIComponent, VariableText): s = self.instance.calculateSize() return (s.width(), s.height()) - def show(self): - self.instance.show() - - def hide(self): - self.instance.hide() - class LabelConditional(Label, ConditionalWidget): def __init__(self, text = "", withTimer = True): ConditionalWidget.__init__(self, withTimer = withTimer) |
