1 from Source import Source
2 from Components.Element import cached
3 from enigma import eTimer
6 # you can use that boolean well to express screen-private
7 # conditional expressions.
9 # however, if you think that there is ANY interest that another
10 # screen could use your expression, please put your calculation
11 # into a seperate Source, providing a "boolean"-property.
12 class Boolean(Source, object):
13 def __init__(self, fixed = False, function = None, poll = 0):
15 self.function = function
18 self.poll_timer = eTimer()
19 self.poll_timer.callback.append(self.poll)
20 self.poll_timer.start(poll)
22 self.poll_timer = None
26 if self.function is not None:
27 return self.function()
31 def setBoolean(self, value):
32 assert self.function is None
36 boolean = property(getBoolean, setBoolean)
39 self.changed((self.CHANGED_ALL,))
43 self.poll_timer.callback.remove(self.poll)