Move brailleInput into the braille.input package and deprecate the old module#20509
Open
LeonarddeR wants to merge 5 commits into
Open
Move brailleInput into the braille.input package and deprecate the old module#20509LeonarddeR wants to merge 5 commits into
LeonarddeR wants to merge 5 commits into
Conversation
…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>
Contributor
There was a problem hiding this comment.
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.inputpackage (constants,gesture,inputHandler) and replacesbrailleInput.pywith 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
brailleInputsymbols.
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 brailleInput → braille.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 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Part of #12772
Follow-up to #20252, #20390 and #20458
Summary of the issue:
In #20252,
source/braille.pywas split into thebraillepackage, and #20390 deprecated the symbols that moved out of the module facade. ThebrailleInputmodule 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:
brailleInputmodule has moved into the braille package asbraille.input, split into focused submodules:braille.input.constants:FALLBACK_TABLE,DOT7,DOT8,LOUIS_DOTS_IO_START,UNICODE_BRAILLE_STARTandUNICODE_BRAILLE_PROTECTEDbraille.input.gesture:BrailleInputGestureandformatDotNumbersbraille.input.inputHandler:BrailleInputHandlerandspeakDotsbraille.inputitself keeps the live state: thehandlersingleton,initializeandterminatebrailleInputmodule 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:
brailleInput.pyinto thebraille/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:constants←gesture←inputHandler←__init__.brailleInput.pywith a module level__getattr__built withutils._deprecate.handleDeprecations, containing aMovedSymbolfor each of the 13 public symbols. SinceMovedSymbol.valueresolves on every access,brailleInput.handlerkeeps returning the live handler instance even though it is reassigned on initialize/terminate.braille.display.gestureandbraille.regions.textInforemain function-local, asbraille.input.inputHandlerimportsbraille.regions.textInfoat module level.Testing strategy:
TestBrailleInputPublicSurfacetotests/unit/test_braille/test_publicSurface.py, asserting that resident names onbraille.inputare reachable without a deprecation warning and that every deprecatedbrailleInputname resolves to the identical object in its new home while logging a warning.Known issues with pull request:
None known.
Code Review Checklist:
🤖 Generated with Claude Code