Skip to content

Support multi routing on Freedom Scientific displays#20250

Draft
LeonarddeR wants to merge 6 commits into
nvaccess:masterfrom
LeonarddeR:fixFreedom
Draft

Support multi routing on Freedom Scientific displays#20250
LeonarddeR wants to merge 6 commits into
nvaccess:masterfrom
LeonarddeR:fixFreedom

Conversation

@LeonarddeR
Copy link
Copy Markdown
Collaborator

@LeonarddeR LeonarddeR commented May 29, 2026

Link to issue number:

Fixes #20077. Follow-up of #20028.

Summary of the issue:

The Freedom Scientific driver ignored routing button presses entirely (if isPress: return) and fired a single-cell RoutingGesture on each release. It could not signal which routing keys were held together, so the "multi routing" / "select range" infrastructure added in #20028 had no effect on Focus/PAC Mate displays.

Description of user facing changes:

  • Pressing multiple routing keys simultaneously on Freedom Scientific Focus/PAC Mate displays is now a single "multi routing" gesture, bound to "select range" by default.
  • Single routing presses (route to cell) and the top routing row (scroll) keep working as before.

Description of developer facing changes:

  • brailleDisplayDrivers.freedomScientific.RoutingGesture is deprecated; use KeyGesture, which now carries routing state. Backward compatibility is preserved via a module-level __getattr__ / MovedSymbol.
  • KeyGesture gains routingKeyBits / topRoutingKeyBits parameters, sets cellIndexes, and builds its id via idForCellCount.

Description of development approach:

  • Routing presses are now tracked as bitmasks (_routingKeyBits, _topRoutingKeyBits) in _handleRoutingKey; one combined KeyGesture fires on the first release, then the bits clear. This mirrors the existing _handleKeys / _updateKeyBits release model instead of firing per key.
  • KeyGesture merges the cells addressed by every routing range into one sorted cellIndexes list and emits an idForCellCount part per range, mirroring the ALVA and Standard HID Braille drivers.
  • Alongside the fix, the driver was modernized/simplified with no behavior change: Python 3 idioms (super(), f-strings, OSError, list[int] / X | None), full type hints, Sphinx-style docstrings, list-comprehension _translate, sum-based checksum, extracted _executeGesture and _bitmaskToIndexes helpers, and removal of dead code, stale Python 2 comments and pylint pragmas.

Testing strategy:

Manual testing on a Focus display: single routing routes to a cell; two routing keys select a range; the top row scrolls.

Known issues with pull request:

None.

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.

LeonarddeR and others added 6 commits May 29, 2026 21:28
Modernize the Freedom Scientific driver alongside the multi-routing work:
- Python 3 idioms (super(), f-strings, OSError, list[int] / X | None)
- full type hints and Sphinx-style docstrings
- list-comprehension _translate, sum-based checksum
- extract _executeGesture and _bitmaskToIndexes helpers
- drop dead handleArg type check, stale Python 2 comments, pylint pragmas

Fix multi-range routing in KeyGesture: merge the cells addressed by every
routing range into one sorted cellIndexes list, emitting an idForCellCount
part per range, mirroring ALVA and Standard HID. Previously a simultaneous
main-row + top-row press dropped the main-row cells.

Also remove a stray merge conflict marker in changes.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A pure-routing release (keyBits == 0) sets dots to 0, which is already the
class default and yields no braille-input identifiers, so the guard had no
behavioral effect.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LeonarddeR
Copy link
Copy Markdown
Collaborator Author

cc @bramd, @cary-rowen, @DataTriny testing would be greatly appreciated.

@DataTriny
Copy link
Copy Markdown
Contributor

@LeonarddeR Text selection seem to work well for me: Focus 5th gen, 40 cells.

@cary-rowen
Copy link
Copy Markdown
Contributor

Thanks @LeonarddeR

Focus 40 cells now support multi-routing. There is one issue:
When I want to select the first four characters, "ABCD," I actually have to press the first and fifth Routing buttons at the same time. Is this expected behavior?

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.

Signal routing button presses for Freedom Scientific displays

3 participants