show a short symbol when a unhandled key is pressed
authorghost <andreas.monzner@multimedia-labs.de>
Wed, 30 Dec 2009 16:11:58 +0000 (17:11 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Wed, 30 Dec 2009 16:11:58 +0000 (17:11 +0100)
this fixes bug #293

data/skin_default.xml
data/skin_default/Makefile.am
data/skin_default/unhandled-key.png [new file with mode: 0644]
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/Makefile.am
lib/python/Screens/UnhandledKey.py [new file with mode: 0644]

index 71f579cb2f551be595b40126997b17532ab0449c..bf21b7155a59085abdec19f659f530b7d24604f6 100755 (executable)
@@ -253,6 +253,10 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count &gt; 7 and 2 or 3)
        <screen name="Dish" flags="wfNoBorder" position="300,100" size="130,160" title="Dish" zPosition="100" backgroundColor="transparent">
                <widget name="Dishpixmap" pixmap="skin_default/icons/dish.png" position="0,0" size="130,160" alphatest="off" />
        </screen>
+       <!-- unhandled key pressed -->
+       <screen name="UnhandledKey" flags="wfNoBorder" position="620,50" size="34,45" title="UnhandledKey" zPosition="100" backgroundColor="transparent">
+               <widget name="UnhandledKeyPixmap" pixmap="skin_default/unhandled-key.png" position="0,0" size="34,45" alphatest="off" />
+       </screen>
        <!-- EPG Selection - Single -->
        <screen name="EPGSelection" position="center,center" size="560,430" title="EPG Selection">
                <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
index e2d2abcce72b7e6a0e651ccbd8cf774237c2f504..3106af97743249dfed3207dbb0542f3ff7cbbf76 100644 (file)
@@ -50,6 +50,7 @@ dist_install_DATA = \
        sleeptimer.png \
        timeline-now.png \
        timeline.png \
+       unhandled-key.png \
        verticalline-plugins.png \
        vkey_backspace.png \
        vkey_bg.png \
diff --git a/data/skin_default/unhandled-key.png b/data/skin_default/unhandled-key.png
new file mode 100644 (file)
index 0000000..8e54349
Binary files /dev/null and b/data/skin_default/unhandled-key.png differ
index a15c7ac1b89b5597b0b314d6cf6f5fc55935d5e7..5b061245b1937c8d82bb2f47cc157d49eb17e081 100644 (file)
@@ -12,7 +12,7 @@ profile("LOAD:InfoBarGenerics")
 from Screens.InfoBarGenerics import InfoBarShowHide, \
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
        InfoBarEPG, InfoBarSeek, InfoBarInstantRecord, \
-       InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
+       InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarUnhandledKey, \
        InfoBarSubserviceSelection, InfoBarShowMovies, InfoBarTimeshift,  \
        InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
        InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
@@ -29,7 +29,7 @@ from Screens.HelpMenu import HelpableScreen
 class InfoBar(InfoBarBase, InfoBarShowHide,
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
        InfoBarInstantRecord, InfoBarAudioSelection, 
-       HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
+       HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarUnhandledKey,
        InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek,
        InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
        InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarServiceErrorPopupSupport, InfoBarJobman,
@@ -52,7 +52,7 @@ class InfoBar(InfoBarBase, InfoBarShowHide,
                for x in HelpableScreen, \
                                InfoBarBase, InfoBarShowHide, \
                                InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
-                               InfoBarInstantRecord, InfoBarAudioSelection, \
+                               InfoBarInstantRecord, InfoBarAudioSelection, InfoBarUnhandledKey, \
                                InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
                                InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
                                InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \
index a3e56a40d1036c9da282d0b24f534a42813171e0..c8aa00cb771d09fc9fde3e8a946ec0d8b5d719f2 100644 (file)
@@ -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. """
index 585983c2752f0ffc694bf975ee54ab9a4f401211..5457bf6427fc84034e512691663b31f27763c66e 100755 (executable)
@@ -14,5 +14,5 @@ install_PYTHON = \
        SubtitleDisplay.py SubservicesQuickzap.py ParentalControlSetup.py NumericalTextInputHelpDialog.py \
        SleepTimerEdit.py Ipkg.py RdsDisplay.py Globals.py DefaultWizard.py \
        SessionGlobals.py LocationBox.py WizardLanguage.py TaskView.py Rc.py VirtualKeyBoard.py \
-       TextBox.py FactoryReset.py RecordPaths.py
+       TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py
 
diff --git a/lib/python/Screens/UnhandledKey.py b/lib/python/Screens/UnhandledKey.py
new file mode 100644 (file)
index 0000000..63bfed5
--- /dev/null
@@ -0,0 +1,7 @@
+from Screen import Screen
+from Components.Pixmap import Pixmap
+
+class UnhandledKey(Screen):
+       def __init__(self, session):
+               Screen.__init__(self, session)
+               self["UnhandledKeyPixmap"] = Pixmap()