From: Stefan Pluecken Date: Tue, 6 Dec 2005 19:10:57 +0000 (+0000) Subject: show green button and subservices-text only when subservices are available (showing... X-Git-Tag: 2.6.0~4819 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/ed6ab83ab71bbef6d8df689f9ea7f9c1474f625f show green button and subservices-text only when subservices are available (showing of the label doesn't work. why?) --- 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()