From ebebd93548bcdb56eeffdd8eec1de64c7b20d5ad Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 17 Dec 2010 21:36:54 +0900 Subject: [PATCH] add hidden option to disable keyboard preservation --- ankiqt/config.py | 1 + ankiqt/ui/facteditor.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ankiqt/config.py b/ankiqt/config.py index f58e4995d..d8a37f04c 100644 --- a/ankiqt/config.py +++ b/ankiqt/config.py @@ -69,6 +69,7 @@ class Config(dict): 'mediaLocation': "", 'mainWindowState': None, 'numBackups': 30, + 'preserveKeyboard': True, 'preventEditUntilAnswer': False, 'proxyHost': '', 'proxyPass': '', diff --git a/ankiqt/ui/facteditor.py b/ankiqt/ui/facteditor.py index c943f1edc..8e1d7ed54 100644 --- a/ankiqt/ui/facteditor.py +++ b/ankiqt/ui/facteditor.py @@ -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