self.state = self.HIDDEN
self.instance.hide()
- def removeWidget(self, instance):
- pass
-
class ConditionalWidget(Widget):
def __init__(self, withTimer = True):
Widget.__init__(self)
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):
from GUIComponent import *
from VariableText import *
+from ConditionalWidget import *
+
from enigma import eLabel
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
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
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()