Skip to content

Add Braille and Tones extension points to avoid monkey patching by API consumers #14503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jan 11, 2023

Conversation

LeonarddeR
Copy link
Collaborator

@LeonarddeR LeonarddeR commented Jan 3, 2023

Link to issue number:

Replaces #9917

Summary of the issue:

Tools like NVDA remote that need to intercept speech and braille output currently rely on monkeypatching to do this.

Description of user facing changes

It is no longer possible to override the display size of the braille handler by setting braille.handler.displaySize. It is also no longer possible to enable/disable the handler by setting braille.handler.enabled.

Description of development approach

Added the following extension points:

  • inputCore.manager.decide_executeGesture: Decider for filtering gestures
  • tones.decide_beep
  • nvwave.decide_playWaveFile
  • braille.handler.pre_writeCells
  • braille.handler.filter_displaySize
  • braille.handler.decide_enabled
  • braille.handler.displayChange
  • braille.handler.displaySizeChanged

This means that NVDA Remote and similar tools can at least drop all monkeypatching related to braille, playing tones and waves. Speech is a separate subject and will be handled in a follow up.

Testing strategy:

  • Tested that NVDA will still work as normal.
  • Tested that lowering the display size programatically adds a full cell to the end of the text to indicate that there's a hard stop because of a lower cell count used.
  • New unit tests

Known issues with pull request:

None known

Change log entries:

For Developers

  • Added the following extension points: (Check them in source documentation for details).
  • inputCore.manager.decide_executeGesture
  • tones.decide_beep
  • nvwave.decide_playWaveFile
  • braille.handler.pre_writeCells
  • braille.handler.filter_displaySize
  • braille.handler.decide_enabled
  • braille.handler.displayChanged
  • braille.handler.displaySizeChanged

API breaking changes

  • it is no longer possible to enable/disable the braille handler by setting braille.handler.enabled or update the display size of the handler by setting braille.handler.displaySize.
  • To update the displaySize programatically, register a handler to braille.handler.filter_displaySize. See the brailleViewer code for an example on how to do this.
  • To disable the braille handler programatically, register a handler to braille.handler.decide_enabled.

Code Review Checklist:

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

* inputCore.manager.decide_executeGesture: Decider for filtering gestures
* tones.decide_beep
* nvwave.decide_playWaveFile
* braille.handler.pre_writeCells
* braille.handler.filter_displaySize
* braille.handler.decide_enabled
@LeonarddeR LeonarddeR requested a review from a team as a code owner January 3, 2023 12:40
@LeonarddeR LeonarddeR requested a review from seanbudd January 3, 2023 12:40
@AppVeyorBot
Copy link

See test results for failed build of commit c24a56155a

@AppVeyorBot
Copy link

See test results for failed build of commit 4ff1ae2c34

@AppVeyorBot
Copy link

See test results for failed build of commit c25aab6ec4

@CyrilleB79
Copy link
Collaborator

Small fix in change log:
(Check their in source documentation for details): replace "their" by "them"

LeonarddeR and others added 2 commits January 4, 2023 07:29
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@AppVeyorBot
Copy link

See test results for failed build of commit f4f92ae9da

@seanbudd
Copy link
Member

seanbudd commented Jan 4, 2023

It seems that the system tests are failing for a legitimate reason on this PR

@seanbudd seanbudd marked this pull request as draft January 4, 2023 23:22
@AppVeyorBot
Copy link

See test results for failed build of commit a44cfee9b9

@LeonarddeR
Copy link
Collaborator Author

I'l have a look and will add one additional extension point plus some unit tests as well.

@AppVeyorBot
Copy link

See test results for failed build of commit e1d27383a5

@AppVeyorBot
Copy link

See test results for failed build of commit a43126dff8

@AppVeyorBot
Copy link

See test results for failed build of commit b44f589a85

@AppVeyorBot
Copy link

