show green button and subservices-text only when subservices are available (showing...
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 6 Dec 2005 19:10:57 +0000 (19:10 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 6 Dec 2005 19:10:57 +0000 (19:10 +0000)
lib/python/Components/ConditionalWidget.py
lib/python/Components/Label.py
lib/python/Components/Pixmap.py
lib/python/Screens/InfoBarGenerics.py

index 5ff77980a12634b68a2f0f24e6674ac5747e6d6d..eec5b4360a8a4b903cf8f8c46cf50f47c4d35770 100644 (file)
@@ -31,9 +31,6 @@ class Widget(GUIComponent):
                self.state = self.HIDDEN
                self.instance.hide()
        
                self.state = self.HIDDEN
                self.instance.hide()
        
-       def removeWidget(self, instance):
-               pass
-
 class ConditionalWidget(Widget):
        def __init__(self, withTimer = True):
                Widget.__init__(self)
 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):
        def activateCondition(self, condition):
                if (condition):
                        if (self.state == self.HIDDEN):
+                               print "update: " + str(self) + " SHOW"
                                self.showWidget()
                else:
                        if (self.state == self.SHOWN):
                                self.showWidget()
                else:
                        if (self.state == self.SHOWN):
+                               print "update: " + str(self) + " HIDE"
                                self.hideWidget()
 
        def update(self):
                                self.hideWidget()
 
        def update(self):
index c2d577435e7c09b4891a6676fcafa67fb3b20818..c4efcda4753b3fd0165620d3196d8e34d2239140 100644 (file)
@@ -2,6 +2,8 @@ from HTMLComponent import *
 from GUIComponent import *
 from VariableText import *
 
 from GUIComponent import *
 from VariableText import *
 
+from ConditionalWidget import *
+
 from enigma import eLabel
 
 class Label(HTMLComponent, GUIComponent, VariableText):
 from enigma import eLabel
 
 class Label(HTMLComponent, GUIComponent, VariableText):
@@ -27,3 +29,8 @@ class Label(HTMLComponent, GUIComponent, VariableText):
 
        def hide(self):
                self.instance.hide()
 
        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
index 790261188785eef1ad8103eb50648090220136c4..2a54ea9864b8dbba8d814fe6702bbdd635798a7a 100644 (file)
@@ -20,4 +20,5 @@ class Pixmap(Widget):
 class PixmapConditional(ConditionalWidget, Pixmap):
        def __init__(self, withTimer = True):
                ConditionalWidget.__init__(self)
 class PixmapConditional(ConditionalWidget, Pixmap):
        def __init__(self, withTimer = True):
                ConditionalWidget.__init__(self)
+               Pixmap.__init__(self)
 
 
index 43f4222ac57c5a5102b92bf9381dac1a22a652af..cd9719bde1088ca889ace5cbaf73841585fd6388 100644 (file)
@@ -1,7 +1,7 @@
 from Screen import Screen
 from Components.ActionMap import ActionMap, HelpableActionMap
 from Components.ActionMap import NumberActionMap
 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
 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["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()
 #              self["ButtonGreenText"].hide()
 #              self["ButtonGreen"].hidePixmap()
 #              self["ButtonYellow"] = Pixmap()