|
1 | 1 | # -*- coding: UTF-8 -*- |
2 | 2 | # A part of NonVisual Desktop Access (NVDA) |
3 | | -# Copyright (C) 2006-2022 NV Access Limited, Peter Vágner, Aleksey Sadovoy, |
| 3 | +# Copyright (C) 2006-2023 NV Access Limited, Peter Vágner, Aleksey Sadovoy, |
4 | 4 | # Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter, |
5 | 5 | # Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler, Thomas Stivers, |
6 | 6 | # Julien Cochuyt, Peter Vágner, Cyrille Bougot, Mesar Hameed, Łukasz Golonka, Aaron Cannon, |
|
26 | 26 | from synthDriverHandler import changeVoice, getSynth, getSynthList, setSynth, SynthDriver |
27 | 27 | import config |
28 | 28 | from config.configFlags import ( |
| 29 | + NVDAKey, |
29 | 30 | ShowMessages, |
30 | 31 | TetherTo, |
31 | 32 | ReportLineIndentation, |
@@ -1683,16 +1684,12 @@ def makeSettings(self, settingsSizer): |
1683 | 1684 | #Translators: This is the label for a list of checkboxes |
1684 | 1685 | # controlling which keys are NVDA modifier keys. |
1685 | 1686 | modifierBoxLabel = _("&Select NVDA Modifier Keys") |
1686 | | - self.modifierChoices = [keyLabels.localizedKeyLabels[key] for key in keyboardHandler.SUPPORTED_NVDA_MODIFIER_KEYS] |
| 1687 | + self.modifierChoices = [key.displayString for key in NVDAKey] |
1687 | 1688 | self.modifierList=sHelper.addLabeledControl(modifierBoxLabel, nvdaControls.CustomCheckListBox, choices=self.modifierChoices) |
1688 | 1689 | checkedItems = [] |
1689 | | - if config.conf["keyboard"]["useNumpadInsertAsNVDAModifierKey"]: |
1690 | | - checkedItems.append(keyboardHandler.SUPPORTED_NVDA_MODIFIER_KEYS.index("numpadinsert")) |
1691 | | - |
1692 | | - if config.conf["keyboard"]["useExtendedInsertAsNVDAModifierKey"]: |
1693 | | - checkedItems.append(keyboardHandler.SUPPORTED_NVDA_MODIFIER_KEYS.index("insert")) |
1694 | | - if config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"]: |
1695 | | - checkedItems.append(keyboardHandler.SUPPORTED_NVDA_MODIFIER_KEYS.index("capslock")) |
| 1690 | + for (n, key) in enumerate(NVDAKey): |
| 1691 | + if config.conf["keyboard"]["NVDAModifierKeys"] & key.value: |
| 1692 | + checkedItems.append(n) |
1696 | 1693 | self.modifierList.CheckedItems = checkedItems |
1697 | 1694 | self.modifierList.Select(0) |
1698 | 1695 |
|
@@ -1781,9 +1778,9 @@ def isValid(self): |
1781 | 1778 | def onSave(self): |
1782 | 1779 | layout=self.kbdNames[self.kbdList.GetSelection()] |
1783 | 1780 | config.conf['keyboard']['keyboardLayout']=layout |
1784 | | - config.conf["keyboard"]["useNumpadInsertAsNVDAModifierKey"]= self.modifierList.IsChecked(keyboardHandler.SUPPORTED_NVDA_MODIFIER_KEYS.index("numpadinsert")) |
1785 | | - config.conf["keyboard"]["useExtendedInsertAsNVDAModifierKey"] = self.modifierList.IsChecked(keyboardHandler.SUPPORTED_NVDA_MODIFIER_KEYS.index("insert")) |
1786 | | - config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"] = self.modifierList.IsChecked(keyboardHandler.SUPPORTED_NVDA_MODIFIER_KEYS.index("capslock")) |
| 1781 | + config.conf["keyboard"]["NVDAModifierKeys"] = sum([ |
| 1782 | + key.value for (n, key) in enumerate(NVDAKey) if self.modifierList.IsChecked(n) |
| 1783 | + ]) |
1787 | 1784 | config.conf["keyboard"]["speakTypedCharacters"]=self.charsCheckBox.IsChecked() |
1788 | 1785 | config.conf["keyboard"]["speakTypedWords"]=self.wordsCheckBox.IsChecked() |
1789 | 1786 | config.conf["keyboard"]["speechInterruptForCharacters"]=self.speechInterruptForCharsCheckBox.IsChecked() |
|
0 commit comments