git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add space
[enigma2.git]
/
lib
/
python
/
Components
/
Sources
/
Boolean.py
diff --git
a/lib/python/Components/Sources/Boolean.py
b/lib/python/Components/Sources/Boolean.py
index 9ca5613d54227e1fa7b5ae0f0dcf83d04d5efa6e..212d2198600397fd35bf198cff2faa306fd6470f 100644
(file)
--- a/
lib/python/Components/Sources/Boolean.py
+++ b/
lib/python/Components/Sources/Boolean.py
@@
-12,10
+12,14
@@
from enigma import eTimer
class Boolean(Source, object):
def __init__(self, fixed = False, function = None, poll = 0):
Source.__init__(self)
class Boolean(Source, object):
def __init__(self, fixed = False, function = None, poll = 0):
Source.__init__(self)
+ self.function = function
+ self.fixed = fixed
if poll > 0:
self.poll_timer = eTimer()
if poll > 0:
self.poll_timer = eTimer()
- self.poll_timer.
timeout.get()
.append(self.poll)
+ self.poll_timer.
callback
.append(self.poll)
self.poll_timer.start(poll)
self.poll_timer.start(poll)
+ else:
+ self.poll_timer = None
@cached
def getBoolean(self):
@cached
def getBoolean(self):
@@
-24,7
+28,17
@@
class Boolean(Source, object):
else:
return self.fixed
else:
return self.fixed
- boolean = property(getBoolean)
+ def setBoolean(self, value):
+ assert self.function is None
+ self.fixed = value
+ self.poll()
+
+ boolean = property(getBoolean, setBoolean)
def poll(self):
self.changed((self.CHANGED_ALL,))
def poll(self):
self.changed((self.CHANGED_ALL,))
+
+ def destroy(self):
+ if self.poll_timer:
+ self.poll_timer.callback.remove(self.poll)
+ Source.destroy(self)