diff --git a/source/characterProcessing.py b/source/characterProcessing.py index b725c79bd8c..9dc904d58c1 100644 --- a/source/characterProcessing.py +++ b/source/characterProcessing.py @@ -1,8 +1,8 @@ -#characterProcessing.py -#A part of NonVisual Desktop Access (NVDA) -#Copyright (C) 2010-2018 NV Access Limited, World Light Information Limited, Hong Kong Blind Union, Babbage B.V. -#This file is covered by the GNU General Public License. -#See the file COPYING for more details. +# A part of NonVisual Desktop Access (NVDA) +# Copyright (C) 2010-2020 NV Access Limited, World Light Information Limited, +# Hong Kong Blind Union, Babbage B.V., Julien Cochuyt +# This file is covered by the GNU General Public License. +# See the file COPYING for more details. import time import os @@ -130,6 +130,7 @@ def getCharacterDescription(locale,character): SYMLVL_MOST = 200 SYMLVL_ALL = 300 SYMLVL_CHAR = 1000 +SYMLVL_UNCHANGED = -1 SPEECH_SYMBOL_LEVEL_LABELS = { # Translators: The level at which the given symbol will be spoken. SYMLVL_NONE: pgettext("symbolLevel", "none"), diff --git a/source/config/configSpec.py b/source/config/configSpec.py index 9e23fbe4fe7..8a5ce1f7145 100644 --- a/source/config/configSpec.py +++ b/source/config/configSpec.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 -*- # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2006-2020 NV Access Limited, Babbage B.V., Davy Kager, Bill Dengler +# Copyright (C) 2006-2020 NV Access Limited, Babbage B.V., Davy Kager, Bill Dengler, Julien Cochuyt # This file is covered by the GNU General Public License. # See the file COPYING for more details. @@ -31,6 +31,8 @@ # The synthesizer to use synth = string(default=auto) symbolLevel = integer(default=100) + # Symbol Level when reviewing by word (unchanged if -1) + symbolLevelWord = integer(default=300) trustVoiceLanguage = boolean(default=true) includeCLDR = boolean(default=True) beepSpeechModePitch = integer(default=10000,min=50,max=11025) diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py index d4fc5899d84..6bc5ebdbda0 100644 --- a/source/gui/settingsDialogs.py +++ b/source/gui/settingsDialogs.py @@ -2,7 +2,8 @@ # A part of NonVisual Desktop Access (NVDA) # Copyright (C) 2006-2020 NV Access Limited, Peter Vágner, Aleksey Sadovoy, # Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter, -# Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler, Thomas Stivers +# Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler, Thomas Stivers, +# Julien Cochuyt # This file is covered by the GNU General Public License. # See the file COPYING for more details. import logging @@ -1461,6 +1462,21 @@ def makeSettings(self, settingsSizer): characterProcessing.CONFIGURABLE_SPEECH_SYMBOL_LEVELS.index(curLevel) ) + self.symbolLevelWord = settingsSizerHelper.addItem( + wx.CheckBox( + self, + # Translators: The label for a setting in the Speech category + label=_("Speak all punctuations and symbols when reviewing by &word"), + style=wx.CHK_3STATE + ) + ) + if config.conf["speech"]["symbolLevelWord"] == characterProcessing.SYMLVL_ALL: + self.symbolLevelWord.Set3StateValue(wx.CHK_CHECKED) + elif config.conf["speech"]["symbolLevelWord"] == characterProcessing.SYMLVL_UNCHANGED: + self.symbolLevelWord.Set3StateValue(wx.CHK_UNCHECKED) + else: + self.symbolLevelWord.Set3StateValue(wx.CHK_UNDETERMINED) + # Translators: This is the label for a checkbox in the # voice settings panel (if checked, text will be read using the voice for the language of the text). trustVoiceLanguageText = _("Trust voice's language when processing characters and symbols") @@ -1548,8 +1564,14 @@ def onSave(self): config.conf["speech"]["autoLanguageSwitching"] = self.autoLanguageSwitchingCheckbox.IsChecked() config.conf["speech"]["autoDialectSwitching"] = self.autoDialectSwitchingCheckbox.IsChecked() - config.conf["speech"]["symbolLevel"]=characterProcessing.CONFIGURABLE_SPEECH_SYMBOL_LEVELS[self.symbolLevelList.GetSelection()] - config.conf["speech"]["trustVoiceLanguage"]=self.trustVoiceLanguageCheckbox.IsChecked() + config.conf["speech"]["symbolLevel"] = characterProcessing.CONFIGURABLE_SPEECH_SYMBOL_LEVELS[ + self.symbolLevelList.GetSelection() + ] + if self.symbolLevelWord.Get3StateValue() == wx.CHK_CHECKED: + config.conf["speech"]["symbolLevelWord"] = characterProcessing.SYMLVL_ALL + elif self.symbolLevelWord.Get3StateValue() == wx.CHK_UNCHECKED: + config.conf["speech"]["symbolLevelWord"] = characterProcessing.SYMLVL_UNCHANGED + config.conf["speech"]["trustVoiceLanguage"] = self.trustVoiceLanguageCheckbox.IsChecked() currentIncludeCLDR = config.conf["speech"]["includeCLDR"] config.conf["speech"]["includeCLDR"] = newIncludeCldr = self.includeCLDRCheckbox.IsChecked() if currentIncludeCLDR is not newIncludeCldr: diff --git a/source/speech/__init__.py b/source/speech/__init__.py index 614dd850018..e3fc254be47 100755 --- a/source/speech/__init__.py +++ b/source/speech/__init__.py @@ -1084,9 +1084,13 @@ def speakTextInfo( return _speakWithoutPauses.speakWithoutPauses(flatSpeechGen) speechGen = GeneratorWithReturn(speechGen) - # Force symbol level to all when moving by characters or words (#11779) - if unit in (textInfos.UNIT_CHARACTER, textInfos.UNIT_WORD): + symbolLevel = None + if unit == textInfos.UNIT_CHARACTER: symbolLevel = characterProcessing.SYMLVL_ALL + elif unit == textInfos.UNIT_WORD: + symbolLevelWord = config.conf["speech"]["symbolLevelWord"] + if symbolLevelWord != characterProcessing.SYMLVL_UNCHANGED: + symbolLevel = symbolLevelWord else: symbolLevel = None for seq in speechGen: