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, destroy = None, poll = 0):
15 self.function = function
17 self.post_destroy = destroy
19 self.poll_timer = eTimer()
20 self.poll_timer.callback.append(self.poll)
21 self.poll_timer.start(poll)
23 self.poll_timer = None
27 if self.function is not None:
28 return self.function()
32 def setBoolean(self, value):
33 assert self.function is None
37 boolean = property(getBoolean, setBoolean)
40 self.changed((self.CHANGED_ALL,))
44 self.poll_timer.callback.remove(self.poll)
45 if self.post_destroy is not None:
46 self.fixed = self.post_destroy