aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-12-06 19:10:57 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-12-06 19:10:57 +0000
commited6ab83ab71bbef6d8df689f9ea7f9c1474f625f (patch)
treef2ffa0f280e4452c341ebae6c4aad464eb2af4f8
parent64e44eef78c26d1d6d5a1662ad1d105fb96e9061 (diff)
downloadenigma2-ed6ab83ab71bbef6d8df689f9ea7f9c1474f625f.tar.gz
enigma2-ed6ab83ab71bbef6d8df689f9ea7f9c1474f625f.zip
show green button and subservices-text only when subservices are available (showing of the label doesn't work. why?)
-rw-r--r--lib/python/Components/ConditionalWidget.py5
-rw-r--r--lib/python/Components/Label.py7
-rw-r--r--lib/python/Components/Pixmap.py1
-rw-r--r--lib/python/Screens/InfoBarGenerics.py9
4 files changed, 16 insertions, 6 deletions
diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py
index 5ff77980..eec5b436 100644
--- a/lib/python/Components/ConditionalWidget.py
+++ b/lib/python/Components/ConditionalWidget.py
@@ -31,9 +31,6 @@ class Widget(GUIComponent):
self.state = self.HIDDEN
self.instance.hide()
- def removeWidget(self, instance):
- pass
-
class ConditionalWidget(Widget):
def __init__(self, withTimer = True):
Widget.__init__(self)
@@ -51,9 +48,11 @@ class ConditionalWidget(Widget):
def activateCondition(self, condition):
if (condition):
if (self.state == self.HIDDEN):
+ print "update: " + str(self) + " SHOW"
self.showWidget()
else:
if (self.state == self.SHOWN):
+ print "update: " + str(self) + " HIDE"
self.hideWidget()
def update(self):
diff --git a/lib/python/Components/Label.py b/lib/python/Components/Label.py
index c2d57743..c4efcda4 100644
--- a/lib/python/Components/Label.py
+++ b/lib/python/Components/Label.py
@@ -2,6 +2,8 @@ from HTMLComponent import *
from GUIComponent import *
from VariableText import *
+from ConditionalWidget import *
+
from enigma import eLabel
class Label(HTMLComponent, GUIComponent, VariableText):
@@ -27,3 +29,8 @@ class Label(HTMLComponent, GUIComponent, VariableText):
def hide(self):
self.instance.hide()
+
+class LabelConditional(ConditionalWidget, Label):
+ def __init__(self, text = "", withTimer = True):
+ ConditionalWidget.__init__(self, withTimer = withTimer)
+ Label.__init__(self, text = text) \ No newline at end of file
diff --git a/lib/python/Components/Pixmap.py b/lib/python/Components/Pixmap.py
index 79026118..2a54ea98 100644
--- a/lib/python/Components/Pixmap.py
+++ b/lib/python/Components/Pixmap.py
@@ -20,4 +20,5 @@ class Pixmap(Widget):
class PixmapConditional(ConditionalWidget, Pixmap):
def __init__(self, withTimer = True):
ConditionalWidget.__init__(self)
+ Pixmap.__init__(self)
diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py
index 43f4222a..cd9719bd 100644
--- a/lib/python/Screens/InfoBarGenerics.py
+++ b/lib/python/Screens/InfoBarGenerics.py
@@ -1,7 +1,7 @@
from Screen import Screen
from Components.ActionMap import ActionMap, HelpableActionMap
from Components.ActionMap import NumberActionMap
-from Components.Label import Label
+from Components.Label import *
from Components.config import configfile, configsequencearg
from Components.config import config, configElement, ConfigSubsection, configSequence
from ChannelSelection import ChannelSelection
@@ -548,8 +548,11 @@ class InfoBarAdditionalInfo:
self["ButtonRed"] = Pixmap()
self["ButtonRedText"] = Label(_("Record"))
- self["ButtonGreen"] = Pixmap()
- self["ButtonGreenText"] = Label(_("Subservices"))
+ self["ButtonGreen"] = PixmapConditional()
+ self["ButtonGreen"].setConnect(lambda: self.session.nav.getCurrentService().subServices().getNumberOfSubservices() > 0)
+# self["ButtonGreenText"] = Label(text = _("Subservices"))
+ self["ButtonGreenText"] = LabelConditional(text = _("Subservices"), withTimer = True)
+ self["ButtonGreenText"].setConnect(lambda: self.session.nav.getCurrentService().subServices().getNumberOfSubservices() > 0)
# self["ButtonGreenText"].hide()
# self["ButtonGreen"].hidePixmap()
# self["ButtonYellow"] = Pixmap()