add new component ValueTestBit to make bit tests
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 1 Nov 2007 23:35:40 +0000 (23:35 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 1 Nov 2007 23:35:40 +0000 (23:35 +0000)
lib/python/Components/Converter/Makefile.am
lib/python/Components/Converter/ValueBitTest.py [new file with mode: 0644]

index 46aac52..b1dc141 100644 (file)
@@ -4,4 +4,5 @@ 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 ValueRange.py RdsInfo.py Streaming.py \
        __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 ValueRange.py RdsInfo.py Streaming.py \
-       StaticMultiList.py ServiceTime.py MovieInfo.py MenuEntryCompare.py StringListSelection.py
+       StaticMultiList.py ServiceTime.py MovieInfo.py MenuEntryCompare.py StringListSelection.py \
+       ValueBitTest.py Global.py
diff --git a/lib/python/Components/Converter/ValueBitTest.py b/lib/python/Components/Converter/ValueBitTest.py
new file mode 100644 (file)
index 0000000..b53a8fc
--- /dev/null
@@ -0,0 +1,13 @@
+from Converter import Converter
+from Components.Element import cached
+
+class ValueBitTest(Converter, object):
+       def __init__(self, arg):
+               Converter.__init__(self, arg)
+               self.value = int(arg)
+
+       @cached
+       def getBoolean(self):
+               return self.source.value & self.value and True or False
+
+       boolean = property(getBoolean)