add ValueRange converter
authorFelix Domke <tmbinc@elitedvb.net>
Fri, 14 Jul 2006 21:58:56 +0000 (21:58 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Fri, 14 Jul 2006 21:58:56 +0000 (21:58 +0000)
lib/python/Components/Converter/Makefile.am
lib/python/Components/Converter/ValueRange.py [new file with mode: 0644]

index a04b963..8b7d3a2 100644 (file)
@@ -3,5 +3,4 @@ installdir = $(LIBDIR)/enigma2/python/Components/Converter
 install_PYTHON = \
        __init__.py ClockToText.py Converter.py EventName.py StaticText.py EventTime.py \
        Poll.py RemainingToText.py StringList.py ServiceName.py FrontendInfo.py ServiceInfo.py \
-       ConditionalShowHide.py ServicePosition.py
-
+       ConditionalShowHide.py ServicePosition.py ValueRange.py
diff --git a/lib/python/Components/Converter/ValueRange.py b/lib/python/Components/Converter/ValueRange.py
new file mode 100644 (file)
index 0000000..7fdbb48
--- /dev/null
@@ -0,0 +1,14 @@
+from Converter import Converter
+
+class ValueRange(Converter, object):
+       def __init__(self, arg, *args, **kwargs):
+               Converter.__init__(self)
+               (self.lower, self.upper) = [int(x) for x in arg.split(',')]
+
+       def getBoolean(self):
+               if self.lower < self.upper:
+                       return self.lower < self.source.value < self.upper
+               else:
+                       return not (self.upper < self.source.value < self.lower)
+
+       boolean = property(getBoolean)