See test results for failed build of commit 74f272c4bd

@LeonarddeR
Copy link
Collaborator Author

The system tests are working and all the unit tests are in place. I think this is readdy for another review.

@seanbudd seanbudd added this to the 2023.1 milestone Jan 9, 2023
@seanbudd seanbudd changed the title Add additional extension points to avoid monkey patching by NVDA remote and similar tools Add Braille and Tones extension points to avoid monkey patching by API consumers Jan 9, 2023
@seanbudd seanbudd marked this pull request as draft January 9, 2023 23:48
@LeonarddeR LeonarddeR requested a review from seanbudd January 10, 2023 08:53
@LeonarddeR LeonarddeR marked this pull request as ready for review January 10, 2023 08:53
Copy link
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

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

Thanks @LeonarddeR , LGTM, I can fix up the docstring when updating the changes

Comment on lines 1938 to 1941
#: Internal cache for the displaySize property.
#: This attribute is used to compare the displaySize output by l{filterDisplaySize}
#: with its previous output.
#: If the value differs, L{displaySizeChanged} is notified.
Copy link
Member

Choose a reason for hiding this comment

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

can this be turned into a docstring like the others?

@seanbudd seanbudd merged commit f62986e into nvaccess:master Jan 11, 2023
seanbudd pushed a commit that referenced this pull request Jan 16, 2023
Fixup of #14503

Summary of the issue:
When a handler was registered to decide_enabled and a cursor was blinking or a message with timeout was shown on the braille display, the display would still be updated. Found when working on NVDA Remote to integrate the extension points.
The extensionPointTestHelpers wouldn't strictly test whether the handler was actually called. Also the handler argument for value was incorrect and using a class to store the filter value was overdone.
Description of user facing changes
When a handler decides to disable the braille handler, cursor blinking is now stopped and a message is dismissed.
seanbudd pushed a commit that referenced this pull request Jan 16, 2023
…x FilterValueT name (#14549)

Summary of the issue:
FilterValueTypeT nneeded renaming to FilterValueT and had a wrong string in its TypeVar declaration.
When experimenting with the extensionPoints, particularlyy with registering a handler to decide_executeGesture in a braille display driver, I discovered that inputCore was not yet initialized when initializing the driver and therefore extension point registration failed.
Description of user facing changes
Moved extension points, changes file is changed as part of this pr to reflect this.

Description of development approach
Just moving and renaming code
seanbudd added a commit that referenced this pull request Jan 19, 2023
AAClause added a commit to AAClause/BrailleExtender that referenced this pull request Apr 15, 2023
seanbudd pushed a commit that referenced this pull request Jul 31, 2023
…ewer (#15214)

Fixes regression from #14503

Summary of the issue:
As part of #14503, braille extension points have been added that are used by the braille viewer. However when destroying the braille viewer by pressing alt+f4, the display size filter handler was never unregistered, resulting in the braille handler still assuming 40 braille cells even though no display was connected.

Description of user facing changes
Braille handler connectly restores to 0 cells again after disabling the braille viewer with alt+f4 when no braille display is connected.

Description of development approach
Changed if check on the dialog to is not None explicitly. wx gives a destroyed window a bool value of False, so the boolean check would work.
Ensure braille.filter_displaySize is unregistered when destroyBrailleViewer is called when the window is already destroyed. Note that destroying the window will unregister braille.pre_writeCells properly, so that unregistration can be limited to an undestroyed window only.
AAClause added a commit to AAClause/BrailleExtender that referenced this pull request Oct 7, 2023
AAClause added a commit to AAClause/BrailleExtender that referenced this pull request May 12, 2024
AAClause added a commit to AAClause/BrailleExtender that referenced this pull request May 12, 2024
AAClause added a commit to AAClause/BrailleExtender that referenced this pull request May 12, 2024
AAClause added a commit to AAClause/BrailleExtender that referenced this pull request May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants