Skip to content

Commit

Permalink
Fix braille table loading with debug logging enabled and/or add-ons d…
Browse files Browse the repository at this point in the history
…isabled (nvaccess#17565)

Summary of the issue:
When custom braille tables are available in the manifest of the scratchpad and NVDA starts with debug logging enabled, it will raise an unbound local error due to a wrong logging statement. This actually revealed another bug, namely that scratchpad braille tables weren't ignored when addons are disabled.

Description of user facing changes
No longer an error in this specific case. Furthermore, custom braille tables from the scratchpad wil be disabled when addons are.

Description of development approach
Fixed the debug logging statement
in brailleTables.initialize, return early when add-ons disabled or when appX.
  • Loading branch information
LeonarddeR authored Dec 30, 2024
1 parent e80d782 commit 400facc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/brailleTables.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,8 @@ def _loadTablesFromManifestSection(source: str, directory: str, tablesDict: dict


def initialize():
if config.isAppX or globalVars.appArgs.disableAddons:
return
# The builtin tables were added at import time to the parent map.
# Now, add the custom tables to the first map.
import addonHandler
Expand Down Expand Up @@ -890,7 +892,7 @@ def initialize():
return
if (res := manifest.validate(Validator(), preserve_errors=True)) is not True:
raise ValueError(f"Errors in scratchpad manifest: {flatten_errors(manifest, res)}")
log.debug(f"Found {len(tablesDict)} braille table entries in manifest for scratchpad")
log.debug(f"Found {len(section)} braille table entries in manifest for scratchpad")
_loadTablesFromManifestSection(TableSource.SCRATCHPAD, directory, section)
except Exception:
log.exception(
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Specifically, MathML inside of span and other elements that have the attribute `
In any document, if the cursor is on the last line, it will be moved to the end when using this command.
(#17251, #17430, @nvdaes)
* In web browsers, changes to text selection no longer sometimes fail to be reported in editable text controls. (#17501, @jcsteh)
* Custom braille tables in the developer scratchpad are now properly ignored when running with add-ons disabled. (#17565, @LeonarddeR)

### Changes for Developers

Expand Down

0 comments on commit 400facc

Please sign in to comment.