X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d279cc40f4a1d927ad00bfe7b0ee3a303e9aed44..e06c6d202696d83a3017861fc690ee3d75750f13:/lib/python/Components/ConditionalWidget.py diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py index 391b8871..192813f5 100644 --- a/lib/python/Components/ConditionalWidget.py +++ b/lib/python/Components/ConditionalWidget.py @@ -1,7 +1,5 @@ -import skin -from GUIComponent import * - -from enigma import * +from GUIComponent import GUIComponent +from enigma import eTimer class ConditionalWidget(GUIComponent): def __init__(self, withTimer = True): @@ -11,9 +9,12 @@ class ConditionalWidget(GUIComponent): if (withTimer): self.conditionCheckTimer = eTimer() - self.conditionCheckTimer.timeout.get().append(self.update) + self.conditionCheckTimer.callback.append(self.update) self.conditionCheckTimer.start(1000) - + + def postWidgetCreate(self, instance): + self.visible = 0 + def setConnect(self, conditionalFunction): self.conditionalFunction = conditionalFunction @@ -26,24 +27,18 @@ class ConditionalWidget(GUIComponent): def update(self): if (self.conditionalFunction != None): try: - self.conditionalFunction() # check, if the conditionalfunction is still valid self.activateCondition(self.conditionalFunction()) except: self.conditionalFunction = None self.activateCondition(False) - -import time class BlinkingWidget(GUIComponent): def __init__(self): GUIComponent.__init__(self) - - self.blinking = True - + self.blinking = False self.setBlinkTime(500) - self.timer = eTimer() - self.timer.timeout.get().append(self.blink) + self.timer.callback.append(self.blink) def setBlinkTime(self, time): self.blinktime = time @@ -61,7 +56,7 @@ class BlinkingWidget(GUIComponent): if self.visible: self.hide() self.timer.stop() - + class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget): def __init__(self): BlinkingWidget.__init__(self)