Skip to content

Commit 4a9a2bf

Browse files
authored
Remove deprecated config options (#18102)
Closes #18066 Summary of the issue: Some deprecated config keys are still included in the config spec. Description of user facing changes None. Description of developer facing changes The config.conf["documentFormatting"]["reportFontAttributes"] definition has been removed from the config spec, and the code linking it and ["fontAttributeReporting"] has been removed. Description of development approach Removed the linking code and the line in the config spec.
1 parent 9891531 commit 4a9a2bf

File tree

4 files changed

+31
-71
lines changed

4 files changed

+31
-71
lines changed

source/config/__init__.py

Lines changed: 25 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from . import profileUpgrader
3737
from . import aggregatedSection
3838
from .configSpec import confspec
39-
from .configFlags import OutputMode
4039
from .featureFlag import (
4140
_transformSpec_AddFeatureFlagDefault,
4241
_validateConfig_featureFlag,
@@ -49,7 +48,6 @@
4948
Set,
5049
Tuple,
5150
)
52-
from addonAPIVersion import BACK_COMPAT_TO
5351
import NVDAState
5452
from NVDAState import WritePaths
5553

@@ -1306,74 +1304,37 @@ def __setitem__(
13061304
self.manager._markWriteProfileDirty()
13071305
self._cache[key] = val
13081306

1309-
# Alias ["documentFormatting"]["reportFontAttributes"] and ["speech"]["includeCLDR"]
1310-
# for backwards compatibility.
1311-
# TODO: Comment out in 2025.1.
1312-
if BACK_COMPAT_TO < (2025, 1, 0) and NVDAState._allowDeprecatedAPI():
1313-
self._linkDeprecatedValues(key, val)
1307+
# Alias old config items to their new counterparts for backwards compatibility.
1308+
# Uncomment when there are new links that need to be made.
1309+
# if BACK_COMPAT_TO < (2026, 1, 0) and NVDAState._allowDeprecatedAPI():
1310+
# self._linkDeprecatedValues(key, val)
13141311

13151312
def _linkDeprecatedValues(self, key: aggregatedSection._cacheKeyT, val: aggregatedSection._cacheValueT):
13161313
"""Link deprecated config keys and values to their replacements.
13171314
1318-
Args:
1319-
key: The configuration key to link to its new or old counterpart.
1320-
val: The value associated with the configuration key.
1321-
1322-
postconditions:
1323-
- If self.path is "documentFormatting":
1324-
- If key is "reportFontAttributes":
1325-
- If val is True, "documentFormatting.fontAttributeReporting" is set to OutputMode.SPEECH_AND_BRAILLE, otherwise, it is set to OutputMode.OFF.
1326-
- If key is "fontAttributeReporting":
1327-
- if val is OutputMode.OFF, "documentFormatting.reportFontAttributes" is set to False, otherwise, it is set to True.
1315+
:arg key: The configuration key to link to its new or old counterpart.
1316+
:arg val: The value associated with the configuration key.
1317+
1318+
Example of how to link values:
1319+
1320+
>>> match self.path:
1321+
>>> ...
1322+
>>> case ("path", "segments"):
1323+
>>> ...
1324+
>>> match key:
1325+
>>> case "newKey":
1326+
>>> # Do something to alias the new path/key to the old path/key for backwards compatibility.
1327+
>>> case "oldKey":
1328+
>>> # Do something to alias the old path/key to the new path/key for forwards compatibility.
1329+
>>> case _:
1330+
>>> # We don't care about other keys in this section.
1331+
>>> return
1332+
>>> case _:
1333+
>>> # We don't care about other sections.
1334+
>>> return
1335+
>>> ...
13281336
"""
13291337
match self.path:
1330-
case ("documentFormatting",):
1331-
match key:
1332-
case "fontAttributeReporting":
1333-
# Alias documentFormatting.fontAttributeReporting to documentFormatting.reportFontAttributes for backwards compatibility.
1334-
key = "reportFontAttributes"
1335-
val = bool(val)
1336-
1337-
case "reportFontAttributes":
1338-
# Alias documentFormatting.reportFontAttributes to documentFormatting.fontAttributeReporting for forwards compatibility.
1339-
log.warning(
1340-
"documentFormatting.reportFontAttributes is deprecated. Use documentFormatting.fontAttributeReporting instead.",
1341-
# Include stack info so testers can report warning to add-on author.
1342-
stack_info=True,
1343-
)
1344-
key = "fontAttributeReporting"
1345-
val = OutputMode.SPEECH_AND_BRAILLE if val else OutputMode.OFF
1346-
1347-
case _:
1348-
# We don't care about other keys in this section.
1349-
return
1350-
1351-
case ("speech",):
1352-
match key:
1353-
case "symbolDictionaries":
1354-
# Alias speech.symbolDictionaries to speech.includeCLDR for backwards compatibility.
1355-
key = "includeCLDR"
1356-
val = "cldr" in val
1357-
1358-
case "includeCLDR":
1359-
# Alias speech.includeCLDR to speech.symbolDictionaries for forwards compatibility.
1360-
log.warning(
1361-
"speech.includeCLDR is deprecated. Use speech.symbolDictionaries instead.",
1362-
# Include stack info so testers can report warning to add-on author.
1363-
stack_info=True,
1364-
)
1365-
key = "symbolDictionaries"
1366-
curVal = self.get(key, []).copy()
1367-
if val and "cldr" not in curVal:
1368-
curVal.append("cldr")
1369-
elif not val and "cldr" in curVal:
1370-
curVal.remove("cldr")
1371-
val = curVal
1372-
1373-
case _:
1374-
# We don't care about other keys in this section.
1375-
return
1376-
13771338
case _:
13781339
# We don't care about other sections.
13791340
return

source/config/configSpec.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
trustVoiceLanguage = boolean(default=true)
3939
unicodeNormalization = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="enabled")
4040
reportNormalizedForCharacterNavigation = boolean(default=true)
41-
# Deprecated in 2025.1
42-
includeCLDR = boolean(default=True)
4341
symbolDictionaries = string_list(default=list("cldr"))
4442
beepSpeechModePitch = integer(default=10000,min=50,max=11025)
4543
autoLanguageSwitching = boolean(default=true)
@@ -215,8 +213,6 @@
215213
detectFormatAfterCursor = boolean(default=false)
216214
reportFontName = boolean(default=false)
217215
reportFontSize = boolean(default=false)
218-
# Deprecated in 2025.1
219-
reportFontAttributes = boolean(default=false)
220216
# 0: Off, 1: Speech, 2: Braille, 3: Speech and Braille
221217
fontAttributeReporting = integer(0, 3, default=0)
222218
reportRevisions = boolean(default=true)

source/globalCommands.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4671,14 +4671,15 @@ def script_toggleAutomaticRefreshOfRecogResult(self, gesture: inputCore.InputGes
46714671
category=SCRCAT_SPEECH,
46724672
)
46734673
def script_toggleReportCLDR(self, gesture):
4674-
if config.conf["speech"]["includeCLDR"]:
4674+
dictionaries: list[str] = config.conf["speech"]["symbolDictionaries"]
4675+
if "cldr" in dictionaries:
46754676
# Translators: presented when the report CLDR is toggled.
46764677
state = _("report CLDR characters off")
4677-
config.conf["speech"]["includeCLDR"] = False
4678+
dictionaries.remove("cldr")
46784679
else:
46794680
# Translators: presented when the report CLDR is toggled.
46804681
state = _("report CLDR characters on")
4681-
config.conf["speech"]["includeCLDR"] = True
4682+
dictionaries.append("cldr")
46824683
characterProcessing.clearSpeechSymbols()
46834684
ui.message(state)
46844685

user_docs/en/changes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ Instead, a `callback` property has been added, which returns a function that per
283283
* `gui.settingsDialogs.KeyboardSettingsPanel.wordsCheckBox` and `gui.settingsDialogs.KeyboardSettingsPanel.charsCheckBox` has been removed.
284284
* The `winUser.paint` has been renamed from `painStruct` to `paintStruct`, fixing a bug where passing in a `PAINTSTRUCT` would raise an exception. (#17744)
285285
* `documentationUtils.getDocFilePath` and `installer.getDocFilePath` no longer look for `.txt` files in locale documentation folders. (#17911, @CyrilleB79)
286+
* `config.conf["documentFormatting"]["reportFontAttributes"]` has been removed, use `config.conf["documentFormatting"]["fontAttributeReporting"]` instead. (#18066)
287+
* `config.conf["speech"]["includeCLDR"]` has been removed, check/modify whether `config.conf["speech"]["symbolDictionaries"]` contains `"cldr"` instead. (#18066)
286288

287289
#### Deprecations
288290

0 commit comments

Comments
 (0)