diff options
Diffstat (limited to 'lib/python/Components/Sources')
| -rw-r--r-- | lib/python/Components/Sources/Boolean.py | 25 | ||||
| -rw-r--r-- | lib/python/Components/Sources/CurrentService.py | 12 | ||||
| -rw-r--r-- | lib/python/Components/Sources/Makefile.am | 2 |
3 files changed, 32 insertions, 7 deletions
diff --git a/lib/python/Components/Sources/Boolean.py b/lib/python/Components/Sources/Boolean.py new file mode 100644 index 00000000..c25b4626 --- /dev/null +++ b/lib/python/Components/Sources/Boolean.py @@ -0,0 +1,25 @@ +from Source import Source +from enigma import eTimer + +# a small warning: +# you can use that boolean well to express screen-private +# conditional expressions. +# +# however, if you think that there is ANY interest that another +# screen could use your expression, please put your calculation +# into a seperate Source, providing a "boolean"-property. +class Boolean(Source, object): + def __init__(self, fixed = False, function = None, poll = 0): + Source.__init__(self) + if poll > 0: + self.poll_timer = eTimer() + self.poll_timer.timeout.get().append(self.changed) + self.poll_timer.start(poll) + + def getBoolean(self): + if self.function is not None: + return self.function() + else: + return self.fixed + + boolean = property(getBoolean) diff --git a/lib/python/Components/Sources/CurrentService.py b/lib/python/Components/Sources/CurrentService.py index bec6d2dc..2bd493e7 100644 --- a/lib/python/Components/Sources/CurrentService.py +++ b/lib/python/Components/Sources/CurrentService.py @@ -8,15 +8,15 @@ class CurrentService(PerServiceBase, Source): PerServiceBase.__init__(self, navcore, { iPlayableService.evStart: self.changed, - iPlayableService.evEnd: self.changed + iPlayableService.evEnd: self.changed, + # FIXME: we should check 'interesting_events' + # which is not always provided. + iPlayableService.evUpdatedInfo: self.changed, + iPlayableService.evUpdatedEventInfo: self.changed }) self.navcore = navcore def getCurrentService(self): - service = self.navcore.getCurrentService() - return service - - def stopEvent(self): - self.changed() + return self.navcore.getCurrentService() service = property(getCurrentService) diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am index c3a75f86..923c6512 100644 --- a/lib/python/Components/Sources/Makefile.am +++ b/lib/python/Components/Sources/Makefile.am @@ -2,4 +2,4 @@ installdir = $(LIBDIR)/enigma2/python/Components/Sources install_PYTHON = \ __init__.py Clock.py EventInfo.py Source.py MenuList.py CurrentService.py \ - FrontendStatus.py + FrontendStatus.py Boolean.py |
