Skip to content

Move brailleInput into the braille.input package and deprecate the old module#20509

Open
LeonarddeR wants to merge 5 commits into
nvaccess:masterfrom
LeonarddeR:deprecateBrailleInput
Open

Move brailleInput into the braille.input package and deprecate the old module#20509
LeonarddeR wants to merge 5 commits into
nvaccess:masterfrom
LeonarddeR:deprecateBrailleInput

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

Part of #12772
Follow-up to #20252, #20390 and #20458

Summary of the issue:

In #20252, source/braille.py was split into the braille package, and #20390 deprecated the symbols that moved out of the module facade. The brailleInput module logically belongs to the same domain, but was still a separate 594 line top-level module.

Description of user facing changes:

None.

Description of developer facing changes:

  • The brailleInput module has moved into the braille package as braille.input, split into focused submodules:
    • braille.input.constants: FALLBACK_TABLE, DOT7, DOT8, LOUIS_DOTS_IO_START, UNICODE_BRAILLE_START and UNICODE_BRAILLE_PROTECTED
    • braille.input.gesture: BrailleInputGesture and formatDotNumbers
    • braille.input.inputHandler: BrailleInputHandler and speakDots
    • braille.input itself keeps the live state: the handler singleton, initialize and terminate
  • The old brailleInput module remains importable as a backwards compatibility shim. Accessing any of its symbols still works, but logs a deprecation warning pointing at the new location.

Description of development approach:

  • Split brailleInput.py into the braille/input/ package following the structure established for the braille package in refactor(braille): split braille.py into a package #20252. The import graph is acyclic: constantsgestureinputHandler__init__.
  • Replaced brailleInput.py with a module level __getattr__ built with utils._deprecate.handleDeprecations, containing a MovedSymbol for each of the 13 public symbols. Since MovedSymbol.value resolves on every access, brailleInput.handler keeps returning the live handler instance even though it is reassigned on initialize/terminate.
  • Updated all internal consumers to the new import paths in the same PR, applying the lesson from A large number of deprecation warnings are flooding the logs. #20431/Fix up braille deprecations #20458 so the log is not flooded with NVDA warning against itself. The imports in braille.display.gesture and braille.regions.textInfo remain function-local, as braille.input.inputHandler imports braille.regions.textInfo at module level.
  • Extended the existing changelog entries for the braille package split rather than adding new ones.

Testing strategy:

  • Added TestBrailleInputPublicSurface to tests/unit/test_braille/test_publicSurface.py, asserting that resident names on braille.input are reachable without a deprecation warning and that every deprecated brailleInput name resolves to the identical object in its new home while logging a warning.
  • Ran the full unit test suite (1311 tests) and all lint hooks.
  • Ran NVDA from source and verified braille input still works without deprecation warnings in the log.

Known issues with pull request:

None known.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

🤖 Generated with Claude Code

LeonarddeR and others added 5 commits July 16, 2026 22:23
…nd deprecate the old module

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…braille package

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ille.input

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LeonarddeR
LeonarddeR marked this pull request as ready for review July 16, 2026 20:54
@LeonarddeR
LeonarddeR requested a review from a team as a code owner July 16, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the braille package split by moving the legacy top-level brailleInput module into the braille package as braille.input (with constants, gesture, and inputHandler submodules), while keeping source/brailleInput.py as a backwards-compatible deprecation shim. Internal imports are migrated to avoid NVDA self-triggering deprecation warnings, and unit tests / changelog entries are extended to cover the new public surface.

Changes:

  • Introduces braille.input package (constants, gesture, inputHandler) and replaces brailleInput.py with a __getattr__-based deprecation shim.
  • Updates internal consumers (core, GUI, commands, display drivers, remote client, regions) to import from the new locations.
  • Extends braille public-surface unit tests and the developer changelog mapping table for the moved brailleInput symbols.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
user_docs/en/changes.md Documents brailleInputbraille.input move and adds old→new symbol mapping.
tests/unit/test_braille/test_publicSurface.py Adds unit coverage for braille.input resident names and brailleInput deprecation shim behavior.
tests/unit/init.py Updates unit test bootstrap to initialize braille input via braille.input.
source/NVDAObjects/init.py Migrates focus/caret hooks to braille.input.handler.
source/gui/settingsDialogs.py Migrates braille input table settings to braille.input.handler.table.
source/globalCommands.py Migrates braille keyboard scripts to braille.input.handler APIs.
source/core.py Migrates initialization/termination wiring to braille.input.
source/brailleInput.py Replaces implementation with MovedSymbol deprecation shim pointing to braille.input.*.
source/brailleDisplayDrivers/seikantk.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/papenmeier.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/nlseReaderZoomax.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/hims.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/hidBrailleStandard.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/handyTech.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/freedomScientific.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/eurobraille/gestures.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/brailliantB.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/brailleNote.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/baum.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/brailleDisplayDrivers/alva.py Updates driver gesture inheritance/imports to braille.input.gesture.BrailleInputGesture.
source/braille/regions/textInfo.py Updates late imports for braille input state used in untranslated-input rendering/routing.
source/braille/input/inputHandler.py New home for BrailleInputHandler and speakDots.
source/braille/input/gesture.py New home for BrailleInputGesture and formatDotNumbers.
source/braille/input/constants.py New home for braille-input constants like DOT7, DOT8, unicode ranges, etc.
source/braille/input/init.py New package facade holding live handler plus initialize/terminate.
source/braille/display/gesture.py Updates display gesture integration with braille keyboard gestures/modifiers.
source/_remoteClient/session.py Migrates remote client gesture typing/imports to new braille input gesture location.
source/_remoteClient/input.py Migrates remote client gesture class inheritance to new braille input gesture location.

Comment thread source/core.py
Comment on lines +824 to +826
import braille.input

brailleInput.initialize()
import braille
braille.input.initialize()
Comment on lines +149 to +152
from ..input import handler as brailleInputHandler

gestureKeys = set(self.keyNames)
gestureModifiers = brailleInput.handler.currentModifiers.copy()
gestureModifiers = brailleInputHandler.currentModifiers.copy()
return None
self.script = scriptHandler._makeKbEmulateScript(combinedScriptName)
brailleInput.handler.currentModifiers.clear()
brailleInputHandler.currentModifiers.clear()
Comment on lines +295 to +297
from ..input import handler as brailleInputHandler

text = brailleInput.handler.untranslatedBraille
text = brailleInputHandler.untranslatedBraille
Comment on lines +407 to +411
from ..input import handler as brailleInputHandler

brailleInput.handler.untranslatedCursorPos = braillePos - self._brailleInputStart
self.brailleCursorPos = self._brailleInputStart + brailleInput.handler.untranslatedCursorPos
brailleInput.handler.updateDisplay()
brailleInputHandler.untranslatedCursorPos = braillePos - self._brailleInputStart
self.brailleCursorPos = self._brailleInputStart + brailleInputHandler.untranslatedCursorPos
brailleInputHandler.updateDisplay()
dot = int(part[3]) - 1
# Update the dots bitmask.
dots += 1 << dot
return (source, cls._makeDisplayText(dots, space))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants