add possibility to use ValueRange as ValueEqual Converter
[enigma2.git] / lib / python / Components / Converter / EventTime.py
index 09fe6bf..966f2ca 100644 (file)
@@ -1,6 +1,7 @@
 from Converter import Converter
 from Poll import Poll
 from time import time
+from Components.Element import cached
 
 class EventTime(Poll, Converter, object):
        STARTTIME = 0
@@ -27,8 +28,9 @@ class EventTime(Poll, Converter, object):
                        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
 
@@ -52,6 +54,7 @@ class EventTime(Poll, Converter, object):
                        else:
                                return (duration, None)
 
+       @cached
        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
+
+       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