Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7472426
Report spelling errors with a sound while reading
Apr 18, 2025
bc96c36
Change log
Apr 22, 2025
30b5b75
Pre-commit auto-fix
pre-commit-ci[bot] Apr 22, 2025
fed0575
Fix pre-commit rework - adding tailing comma
Apr 23, 2025
d42f3ef
Apply suggestions from code review
CyrilleB79 May 5, 2025
fcf6afb
Change anchor name
May 5, 2025
72b2025
Remove debug comments
May 5, 2025
ecee988
Merge branch 'master' into spellingSound
May 7, 2025
743a5a5
Merge branch 'master' into spellingSound
CyrilleB79 Jun 3, 2025
579f3b1
Merge branch 'master' into spellingSound
Jul 8, 2025
5696410
Convert to new key; feature broken in Word (UIA or legacy)
Jul 8, 2025
44f72b0
Merge branch 'master' into spellingSound
Aug 5, 2025
b88944f
Fix config latest after merge
Aug 5, 2025
70770bb
Implement aliases
Aug 5, 2025
c7905cf
Fix and document config key aliasing
Aug 6, 2025
f2fc880
Merge branch 'master' into spellingSound
Aug 6, 2025
4b7670a
Pre-commit auto-fix
pre-commit-ci[bot] Aug 6, 2025
263c027
Apply suggestions from code review
CyrilleB79 Aug 7, 2025
03f5b09
Fix type hint
Aug 7, 2025
72b3d41
Merge branch 'master' into spellingSound
Aug 8, 2025
3b5219e
Apply suggestions from code review
CyrilleB79 Aug 8, 2025
d3676cc
Added unit tests
Aug 8, 2025
bb0a58e
Pre-commit auto-fix
pre-commit-ci[bot] Aug 8, 2025
41aaecd
Merge branch 'master' into spellingSound
Aug 8, 2025
658fd7e
Pre-commit auto-fix
pre-commit-ci[bot] Aug 8, 2025
da2d886
Bump CI
Aug 8, 2025
c4e5e97
Update tests/unit/test_config.py
SaschaCowley Aug 19, 2025
660049c
Merge branch 'master' into spellingSound
CyrilleB79 Aug 28, 2025
bce05e3
Remove backward compa code since we now target 2026.1
CyrilleB79 Aug 28, 2025
cba9bfa
ReportSpellingErrors converted to DisplayStringIntFlag; usage to be u…
CyrilleB79 Aug 28, 2025
602a05e
Pre-commit auto-fix
pre-commit-ci[bot] Aug 28, 2025
aeac6b8
Convert to bitwise flag everywhere
Aug 29, 2025
0e92ea7
fix translator's comment
Aug 29, 2025
156ea3a
Update change for dev
Aug 29, 2025
1cfe185
Update User §Guide with checklist box
Aug 29, 2025
cb6d06f
Fix config upgrade
Aug 29, 2025
3a7db06
Pre-commit auto-fix
pre-commit-ci[bot] Aug 29, 2025
1f6c43d
type hint
Aug 29, 2025
e324235
Fix syntax error
Aug 29, 2025
8f5ca89
Pre-commit auto-fix
pre-commit-ci[bot] Aug 29, 2025
3008570
Fix missing import
Aug 29, 2025
7a9810e
One more attempt to fix translators comment!
Aug 29, 2025
3087fa6
Fix both reporting modes
CyrilleB79 Aug 30, 2025
5103c8b
Pre-commit auto-fix
pre-commit-ci[bot] Aug 30, 2025
d3a156e
Apply suggestions from code review
CyrilleB79 Sep 2, 2025
6a0437b
Merge branch 'master' into spellingSound
CyrilleB79 Sep 3, 2025
4c2b721
Remove unnecessary if
CyrilleB79 Sep 3, 2025
bc29cb4
Update source/config/profileUpgradeSteps.py
SaschaCowley Sep 5, 2025
94b65d9
Pre-commit auto-fix
pre-commit-ci[bot] Sep 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Convert to new key; feature broken in Word (UIA or legacy)
  • Loading branch information
