git.cweiske.de
/
enigma2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
00baaeb
)
generic show/hide support for GUIComponents
author
Felix Domke
<tmbinc@elitedvb.net>
Fri, 24 Feb 2006 14:14:57 +0000
(14:14 +0000)
committer
Felix Domke
<tmbinc@elitedvb.net>
Fri, 24 Feb 2006 14:14:57 +0000
(14:14 +0000)
lib/python/Components/ConditionalWidget.py
patch
|
blob
|
history
lib/python/Components/GUIComponent.py
patch
|
blob
|
history
lib/python/Components/GUISkin.py
patch
|
blob
|
history
lib/python/Components/Input.py
patch
|
blob
|
history
lib/python/Components/Label.py
patch
|
blob
|
history
lib/python/Screens/EpgSelection.py
patch
|
blob
|
history
lib/python/Screens/HelpMenu.py
patch
|
blob
|
history
diff --git
a/lib/python/Components/ConditionalWidget.py
b/lib/python/Components/ConditionalWidget.py
index b77d8658b1149f320f4d67fc7833ce5b7dc71ee3..07d59e02be63a658a259cc148197e0785015a751 100644
(file)
--- 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):
from enigma import *
class Widget(GUIComponent):
-
- SHOWN = 0
- HIDDEN = 1
-
def __init__(self):
GUIComponent.__init__(self)
def __init__(self):
GUIComponent.__init__(self)
- self.instance = None
- self.state = self.SHOWN
def GUIcreate(self, parent):
self.instance = self.createWidget(parent)
def GUIcreate(self, parent):
self.instance = self.createWidget(parent)
+ if self.state == self.HIDDEN:
+ self.instance.hide()
def GUIdelete(self):
self.removeWidget(self.instance)
def GUIdelete(self):
self.removeWidget(self.instance)
@@
-23,14
+19,6
@@
class Widget(GUIComponent):
def removeWidget(self, w):
pass
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)))
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):
def activateCondition(self, condition):
if (condition):
- if
(self.state == self.HIDDEN)
:
- self.show
Widget
()
+ if
self.state == self.HIDDEN
:
+ self.show()
else:
else:
- if
(self.state == self.SHOWN)
:
- self.hide
Widget
()
+ if
self.state == self.SHOWN
:
+ self.hide()
def update(self):
if (self.conditionalFunction != None):
def update(self):
if (self.conditionalFunction != None):
@@
-83,10
+71,10
@@
class BlinkingWidget(Widget):
def blink(self):
if self.blinking == True:
def blink(self):
if self.blinking == True:
- if
(self.state == self.SHOWN)
:
- self.hide
Widget
()
- elif
(self.state == self.HIDDEN)
:
- self.show
Widget
()
+ if
self.state == self.SHOWN
:
+ self.hide()
+ elif
self.state == self.HIDDEN
:
+ self.show()
def startBlinking(self):
self.blinking = True
def startBlinking(self):
self.blinking = True
@@
-94,8
+82,8
@@
class BlinkingWidget(Widget):
def stopBlinking(self):
self.blinking = False
def stopBlinking(self):
self.blinking = False
- if
(self.state == self.SHOWN)
:
- self.hide
Widget
()
+ if
self.state == self.SHOWN
:
+ self.hide()
self.timer.stop()
class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget):
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.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 5483d181773a54f08c0033630edd58505376d6a8..1476ba8393b02f0f6ae2da89916df7cff74acb96 100644
(file)
--- a/
lib/python/Components/GUIComponent.py
+++ b/
lib/python/Components/GUIComponent.py
@@
-5,8
+5,12
@@
from enigma import ePoint
class GUIComponent:
""" GUI component """
class GUIComponent:
""" GUI component """
+ SHOWN = 0
+ HIDDEN = 1
+
def __init__(self):
def __init__(self):
- pass
+ self.state = self.SHOWN
+ self.instance = None
def execBegin(self):
pass
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):
# 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)))
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 cf8e1894bf50b8dde0a9cfe201c6183adbd1bde2..f97dd8bd9809dbf6f02034be68f0da1d2a193782 100644
(file)
--- a/
lib/python/Components/GUISkin.py
+++ b/
lib/python/Components/GUISkin.py
@@
-25,8
+25,6
@@
class GUISkin:
else:
f()
else:
f()
-
-
def deleteGUIScreen(self):
for (name, val) in self.items():
if isinstance(val, GUIComponent):
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 a0252e46d83f13976468972013efee436c254371..f1a17d90b8f042453d18418a4c9ff9af4b648506 100644
(file)
--- 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()
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 129180f4e7b7476985785d266f6bb4eb5f955f6b..5ad071abbfcdb2843548836751c2ce0ccac95972 100644
(file)
--- 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())
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)
class LabelConditional(Label, ConditionalWidget):
def __init__(self, text = "", withTimer = True):
ConditionalWidget.__init__(self, withTimer = withTimer)
diff --git
a/lib/python/Screens/EpgSelection.py
b/lib/python/Screens/EpgSelection.py
index c8db81b33ba4ed8662f5f2409f013a9add88ff10..378e0d8976b727539cc351a9ec70b4d3cceef628 100644
(file)
--- a/
lib/python/Screens/EpgSelection.py
+++ b/
lib/python/Screens/EpgSelection.py
@@
-155,25
+155,25
@@
class EPGSelection(Screen):
def applyButtonState(self, state):
if state == 1:
def applyButtonState(self, state):
if state == 1:
- self["now_button_sel"].show
Widget
()
- self["now_button"].hide
Widget
()
+ self["now_button_sel"].show()
+ self["now_button"].hide()
else:
else:
- self["now_button"].show
Widget
()
- self["now_button_sel"].hide
Widget
()
+ self["now_button"].show()
+ self["now_button_sel"].hide()
if state == 2:
if state == 2:
- self["next_button_sel"].show
Widget
()
- self["next_button"].hide
Widget
()
+ self["next_button_sel"].show()
+ self["next_button"].hide()
else:
else:
- self["next_button"].show
Widget
()
- self["next_button_sel"].hide
Widget
()
+ self["next_button"].show()
+ self["next_button_sel"].hide()
if state == 3:
if state == 3:
- self["more_button_sel"].show
Widget
()
- self["more_button"].hide
Widget
()
+ self["more_button_sel"].show()
+ self["more_button"].hide()
else:
else:
- self["more_button"].show
Widget
()
- self["more_button_sel"].hide
Widget
()
+ self["more_button"].show()
+ self["more_button_sel"].hide()
def onSelectionChanged(self):
if self.type == EPG_TYPE_MULTI:
def onSelectionChanged(self):
if self.type == EPG_TYPE_MULTI:
diff --git
a/lib/python/Screens/HelpMenu.py
b/lib/python/Screens/HelpMenu.py
index e947ac914c2c1e6f0eaa1af75e9e53d526d371a1..06f0cfaba3249b732a3ac1e133fe4f386f8485a5 100644
(file)
--- a/
lib/python/Screens/HelpMenu.py
+++ b/
lib/python/Screens/HelpMenu.py
@@
-31,12
+31,14
@@
class HelpMenu(Screen):
def SelectionChanged(self):
selection = self["list"].getCurrent()[3]
def SelectionChanged(self):
selection = self["list"].getCurrent()[3]
+ arrow = self["arrowup"]
+
if selection is None:
if selection is None:
-
self["arrowup"].instance
.hide()
+
arrow
.hide()
else:
else:
-
self["arrowup"]
.moveTo(selection[1], selection[2], 1)
-
self["arrowup"]
.startMoving()
-
self["arrowup"].instance
.show()
+
arrow
.moveTo(selection[1], selection[2], 1)
+
arrow
.startMoving()
+
arrow
.show()
class HelpableScreen:
def __init__(self):
class HelpableScreen:
def __init__(self):
@@
-44,8
+46,10
@@
class HelpableScreen:
{
"displayHelp": self.showHelp,
})
{
"displayHelp": self.showHelp,
})
+
def showHelp(self):
self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList)
def showHelp(self):
self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList)
+
def callHelpAction(self, *args):
if len(args):
(actionmap, context, action) = args
def callHelpAction(self, *args):
if len(args):
(actionmap, context, action) = args