Skip to content

Add extension points to eliminate NVDA Remote monkey patching#9917

Closed
LeonarddeR wants to merge 1 commit into
nvaccess:masterfrom
BabbageCom:remoteExtensionPoints
Closed

Add extension points to eliminate NVDA Remote monkey patching#9917
LeonarddeR wants to merge 1 commit into
nvaccess:masterfrom
BabbageCom:remoteExtensionPoints

Conversation

@LeonarddeR
Copy link
Copy Markdown
Collaborator

@LeonarddeR LeonarddeR commented Jul 12, 2019

Link to issue number:

None. Some discussion around #7484 (comment) though
Follow up of #7594, now in draft form

Summary of the issue:

NVDA Remote requires monkey patching to be notified of several actions on a controlled system (e.g. selecting a braille display or playing beeps).

Description of how this pull request fixes the issue:

Implemented the following extension points:

  • braille.handler.filter_writeCells: To filter raw cells before sending them to a braille display
  • braille.handler.filter_displaySize: to filter the display size, e.g. when a remote system has a smaller display
  • braille.handler.decide_enabled: to allow remote to forcefully disable the local braille handler
  • braille.handler.pre_writeCells: To notify of cells about to be written to a display.
  • inputCore.manager.decide_executeGesture: Decider to block some gestures from executing
  • tones.decide_beep: to notify a remote system of beeps, allowing to disable local beeping
  • nvwave.decide_playWaveFile: to notify a remote system of waves played, allowing to disable local playing

* inputCore.manager.decide_executeGesture: Decider for filtering gestures
* tones.decide_beep
* nvwave.decide_playWaveFile

Add extension points to filter the enabled state of the braille handler as well as filter and process the cells written to a braille display
@LeonarddeR LeonarddeR changed the base branch from threshold_py3_staging to threshold July 18, 2019 09:15
@LeonarddeR LeonarddeR changed the base branch from threshold to master July 26, 2019 05:59
@LeonarddeR LeonarddeR mentioned this pull request Sep 9, 2019
1 task
@LeonarddeR LeonarddeR added the BabbageWork Pull requests filed on behalf of Babbage B.V. label Oct 8, 2019
@LeonarddeR
Copy link
Copy Markdown
Collaborator Author

Investigating the NVDA Remote source code and the possible upgrade path to Python 3, I discovered that some additional extension points could be considered. Here is a quick run down of my ideas, particularly for @feerrenrut

  • Optionally, an extension point could be added that could filter or process a speech sequence before it is delivered at the speech manager. This could be added to speech.speak, after the sequence normalisation part.
  • Below that, an extension point could be added that notifies any registered parties about a speech sequence about to be send to the speech manager. This can be used by NVDA Remote to send the speech sequence to the remote system. It is important that this sequence doesn't contain index commands, in other for the controlling system to do its own indexing.
  • cancelSpeech should also contain an extensionPoint to notify the remote system that speech is cancelled.

NVDARemote on python 2 does al sorts of stuff with monkey patching synthDriverHandler.getSynth, in order to be able to monkeypatch the synthesizer driver. This should no longer be necessary, neither if NVDARemote is converted to Python 3 without implementing extension points in NVDA. In the latter case however, it might be better to monkeypatch speech._manager.speak and speech._manager.cancel instead.

@zstanecic
Copy link
Copy Markdown
Contributor

zstanecic commented Oct 30, 2019 via email

@LeonarddeR
Copy link
Copy Markdown
Collaborator Author

LeonarddeR commented Oct 30, 2019 via email

@feerrenrut feerrenrut added Addon/API Changes to NVDA's API for addons to support addon development. enhancement labels Apr 8, 2020
@LeonarddeR
Copy link
Copy Markdown
Collaborator Author

This has always been a draft. As this was only a reference pr and nvda remote 2.3 for python 3 works ok for now, I"m closing this.

@LeonarddeR LeonarddeR closed this May 2, 2020
seanbudd pushed a commit that referenced this pull request Jan 11, 2023
…I consumers (#14503)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Addon/API Changes to NVDA's API for addons to support addon development. BabbageWork Pull requests filed on behalf of Babbage B.V. enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants