Skip to content

Support multi routing on Freedom Scientific displays#20250

Merged
seanbudd merged 12 commits into
nvaccess:masterfrom
LeonarddeR:fixFreedom
Jun 3, 2026
Merged

Support multi routing on Freedom Scientific displays#20250
seanbudd merged 12 commits into
nvaccess:masterfrom
LeonarddeR:fixFreedom

Conversation

@LeonarddeR

@LeonarddeR LeonarddeR commented May 29, 2026

Copy link
Copy Markdown
Collaborator

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?

@LeonarddeR LeonarddeR marked this pull request as ready for review June 1, 2026 05:26
@LeonarddeR LeonarddeR requested a review from a team as a code owner June 1, 2026 05:26
Copilot AI review requested due to automatic review settings June 1, 2026 05:26
@LeonarddeR LeonarddeR requested a review from a team as a code owner June 1, 2026 05:26
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Thanks @DataTriny and @cary-rowen

@cary-rowen wrote:

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?

This is expected behavior. The last cell is exclusive, otherwise it would never be possible to select one character.

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR extends Freedom Scientific braille display support by adding a “multi routing” gesture (pressing multiple routing keys) and wiring it to a new default “select range” command, while updating documentation and adding a deprecation shim for the old routing gesture class name.

Changes:

  • Add a multiRouting gesture and bind it by default to “select range” on supporting Freedom Scientific devices.
  • Refactor the Freedom Scientific driver to emit KeyGesture for routing keys (including multi-key/range cases) and provide a compatibility deprecation path.
  • Update user guide and changelog to document the new gesture and supported drivers.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
user_docs/en/userGuide.md Documents the new multiRouting gesture in the key/gesture table.
user_docs/en/changes.md Updates changelog for multi-routing support and adds deprecation notes.
source/brailleDisplayDrivers/freedomScientific.py Implements multi-routing behavior, refactors gesture execution, and adds deprecation handling for RoutingGesture.

Comment thread user_docs/en/changes.md
Comment thread source/brailleDisplayDrivers/freedomScientific.py
Comment thread source/brailleDisplayDrivers/freedomScientific.py Outdated
Comment thread source/brailleDisplayDrivers/freedomScientific.py
Comment thread source/brailleDisplayDrivers/freedomScientific.py Outdated
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Jun 1, 2026

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @LeonarddeR changes look generally good

Comment thread source/brailleDisplayDrivers/freedomScientific.py
Comment thread user_docs/en/userGuide.md Outdated
Comment thread source/brailleDisplayDrivers/freedomScientific.py Outdated
@LeonarddeR LeonarddeR requested a review from seanbudd June 2, 2026 07:16

@Qchristensen Qchristensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good.

@seanbudd seanbudd merged commit e51ab6a into nvaccess:master Jun 3, 2026
40 of 42 checks passed
@github-actions github-actions Bot added this to the 2026.3 milestone Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signal routing button presses for Freedom Scientific displays

6 participants