Skip to content

Add a payload argument to message dialog callbacks#17660

Merged
SaschaCowley merged 4 commits into
masterfrom
messageDialogCallbackPayload
Feb 4, 2025
Merged

Add a payload argument to message dialog callbacks#17660
SaschaCowley merged 4 commits into
masterfrom
messageDialogCallbackPayload

Conversation

@SaschaCowley

@SaschaCowley SaschaCowley commented Jan 28, 2025

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #17658 

Summary of the issue:

There is currently no way to pass information between message dialogs and their callbacks. This reduces the functionality available to callbacks in future.

Description of user facing changes

None.

Description of development approach

Add a Payload dataclass to gui.message. It currently has no fields, though these can be added without breaking the API in future, for example to implement #17646 .
In MessageDialog._executeCommand, if a command has a callback, instantiate a Payload and pass it to the callback when calling it.
Update the few uses of the message dialog API in NVDA which use callbacks:

  • synthDrivers.sapi4._sapi4DeprecationWarning

Updated the developer guide to note the new requirements for callback functions.

Testing strategy:

Ran NVDA from source, and triggered the affected dialogs. Ensured they worked as expected.

Ran from source, with versionInfo.updateVersionType set to "snapshot:alpha, and checked that updating worked.

Built and installed this branch, then ran the CRFT, cancelling and continuing, and ensured that no issues occured.

Known issues with pull request:

None known.

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.

@coderabbitai summary

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 3ab8b6cd96

@SaschaCowley SaschaCowley marked this pull request as ready for review January 29, 2025 03:20
@SaschaCowley SaschaCowley requested a review from a team as a code owner January 29, 2025 03:20
@SaschaCowley SaschaCowley requested a review from seanbudd January 29, 2025 03:20
Comment thread projectDocs/dev/developerGuide/developerGuide.md Outdated
Co-authored-by: Sean Budd <sean@nvaccess.org>
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Feb 3, 2025
@SaschaCowley SaschaCowley merged commit 113c26e into master Feb 4, 2025
@SaschaCowley SaschaCowley deleted the messageDialogCallbackPayload branch February 4, 2025 00:25
@github-actions github-actions Bot added this to the 2025.1 milestone Feb 4, 2025
LeonarddeR pushed a commit to LeonarddeR/nvda that referenced this pull request Feb 4, 2025
Fixes nvaccess#17658 

Summary of the issue:
There is currently no way to pass information between message dialogs and their callbacks. This reduces the functionality available to callbacks in future.

Description of user facing changes
None.

Description of development approach
Add a `Payload` dataclass to `gui.message`. It currently has no fields, though these can be added without breaking the API in future, for example to implement nvaccess#17646 .
In `MessageDialog._executeCommand`, if a command has a callback, instantiate a `Payload` and pass it to the callback when calling it.
Update the few uses of the message dialog API in NVDA which use callbacks:

* `synthDrivers.sapi4._sapi4DeprecationWarning`

Updated the developer guide to note the new requirements for callback functions.

Testing strategy:
Ran NVDA from source, and triggered the affected dialogs. Ensured they worked as expected.

Ran from source, with `versionInfo.updateVersionType` set to `"snapshot:alpha`, and checked that updating worked.

Built and installed this branch, then ran the CRFT, cancelling and continuing, and ensured that no issues occured.

Known issues with pull request:
None known.
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.

Pass a payload to MessageDialog callbacks

3 participants