-
-
Notifications
You must be signed in to change notification settings - Fork 646
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #13007 Closes #12344 Closes #12353 Summary of the issue: Currently, there are several ways to create message boxes/dialogs in NVDA, all of them with their own drawbacks. Additionally, subclassing `wx.Dialog` (or using it directly) brings with it the risk of breaking parts of NVDA. See #13007 for in-depth discussion. Thus, a new API for creating highly customizable dialogs that work well with NVDA is desired. Description of user facing changes This PR does not, in itself, introduce any end-user facing changes. However, it lays the groundwork for closing a number of issues. Description of development approach Subclassed `wx.Dialog` to add the desired functionality in #13007 Re-implemented the about box to use a `MessageDialog`. Added a callback field to `gui.blockAction._Context` to allow adding a function to execute when the block condition is met. Features and tasks * [x] Rename buttons * [x] Add custom buttons * [x] Associate context help with the given message box * [x] Show the dialog as a modal or a non-modal * [x] for non modal dialogs: * [x] provide a default return code when dialogs are forced to close (eg via an exit, perform cancel) (WIP) * [x] attach a callback to handle return codes * [x] refocus a dialog in the event of needing to close it * [x] if a default return code is provided, make the dialog close-able with alt+F4 and escape (WIP) * [x] for modal dialogs: * [x] if wx.CANCEL is provided, make the dialog close-able with alt+F4 and escape (mostly done) * [x] nice to have: * [x] if wx.CANCEL is provided, perform this action when dialogs are forced to close. * [x] refocus a dialog in the event of needing to close it * [x] Ensure that the test `Quits from keyboard with about dialog open` is re-enabled and works. * [x] Block exiting NVDA with modal `MessageDialog`s open. * [x] Focus open `MessageDialog`s without default actions when exiting. * [x] Tests * [x] Unit tests * [x] Document the new API in the developer guide * [x] Migrate the new API from `gui.MessageDialog` to `gui.message`. * [x] Mark other means of creating message dialogs as deprecated. * [x] Re implement their internals to use the new API * [x] `gui.message.messageBox` * [x] `gui.nvdaControls.MessageDialog` * [x] `gui.nvdaControls._ContinueCancelDialog` Testing strategy: Unit and manual tests. Unit tests are extensive, and reach around 85% coverage of the newly added code. Message box shim tested with a variety of inputs and unittests. This is a fairly straightforward adapter. `nvdaControls.MessageDialog` tested that screen curtain and add-on install warning dialogs still work as expected. Its private subclass, `_ContinueCancelDialog`, was tested by attempting to run the CRFT. Known issues with pull request: Internal dialogs are yet to be migrated. This should be done gradually before the existing means of creating message dialogs are removed. Slightly odd behaviour when a callback function blocks, and `focusBlockingInstances` is called, where a hidden dialog is focused. This can be worked around, but possibly not without unintended consequences. Some invalid combinations (namely a button which is set as the default action but set not to close the dialog) are silently changed. While documenting this should be sufficient, logging or raising an exception may be warranted. Visual proportions of the re-implemented About dialog are different. The `ctrl+c` behaviour of copying the dialog's title, contents and buttons is not supported. Future work * Remove all internal use of deprecated message dialog APIs. * Remove deprecated message dialog APIs in 2026.1. Nice to have * Implement system tests for the new API. * Comprehensively document a manual test plan, and develop any associated scripts. * Add the ability to set a callback after a button has been added. * Add a helper to add a "don't show this message again" checkbox.
- Loading branch information
1 parent
bcccf14
commit 2477780
Showing
12 changed files
with
2,515 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.