add possibility to use ValueRange as ValueEqual Converter
[enigma2.git] / lib / python / Components / Converter / ValueRange.py
1 from Converter import Converter
2 from Components.Element import cached
3
4 class ValueRange(Converter, object):
5         def __init__(self, arg):
6                 Converter.__init__(self, arg)
7                 (self.lower, self.upper) = [int(x) for x in arg.split(',')]
8
9         @cached
10         def getBoolean(self):
11                 if self.lower <= self.upper:
12                         return self.lower <= self.source.value <= self.upper
13                 else:
14                         return not (self.upper < self.source.value < self.lower)
15
16         boolean = property(getBoolean)