make switching of keyboard modes more consistent
[enigma2.git] / lib / python / Screens / Screen.py
index f0bf773..fa6999a 100644 (file)
@@ -6,6 +6,8 @@ profile("LOAD:Source")
 from Components.Sources.Source import Source
 profile("LOAD:GUIComponent")
 from Components.GUIComponent import GUIComponent
+profile("LOAD:eRCInput")
+from enigma import eRCInput
 
 class Screen(dict, GUISkin):
 
@@ -47,6 +49,27 @@ class Screen(dict, GUISkin):
                # don't care about having or not having focus.
                self.stand_alone = False
 
+               self.onShow.append(self.saveKeyboardMode);
+               self.onHide.append(self.restoreKeyboardMode)
+               self.keyboardMode = None
+
+       def saveKeyboardMode(self):
+               rcinput = eRCInput.getInstance()
+               self.keyboardMode = rcinput.getKeyboardMode()
+
+       def setKeyboardModeAscii(self):
+               rcinput = eRCInput.getInstance()
+               rcinput.setKeyboardMode(rcinput.kmAscii)
+
+       def setKeyboardModeNone(self):
+               rcinput = eRCInput.getInstance()
+               rcinput.setKeyboardMode(rcinput.kmNone)
+
+       def restoreKeyboardMode(self):
+               rcinput = eRCInput.getInstance()
+               if self.keyboardMode is not None:
+                       rcinput.setKeyboardMode(self.keyboardMode)
+
        def execBegin(self):
                self.active_components = [ ]
                if self.close_on_next_exec is not None: