diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2009-12-30 17:35:27 +0100 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2009-12-30 17:35:27 +0100 |
| commit | 9a387d949dc2188928fbc19e6cf73da0041dd102 (patch) | |
| tree | a26478a76d7bcd40d4deb29ef7a53e4ef93c79a9 /lib/python/Screens/InfoBarGenerics.py | |
| parent | 699e95c18614b5e6c659a82ae955be6c3920f6e5 (diff) | |
| parent | 4e67809b69b2688c138a47cd0d19337c054c0f6f (diff) | |
| download | enigma2-9a387d949dc2188928fbc19e6cf73da0041dd102.tar.gz enigma2-9a387d949dc2188928fbc19e6cf73da0041dd102.zip | |
Merge branch 'bug_293_indicate_unhandled_key' into experimental
Diffstat (limited to 'lib/python/Screens/InfoBarGenerics.py')
| -rw-r--r-- | lib/python/Screens/InfoBarGenerics.py | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index d2c5a795..8c96c76b 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -26,13 +26,14 @@ from Screens.PictureInPicture import PictureInPicture from Screens.SubtitleDisplay import SubtitleDisplay from Screens.RdsDisplay import RdsInfoDisplay, RassInteractive from Screens.TimeDateInput import TimeDateInput +from Screens.UnhandledKey import UnhandledKey from ServiceReference import ServiceReference from Tools import Notifications from Tools.Directories import fileExists from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \ - iPlayableService, eServiceReference, eEPGCache + iPlayableService, eServiceReference, eEPGCache, eActionMap from time import time, localtime, strftime from os import stat as os_stat @@ -47,6 +48,44 @@ class InfoBarDish: def __init__(self): self.dishDialog = self.session.instantiateDialog(Dish) +class InfoBarUnhandledKey: + def __init__(self): + self.unhandledKeyDialog = self.session.instantiateDialog(UnhandledKey) + self.hideTimer = eTimer() + self.hideTimer.callback.append(self.unhandledKeyDialog.hide) + self.checkUnusedTimer = eTimer() + self.checkUnusedTimer.callback.append(self.checkUnused) + self.onLayoutFinish.append(self.unhandledKeyDialog.hide) + eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self.actionA) #highest prio + eActionMap.getInstance().bindAction('', 0x7FFFFFFF, self.actionB) #lowest prio + self.key = -1; + self.flags = 0; + self.uflags = 0; + + #this function is called on every keypress! + def actionA(self, key, flag): + if flag != 4: + if self.key != key: + if self.checkUnusedTimer.isActive(): + self.checkUnusedTimer.stop() + self.checkUnused() + self.key = key + self.flags = self.uflags = 0 + self.flags |= (1<<flag) + if flag == 1: # break + self.checkUnusedTimer.start(0, True) + return 0 + + #this function is only called when no other action has handled this key + def actionB(self, key, flag): + if flag != 4: + self.uflags |= (1<<flag) + + def checkUnused(self): + if self.flags == self.uflags: + self.unhandledKeyDialog.show() + self.hideTimer.start(2000, True) + class InfoBarShowHide: """ InfoBar show/hide control, accepts toggleShow and hide actions, might start fancy animations. """ |
