fix frontend number query
[enigma2.git] / lib / python / Components / Converter / EventTime.py
index 3c312a6..966f2ca 100644 (file)
@@ -1,6 +1,7 @@
 from Converter import Converter
 from Poll import Poll
 from time import time
 from Converter import Converter
 from Poll import Poll
 from time import time
+from Components.Element import cached
 
 class EventTime(Poll, Converter, object):
        STARTTIME = 0
 
 class EventTime(Poll, Converter, object):
        STARTTIME = 0
@@ -9,8 +10,8 @@ class EventTime(Poll, Converter, object):
        PROGRESS = 3
        DURATION = 4
 
        PROGRESS = 3
        DURATION = 4
 
-       def __init__(self, type, *args, **kwargs):
-               Converter.__init__(self)
+       def __init__(self, type):
+               Converter.__init__(self, type)
                Poll.__init__(self)
                if type == "EndTime":
                        self.type = self.ENDTIME
                Poll.__init__(self)
                if type == "EndTime":
                        self.type = self.ENDTIME
@@ -27,8 +28,9 @@ class EventTime(Poll, Converter, object):
                        self.poll_interval = 30*1000
                        self.poll_enabled = True
                else:
                        self.poll_interval = 30*1000
                        self.poll_enabled = True
                else:
-                       raise str("'%s' is not <StartTime|EndTime|Remaining|Duration> for EventTime converter" % type)
+                       raise str("'%s' is not <StartTime|EndTime|Remaining|Duration|Progress> for EventTime converter" % type)
 
 
+       @cached
        def getTime(self):
                assert self.type != self.PROGRESS
 
        def getTime(self):
                assert self.type != self.PROGRESS
 
@@ -52,6 +54,7 @@ class EventTime(Poll, Converter, object):
                        else:
                                return (duration, None)
 
                        else:
                                return (duration, None)
 
+       @cached
        def getValue(self):
                assert self.type == self.PROGRESS
 
        def getValue(self):
                assert self.type == self.PROGRESS
 
@@ -70,3 +73,11 @@ class EventTime(Poll, Converter, object):
        time = property(getTime)
        value = property(getValue)
        range = 1000
        time = property(getTime)
        value = property(getValue)
        range = 1000
+
+       def changed(self, what):
+               Converter.changed(self, what)
+               if self.type == self.PROGRESS and len(self.downstream_elements):
+                       if not self.source.event and self.downstream_elements[0].visible:
+                               self.downstream_elements[0].visible = False
+                       elif self.source.event and not self.downstream_elements[0].visible:
+                               self.downstream_elements[0].visible = True