Cyrille Bougot
Cyrille Bougot committed Jul 8, 2025
commit 5696410772c385777c220f7edfebef2bd78c5c59
5 changes: 3 additions & 2 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import controlTypes
from controlTypes import TextPosition, TextAlign
import config
from config.configFlags import ReportSpellingErrors
import speech
import api
import textInfos
Expand Down Expand Up @@ -313,7 +314,7 @@ def _getFormatFieldAnnotationTypes(
# Always mutate to a tuple to allow for a generic x in y matching
if not isinstance(annotationTypes, tuple):
annotationTypes = (annotationTypes,)
if formatConfig["reportSpellingErrors"]:
if formatConfig["reportSpellingErrors2"] != ReportSpellingErrors.OFF.value:
if UIAHandler.AnnotationType_SpellingError in annotationTypes:
formatField["invalid-spelling"] = True
if UIAHandler.AnnotationType_GrammarError in annotationTypes:
Expand Down Expand Up @@ -368,7 +369,7 @@ def _getFormatFieldAtRange( # noqa: C901
if not isinstance(textRange, UIAHandler.IUIAutomationTextRange):
raise ValueError("%s is not a text range" % textRange)
fetchAnnotationTypes = (
formatConfig["reportSpellingErrors"]
formatConfig["reportSpellingErrors2"] != ReportSpellingErrors.OFF.value
or formatConfig["reportComments"]
or formatConfig["reportRevisions"]
or formatConfig["reportBookmarks"]
Expand Down
4 changes: 2 additions & 2 deletions source/NVDAObjects/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2006-2025 NV Access Limited, Peter Vágner, Joseph Lee, Bill Dengler,
# Burman's Computer and Education Ltd, Cary-rowen
# Burman's Computer and Education Ltd, Cary-rowen, Cyrille Bougot

"""Mix-in classes which provide common behaviour for particular types of controls across different APIs.
Behaviors described in this mix-in include providing table navigation commands for certain table rows, terminal input and output support, announcing notifications and suggestion items and so on.
Expand Down Expand Up @@ -297,7 +297,7 @@ def _delayedDetection():

def event_typedCharacter(self, ch: str):
if (
config.conf["documentFormatting"]["reportSpellingErrors"]
config.conf["documentFormatting"]["reportSpellingErrors2"]
and config.conf["keyboard"]["alertForSpellingErrors"]
and (
# Not alpha, apostrophe or control.
Expand Down
6 changes: 3 additions & 3 deletions source/config/configFlags.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ class ReportSpellingErrors(DisplayStringIntEnum):
def _displayStringLabels(self):
Comment thread
CyrilleB79 marked this conversation as resolved.
Outdated
return {
# Translators: A choice in a combo box in the document formatting dialog to not report spelling errors.
ReportSpellingErrors.OFF: pgettext("line indentation setting", "Off"),
ReportSpellingErrors.OFF: pgettext("reportSpellingErrorsSetting", "Off"),
# Translators: A choice in a combo box in the document formatting dialog to report spelling errors
# with Speech.
Comment thread
CyrilleB79 marked this conversation as resolved.
Outdated
ReportSpellingErrors.SPEECH: pgettext("line indentation setting", "Speech"),
ReportSpellingErrors.SPEECH: pgettext("reportSpellingErrorsSetting", "Speech"),
# Translators: A choice in a combo box in the document formatting dialog to report spelling errors
# with a sound.
ReportSpellingErrors.SOUND: pgettext("line indentation setting", "Sound"),
ReportSpellingErrors.SOUND: pgettext("reportSpellingErrorsSetting", "Sound"),
}


Expand Down
2 changes: 1 addition & 1 deletion source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
reportLineSpacing = boolean(default=false)
reportStyle = boolean(default=false)
# 0: Off, 1: Speech, 2: Sound
reportSpellingErrors = integer(min=0, max=2, default=1)
reportSpellingErrors2 = integer(min=0, max=2, default=1)
reportPage = boolean(default=true)
reportLineNumber = boolean(default=False)
# 0: Off, 1: Speech, 2: Tones, 3: Both Speech and Tones
Expand Down
17 changes: 9 additions & 8 deletions source/config/profileUpgradeSteps.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,19 @@ def upgradeConfigFrom_17_to_18(profile: ConfigObj):

section = "documentFormatting"
key = "reportSpellingErrors"
newKey = "reportSpellingErrors2"
try:
oldValue: bool = profile[section].as_bool(key)
except KeyError:
log.debug(f"'{key}' not present in config, no action taken.")
return
except ValueError:
log.error(f"'{key}' is not a boolean, got {profile[section][key]!r}. Deleting.")
del profile[section][key]
log.error(f"'{key}' is not a boolean, got {profile[section][key]!r}. No action taken.")
return
else:
newValue = ReportSpellingErrors.SPEECH.value if oldValue else ReportSpellingErrors.OFF.value
profile[section][key] = newValue
log.debug(
f"Converted '{key}' from {oldValue!r} to {newValue} ({ReportSpellingErrors(newValue).name}).",
)

del profile[section][key]
newValue = ReportSpellingErrors.SPEECH.value if oldValue else ReportSpellingErrors.OFF.value
profile[section][newKey] = newValue
log.debug(
f"Converted '{key}' from {oldValue!r} to {newValue} ({ReportSpellingErrors(newValue).name}).",
)
Comment thread
SaschaCowley marked this conversation as resolved.
4 changes: 2 additions & 2 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ def script_toggleReportStyle(self, gesture):
def script_toggleReportSpellingErrors(self, gesture):
toggleIntegerValue(
configSection="documentFormatting",
configKey="reportSpellingErrors",
configKey="reportSpellingErrors2",
enumClass=ReportSpellingErrors,
# Translators: Reported when the user cycles through the choices to report spelling errors.
# {mode} will be replaced with the mode; e.g. Off, Speech, Sound.
Expand Down Expand Up @@ -2539,7 +2539,7 @@ def _reportFormattingHelper(self, info, browseable=False):
"reportColor",
"reportStyle",
"reportAlignment",
"reportSpellingErrors",
"reportSpellingErrors2",
"reportLineIndentation",
"reportParagraphIndentation",
"reportLineSpacing",
Expand Down
6 changes: 3 additions & 3 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,7 @@ def makeSettings(self, settingsSizer):
)
self.bindHelpEvent("KeyboardSettingsAlertForSpellingErrors", self.alertForSpellingErrorsCheckBox)
self.alertForSpellingErrorsCheckBox.SetValue(config.conf["keyboard"]["alertForSpellingErrors"])
if not config.conf["documentFormatting"]["reportSpellingErrors"]:
if config.conf["documentFormatting"]["reportSpellingErrors2"] == ReportSpellingErrors.DISABLE.value:
Comment thread
CyrilleB79 marked this conversation as resolved.
Outdated
self.alertForSpellingErrorsCheckBox.Disable()

# Translators: This is the label for a checkbox in the
Expand Down Expand Up @@ -2805,7 +2805,7 @@ def makeSettings(self, settingsSizer):
"reportSpellingErrors",
self.spellingErrorsCombo,
)
self.spellingErrorsCombo.SetSelection(config.conf["documentFormatting"]["reportSpellingErrors"])
self.spellingErrorsCombo.SetSelection(config.conf["documentFormatting"]["reportSpellingErrors2"])

# Translators: This is the label for a group of document formatting options in the
# document formatting settings panel
Expand Down Expand Up @@ -3028,7 +3028,7 @@ def onSave(self):
config.conf["documentFormatting"]["reportHighlight"] = self.highlightCheckBox.IsChecked()
config.conf["documentFormatting"]["reportAlignment"] = self.alignmentCheckBox.IsChecked()
config.conf["documentFormatting"]["reportStyle"] = self.styleCheckBox.IsChecked()
config.conf["documentFormatting"]["reportSpellingErrors"] = self.spellingErrorsCombo.GetSelection()
config.conf["documentFormatting"]["reportSpellingErrors2"] = self.spellingErrorsCombo.GetSelection()
config.conf["documentFormatting"]["reportPage"] = self.pageCheckBox.IsChecked()
config.conf["documentFormatting"]["reportLineNumber"] = self.lineNumberCheckBox.IsChecked()
config.conf["documentFormatting"]["reportLineIndentation"] = self.lineIndentationCombo.GetSelection()
Expand Down
6 changes: 3 additions & 3 deletions source/speech/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ def getTextInfoSpeech( # noqa: C901
)
# For performance reasons, when navigating by paragraph or table cell, spelling errors will not be announced.
if unit in (textInfos.UNIT_PARAGRAPH, textInfos.UNIT_CELL) and reason == OutputReason.CARET:
formatConfig["reportSpellingErrors"] = ReportSpellingErrors.OFF.value
formatConfig["reportSpellingErrors2"] = ReportSpellingErrors.OFF.value

# Fetch the last controlFieldStack, or make a blank one
controlFieldStackCache = speakTextInfoState.controlFieldStackCache if speakTextInfoState else []
Expand Down Expand Up @@ -2993,12 +2993,12 @@ def getFormatFieldSpeech( # noqa: C901
# Translators: Reported when text no longer contains a bookmark
text = _("out of bookmark")
textList.append(text)
if formatConfig["reportSpellingErrors"] != ReportSpellingErrors.OFF.value:
if formatConfig["reportSpellingErrors2"] != ReportSpellingErrors.OFF.value:
invalidSpelling = attrs.get("invalid-spelling")
oldInvalidSpelling = attrsCache.get("invalid-spelling") if attrsCache is not None else None
if (invalidSpelling or oldInvalidSpelling is not None) and invalidSpelling != oldInvalidSpelling:
if invalidSpelling:
if formatConfig["reportSpellingErrors"] == ReportSpellingErrors.SPEECH.value:
if formatConfig["reportSpellingErrors2"] == ReportSpellingErrors.SPEECH.value:
# Translators: Reported when text contains a spelling error.
text = _("spelling error")
else:
Expand Down
2 changes: 1 addition & 1 deletion user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### New Features

* While reading text, spelling errors can now be reported with a sound. (#4233, @jcsteh, @CyrilleB79)
* While reading text, spelling errors can now be reported with a sound instead of speech. (#4233, @jcsteh, @CyrilleB79)

### Changes

Expand Down