add hidden option to disable keyboard preservation

This commit is contained in:
Damien Elmes 2010-12-17 21:36:54 +09:00
parent 90f419b088
commit ebebd93548
2 changed files with 3 additions and 2 deletions

View file

@ -69,6 +69,7 @@ class Config(dict):
'mediaLocation': "",
'mainWindowState': None,
'numBackups': 30,
'preserveKeyboard': True,
'preventEditUntilAnswer': False,
'proxyHost': '',
'proxyPass': '',

View file

@ -1111,7 +1111,7 @@ class FactEdit(QTextEdit):
self.parent.lastFocusedEdit = self
self.parent.resetFormatButtons()
self.parent.disableButtons()
if sys.platform.startswith("win32"):
if ankiqt.mw.config['preserveKeyboard'] and sys.platform.startswith("win32"):
self._ownLayout = GetKeyboardLayout(0)
ActivateKeyboardLayout(self._programLayout, 0)
self.emit(SIGNAL("lostFocus"))
@ -1131,7 +1131,7 @@ class FactEdit(QTextEdit):
QTextEdit.focusInEvent(self, evt)
self.parent.formatChanged(None)
self.parent.enableButtons()
if sys.platform.startswith("win32"):
if ankiqt.mw.config['preserveKeyboard'] and sys.platform.startswith("win32"):
self._programLayout = GetKeyboardLayout(0)
if self._ownLayout == None:
self._ownLayout = self._programLayout