Merge branch 'bug_293_indicate_unhandled_key' into experimental
authorghost <andreas.monzner@multimedia-labs.de>
Wed, 30 Dec 2009 16:35:27 +0000 (17:35 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Wed, 30 Dec 2009 16:35:27 +0000 (17:35 +0100)
1  2 
data/skin_default.xml
data/skin_default/Makefile.am
lib/python/Screens/InfoBarGenerics.py

diff --combined data/skin_default.xml
@@@ -70,8 -70,8 +70,8 @@@
                <widget name="menu" position="10,10" size="290,225" scrollbarMode="showOnDemand" />
        </screen>
        <!-- Channel context menu -->
 -      <screen name="ChannelContextMenu" position="center,center" size="300,255" title="Channellist menu">
 -              <widget name="menu" position="10,10" size="290,230" scrollbarMode="showOnDemand" />
 +      <screen name="ChannelContextMenu" position="center,center" size="350,255" title="Channellist menu">
 +              <widget name="menu" position="10,10" size="340,230" scrollbarMode="showOnDemand" />
        </screen>
        <!-- Channel selection - TV -->
        <screen name="ChannelSelection" position="center,center" size="560,430" title="Channel Selection">
@@@ -253,6 -253,10 +253,10 @@@ self.instance.move(ePoint((720-wsizex)/
        <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 15f4a54,3106af9..9e9b7cd
mode 100755,100644..100755
@@@ -15,7 -15,6 +15,7 @@@ dist_install_DATA = 
        border_eventinfo.png \
        border_info.png \
        border_menu_300.png \
 +      border_menu_350.png \
        border_menu.png \
        border_multiepg.png \
        bottombar.png \
@@@ -51,6 -50,7 +51,7 @@@
        sleeptimer.png \
        timeline-now.png \
        timeline.png \
+       unhandled-key.png \
        verticalline-plugins.png \
        vkey_backspace.png \
        vkey_bg.png \
@@@ -26,13 -26,14 +26,14 @@@ from Screens.PictureInPicture import Pi
  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 +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. """
@@@ -691,7 -730,6 +730,7 @@@ class InfoBarSeek
                                iPlayableService.evEOF: self.__evEOF,
                                iPlayableService.evSOF: self.__evSOF,
                        })
 +              self.fast_winding_hint_message_showed = False
  
                class InfoBarSeekActionMap(HelpableActionMap):
                        def __init__(self, screen, *args, **kwargs):
  #                     print "seekable"
  
        def __serviceStarted(self):
 +              self.fast_winding_hint_message_showed = False
                self.seekstate = self.SEEK_STATE_PLAY
                self.__seekableStatusChanged()
  
                        self.showAfterSeek()
  
        def seekFwd(self):
 +              seek = self.getSeek()
 +              if seek and not (seek.isCurrentlySeekable() & 2):
 +                      if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1):
 +                              self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10)
 +                              self.fast_winding_hint_message_showed = True
 +                              return
 +                      return 0 # trade as unhandled action
                if self.seekstate == self.SEEK_STATE_PLAY:
                        self.setSeekState(self.makeStateForward(int(config.seek.enter_forward.value)))
                elif self.seekstate == self.SEEK_STATE_PAUSE:
                        self.setSeekState(self.makeStateSlowMotion(speed))
  
        def seekBack(self):
 +              seek = self.getSeek()
 +              if seek and not (seek.isCurrentlySeekable() & 2):
 +                      if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1):
 +                              self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10)
 +                              self.fast_winding_hint_message_showed = True
 +                              return
 +                      return 0 # trade as unhandled action
                seekstate = self.seekstate
                if seekstate == self.SEEK_STATE_PLAY:
                        self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value)))