Skip to content
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

Create a MessageDialog API #17304

Merged
merged 214 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 84 commits
Commits
Show all changes
214 commits
Select commit Hold shift + click to select a range
dfdd299
Working refactored message dialog based on extant message dialog and …
SaschaCowley Sep 18, 2024
38c99cb
Improve positioning
SaschaCowley Sep 19, 2024
07ba293
Explicitly focus default item
SaschaCowley Sep 19, 2024
a479a4f
Improved types and type hints
SaschaCowley Sep 19, 2024
3326a98
Switched to setLabelText to avoid mnemonic issue
SaschaCowley Sep 19, 2024
1a8f82f
Switched to icon bundles
SaschaCowley Sep 24, 2024
99dd605
Renamed private methods to be dunder
SaschaCowley Sep 24, 2024
2a3df49
Some manual test cases
SaschaCowley Sep 24, 2024
947f669
Added check for default item before focusing
SaschaCowley Sep 24, 2024
6bd8c8a
Minor changes to make temp code work better
SaschaCowley Sep 24, 2024
2e255cb
Implementation of addButton, addOkButton and addCancelButton
SaschaCowley Sep 25, 2024
ce826f2
Return self for chaining, and add a option to set as default
SaschaCowley Sep 25, 2024
9a7dbf8
Added close functionality
SaschaCowley Sep 25, 2024
768e052
Fixed layout issues and updated test case
SaschaCowley Sep 25, 2024
7e6754f
Added post popup call
SaschaCowley Sep 25, 2024
601a193
Added infrastructure for updates to API not yet implemented
SaschaCowley Sep 26, 2024
64801d9
Merge branch 'master' into messageDialogApi
SaschaCowley Sep 26, 2024
a44063d
Swiutch to using partials for callback calling
SaschaCowley Sep 26, 2024
3e5b03c
Added translator comments and some docstrings
SaschaCowley Oct 2, 2024
e7e1d29
Added type checking to `__call_callback`
SaschaCowley Oct 3, 2024
08360fd
Made `addButton` a `singledispatchmethod` that will add a `MessageDia…
SaschaCowley Oct 3, 2024
917d8e4
Refactored `addOkButton` and `addCancelButton` to be `partialmethod`s…
SaschaCowley Oct 3, 2024
273d771
Added multi button add method
SaschaCowley Oct 4, 2024
8f1bcba
Documentation improvements
SaschaCowley Oct 4, 2024
5e9d4c5
Added deque to track open MessageDialog instances
SaschaCowley Oct 7, 2024
f8cde12
Refactored to use a registry oif callbacks
SaschaCowley Oct 7, 2024
ac2be85
Added adders for oother default button types
SaschaCowley Oct 7, 2024
bcc49f9
Added custom button IDs
SaschaCowley Oct 7, 2024
1a95e06
Various code clean-ups
SaschaCowley Oct 7, 2024
5ec943e
Partially working modal dialogs
SaschaCowley Oct 7, 2024
dbca144
Better handling of modal dialogs (still not woroking properly as bloc…
SaschaCowley Oct 8, 2024
c0d0f35
Fixed problem with blocking instances exist
SaschaCowley Oct 8, 2024
2140a45
WIP better performance tracing and layout encapsulation
SaschaCowley Oct 9, 2024
0beba17
Reorganised MessageDialog code
SaschaCowley Oct 10, 2024
648ad0a
Fixed return codes not working
SaschaCowley Oct 10, 2024
2f82b4b
Explicitly hide dialog when closing
SaschaCowley Oct 10, 2024
3053514
Added escape code enum to support ID_NONE and ID_ANY
SaschaCowley Oct 10, 2024
b0b2449
Changed MessageDialogButton.default to MessageDialogButton.default_fo…
SaschaCowley Oct 10, 2024
898c24e
Corrected variable names
SaschaCowley Oct 10, 2024
92bc0ff
Removed staticmethods to classmethods
SaschaCowley Oct 10, 2024
0a66a76
Made isBlocking a property
SaschaCowley Oct 18, 2024
1ee10c3
Improved type annotations
SaschaCowley Oct 18, 2024
c302f72
Documentation improvements
SaschaCowley Oct 18, 2024
0010195
Made Show and ShowModal work in line with wx.Dialog expectations
SaschaCowley Oct 18, 2024
23172ad
Added help id argument
SaschaCowley Oct 18, 2024
bbe7c33
Added exception for trying to show a MessageDialog without buttons
SaschaCowley Oct 18, 2024
81ba8cb
Renamed DefaultMessageDialogButtons to DefaultMessageDialogButton
SaschaCowley Oct 18, 2024
a79d98d
Added an enumeration of common button combinations, and a buttons par…
SaschaCowley Oct 18, 2024
58edca2
Used MessageDialog for about dialog
SaschaCowley Oct 18, 2024
c9c4eff
Added deprecation warning to gui.message.messageBox
SaschaCowley Oct 28, 2024
e740ac7
Re-enabled system test "Quits from keyboard with about dialog open"
SaschaCowley Oct 28, 2024
335f58f
Updated block action to bring blocking dialogs to foreground
SaschaCowley Oct 28, 2024
db03d56
Default action forces close
SaschaCowley Oct 28, 2024
6766cf5
Added a docstring
SaschaCowley Oct 29, 2024
d0ff5cf
Added a draft class-level docstring
SaschaCowley Oct 29, 2024
cb247ab
Respect CloseEvent.CanVeto
SaschaCowley Oct 29, 2024
0f4a4f5
Initial message dialog unit tests
SaschaCowley Oct 30, 2024
1d02fff
Refactored to use a common base class
SaschaCowley Oct 30, 2024
7987c30
Removed default button assignment (reimplement later)
SaschaCowley Oct 30, 2024
eca4e67
Tests for adding standard buttons
SaschaCowley Oct 30, 2024
9fdd603
Added support for adding DefaultMessageDialogButtons with MessageDial…
SaschaCowley Oct 31, 2024
b5a928c
Added methods to easily add default buttons and unit tests for same
SaschaCowley Oct 31, 2024
214e62b
Add hasDefaultAction property
SaschaCowley Nov 1, 2024
8c11e0b
Add docstrings
SaschaCowley Nov 1, 2024
2e836ae
Improved implementation of default action getters
SaschaCowley Nov 1, 2024
561e9d0
Slightly refactored tests and improved docstrings for some tests
SaschaCowley Nov 1, 2024
86fc674
Slight refacter to closing logic
SaschaCowley Nov 1, 2024
725ef74
Re-implemented get default action and tests for same
SaschaCowley Nov 3, 2024
48ec32b
Made _getDefaultActionOrFallback comply with the return type opf _get…
SaschaCowley Nov 3, 2024
4114a0a
Added additional setters and tests
SaschaCowley Nov 4, 2024
b4ff1e1
Call default callback when closing programatically
SaschaCowley Nov 4, 2024
a1faa51
Added docstrings to tests
SaschaCowley Nov 4, 2024
d751804
Made fallback default action more robust
SaschaCowley Nov 4, 2024
abb5a6d
Renamed several double-underscored variables and methods to be single…
SaschaCowley Nov 4, 2024
90117c3
Added tests and docstrings
SaschaCowley Nov 4, 2024
734703f
Added lots of docstrings.
SaschaCowley Nov 4, 2024
a4b708a
Made a bunch of class names more usable
SaschaCowley Nov 4, 2024
540b1bc
Fixed some type info
SaschaCowley Nov 4, 2024
ed30a0c
Added tests for _flatten_buttons
SaschaCowley Nov 5, 2024
7577e91
Made the Show method comply with that of wx.Dialog
SaschaCowley Nov 5, 2024
e7b5f60
Documentation improvements
SaschaCowley Nov 6, 2024
e0917b8
Restored behaviour of having an OK button as default
SaschaCowley Nov 6, 2024
e422e26
Fixed label not being applied to buttons.
SaschaCowley Nov 6, 2024
403fed6
Made id and button positional-only
SaschaCowley Nov 6, 2024
dc7b459
Rename several button properties to bring them into line with NVDA co…
SaschaCowley Nov 11, 2024
bd63423
Parameterized tests for the default button adders to make code more DRY
SaschaCowley Nov 11, 2024
3efdb80
Test that buttons are unique when adding
SaschaCowley Nov 13, 2024
67d5970
Changed addButtons to accept an Collection of Buttons, rather than an…
SaschaCowley Nov 13, 2024
1401640
Remove _flattenButtons
SaschaCowley Nov 13, 2024
3c59af3
Fixed some types
SaschaCowley Nov 13, 2024
b095d2e
Tightened some logic and made the close box enabled only when there i…
SaschaCowley Nov 13, 2024
904befd
Fixed test dialog
SaschaCowley Nov 13, 2024
59ea918
Formatted
SaschaCowley Nov 13, 2024
49c6a2d
Reimplemented gui.message.messageBox using MessageDialog
SaschaCowley Nov 14, 2024
d567f1f
Re-implemented the message box shim
SaschaCowley Nov 15, 2024
fca7eb8
Refactored and documented.
SaschaCowley Nov 15, 2024
0bcb7dc
Added a helper function for calling wx functions on the main thread a…
SaschaCowley Nov 18, 2024
5174826
Used new wxCallOnMain function foor message box shim
SaschaCowley Nov 18, 2024
c24b49e
Tidied up message box shim
SaschaCowley Nov 18, 2024
209b653
Added new function to changes
SaschaCowley Nov 18, 2024
b0e686d
Only allow instantiating message dialogs from the GUI thread
SaschaCowley Nov 18, 2024
9757bb2
Fixed implementation of isBlocking and FocusBlockingInstances
SaschaCowley Nov 18, 2024
2c16430
Added helper methods for alert, confirm and query dialogs
SaschaCowley Nov 18, 2024
594c943
Added some methods to be implemented
SaschaCowley Nov 18, 2024
9072f3a
Added more main thread checks
SaschaCowley Nov 20, 2024
f3331c3
Started implementation of message.MessageDialog -> messageDialog.Mess…
SaschaCowley Nov 20, 2024
e266bc9
Fixed duplicate superclass of gui.nvdaControls._ContinueCancelDialog
SaschaCowley Nov 20, 2024
5655da1
Refactored show checks into their own private method
SaschaCowley Nov 20, 2024
27352c3
Old message dialog shimmed to new one and working with screen curtain…
SaschaCowley Nov 20, 2024
e65e74b
Refactor checks to make them easier to override in subclasses.
SaschaCowley Nov 21, 2024
e72cf5d
Shim for gui.nvdaControls.MessageDialog seems to work fine.
SaschaCowley Nov 21, 2024
5cb75b9
Add sentinel value to allow discrimination of `None` and "not provided".
SaschaCowley Nov 29, 2024
6cabca8
Allow overriding the implicit return code of the action ID by providi…
SaschaCowley Nov 29, 2024
d99f5a4
Update shims of gui.nvdaControls.MessageDialog and gui.nvdaControls._…
SaschaCowley Nov 29, 2024
c4dc3f9
Update changelog
SaschaCowley Nov 29, 2024
1278d16
Added means of changing button labels.
SaschaCowley Nov 29, 2024
c55c6e1
Added the ability to set the message text independent of the __init__
SaschaCowley Nov 29, 2024
cc5274a
Improve logic of alert, confirm and ask classmethods.
SaschaCowley Dec 2, 2024
17fd510
Slight reorganisation in some methods.
SaschaCowley Dec 2, 2024
3e9850a
Code documentation improvements.
SaschaCowley Dec 2, 2024
9d80459
Docstring for MessageDialog._commands
SaschaCowley Dec 3, 2024
ff61f9d
Improved logic for whether dialogs are blocking
SaschaCowley Dec 3, 2024
86c472a
Added callback field to gui.blockAction._Context, and refactored the …
SaschaCowley Dec 3, 2024
01284de
Code style and documentation for gui.guiHelper.wxCallOnMain.
SaschaCowley Dec 3, 2024
1f0cfba
Code clean up and documentation improvements to gui.message.messageBox.
SaschaCowley Dec 3, 2024
e9942ce
Documentation improvements to gui.nvdaControls.MessageDialog
SaschaCowley Dec 3, 2024
129fcea
Removed old gui.nvdaControls.MessageDialog code.
SaschaCowley Dec 3, 2024
fc9e35b
Added commit references to changes
SaschaCowley Dec 3, 2024
d2eef13
Fixed type hints for MethodCall
SaschaCowley Dec 4, 2024
b55c0e5
Changed getDialogState to return a dictionary of button IDs and their…
SaschaCowley Dec 4, 2024
9065524
Fixed return from getDialogState
SaschaCowley Dec 4, 2024
0782453
Added tests for setting button labels.
SaschaCowley Dec 4, 2024
c5f55b3
Parameterised tests of setIcon and playSound to cover all dialog types.
SaschaCowley Dec 4, 2024
b947d20
Fixed test name
SaschaCowley Dec 4, 2024
acd1240
Added test for adding buttons with custom overrides.
SaschaCowley Dec 5, 2024
adc2d23
Removed use of deprecated log.warn
SaschaCowley Dec 5, 2024
2cfa0f8
Added test for adding buttons with non-unique IDs
SaschaCowley Dec 5, 2024
8816470
Fixed use of FindWindowById to FindWindow(id)
SaschaCowley Dec 5, 2024
371848a
Added tests for setting default focus.
SaschaCowley Dec 5, 2024
7a28c4b
Removed unnecessary error case from _getFallbackAction
SaschaCowley Dec 5, 2024
1d033db
Fixed logic for when the default focus is not in command registry
SaschaCowley Dec 5, 2024
a4a4e7c
Added further fallback action tests
SaschaCowley Dec 5, 2024
acad2ff
Added more tests for setting button labels
SaschaCowley Dec 5, 2024
b5a3895
Refactored MdTestBase into WxTestBase -> MdTestBase
SaschaCowley Dec 5, 2024
614e649
Added tests for threading
SaschaCowley Dec 5, 2024
b1a3457
Fixed test case name
SaschaCowley Dec 5, 2024
020a78b
Added unittests for showing and hiding
SaschaCowley Dec 5, 2024
7559b3f
Improved modal show tests.
SaschaCowley Dec 5, 2024
428a6ed
Added tests for showEvent
SaschaCowley Dec 5, 2024
f4ed2d1
Fixed implementation of _getFallbackAction, _getFallbackActionOrFallb…
SaschaCowley Dec 5, 2024
30b8c64
Added tests for blocking dialogs.
SaschaCowley Dec 6, 2024
6f2d760
Fixed issue when force-closing non-modal dialog
SaschaCowley Dec 6, 2024
e5054ab
Renamed _execute_command to _executeCommand
SaschaCowley Dec 6, 2024
ca5e0ad
Added tests for _onCloseEvent
SaschaCowley Dec 6, 2024
d8073b4
Added test for closeInstances
SaschaCowley Dec 6, 2024
3230860
Added tests for isBlocking
SaschaCowley Dec 6, 2024
05c7540
Renamed hasDefaultAction to hasFallback to match rename of defaultAct…
SaschaCowley Dec 6, 2024
8b22b04
Added tests for executeCommand
SaschaCowley Dec 6, 2024
c419a58
Added guidance on dialog types
SaschaCowley Dec 6, 2024
c26dfb5
Renamed setDefaultAction to setFallbackAction
SaschaCowley Dec 6, 2024
3b3be1b
Doocstring improvements
SaschaCowley Dec 6, 2024
679b2a7
Renamed EscapeCode members to be more self documenting
SaschaCowley Dec 6, 2024
57ca154
Renamed _realize_layout to _realizeLayout in line with NV Access style
SaschaCowley Dec 6, 2024
d00e5ea
Added a bunch of missing docstrings
SaschaCowley Dec 6, 2024
b38630a
Removed some commented out code
SaschaCowley Dec 6, 2024
aa207b5
Initial docs
SaschaCowley Dec 6, 2024
ec43446
Added docstring to __init__
SaschaCowley Dec 6, 2024
6b5e084
Added documentation of convenience methods to dev docs
SaschaCowley Dec 6, 2024
ead1ec5
Moved DialogType to gui.message
SaschaCowley Dec 6, 2024
0cf5f15
Moved EscapeCode to gui.message
SaschaCowley Dec 6, 2024
4f86bfd
Moved DialogType to gui.message
SaschaCowley Dec 6, 2024
6bb8a4c
Moved over the rest of gui.messageDialog to gui.message
SaschaCowley Dec 6, 2024
9ebe8cc
Updated copyright years
SaschaCowley Dec 6, 2024
8df3553
Improvements to tests
SaschaCowley Dec 6, 2024
e9b95d0
Renamed tests to be more in line with NVDA style
SaschaCowley Dec 6, 2024
a850585
Removed testing items from NVDA menu.
SaschaCowley Dec 6, 2024
a4b82e6
Updated dev docs with information on importing
SaschaCowley Dec 6, 2024
2ce6839
Updated changes
SaschaCowley Dec 6, 2024
18f8fc9
Deleted old messageDialog.py file
SaschaCowley Dec 6, 2024
23a6114
Merge branch 'master' into messageDialogApi
SaschaCowley Dec 6, 2024
be3f223
Pre-commit auto-fix
pre-commit-ci[bot] Dec 6, 2024
1bb02f7
Made delay before block message a constant
SaschaCowley Dec 10, 2024
81be523
Fixed misspelling
SaschaCowley Dec 10, 2024
581dc33
Added explicit import to first example in developer guide for clarity
SaschaCowley Dec 10, 2024
3dc1206
Made thread safety warning more prominant
SaschaCowley Dec 10, 2024
e256e4f
Added note on custom button IDs
SaschaCowley Dec 10, 2024
7db3eb1
Fixed outdated docstring
SaschaCowley Dec 10, 2024
c29ecf6
Added error checking to _onCloseEvent
SaschaCowley Dec 10, 2024
20f0e59
Renamed event handlers to be more consistant
SaschaCowley Dec 11, 2024
6c68ce6
Update requirements.txt
SaschaCowley Dec 11, 2024
c296eb9
Update source/gui/blockAction.py
SaschaCowley Dec 11, 2024
39fbd5b
Rewrote wxCallOnMain to use nonlocal rather than helper class
SaschaCowley Dec 11, 2024
c5d775e
Update source/gui/guiHelper.py
SaschaCowley Dec 11, 2024
a59912a
Update source/gui/guiHelper.py
SaschaCowley Dec 11, 2024
85cbef9
Update user_docs/en/changes.md
SaschaCowley Dec 11, 2024
21614a9
Made dialog destruction and deletion more robust
SaschaCowley Dec 11, 2024
8ae47bc
Fixed incorrect call to warn
SaschaCowley Dec 11, 2024
81cc995
Made runScriptModal safer, and marked it for removal
SaschaCowley Dec 11, 2024
448630b
Merge branch 'i13007' of https://github.com/nvaccess/nvda into messag…
SaschaCowley Dec 11, 2024
41c01f5
Added type hints to _onActivateEvent and _onShowEvent for the screen …
SaschaCowley Dec 12, 2024
8990d9c
Apply suggestions from code review
SaschaCowley Dec 12, 2024
08bbbd1
Changed some methods to use lower camel case
SaschaCowley Dec 12, 2024
db53c83
Improved logging
SaschaCowley Dec 12, 2024
ca09d42
Apply suggestions from code review
SaschaCowley Dec 12, 2024
da2fe29
Removed footnotes from the developer guide
SaschaCowley Dec 12, 2024
451f370
Removed __del__ that was failing
SaschaCowley Dec 12, 2024
fcafc8a
Corrects to dev guide
SaschaCowley Dec 13, 2024
0c7a6c7
Corrections to dev guide
SaschaCowley Dec 13, 2024
65ced3c
Merge branch 'i13007' of https://github.com/nvaccess/nvda into messag…
SaschaCowley Dec 13, 2024
8b02b72
Apply suggestions from code review
SaschaCowley Dec 13, 2024
0dce0e9
Made several parameterized argument lists namedtuples for readability
SaschaCowley Dec 13, 2024
0c99151
Merge branch 'master' into messageDialogApi
SaschaCowley Dec 13, 2024
f52a07e
Fixed up admonissions
SaschaCowley Dec 18, 2024
f437723
Added notes on thread safety
SaschaCowley Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion source/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# be cautious when removing
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
messageBox,
)
from .messageDialog import MessageDialog
from . import blockAction
from .speechDict import (
DefaultDictionaryDialog,
Expand Down Expand Up @@ -70,6 +71,7 @@
import winUser
import api
import NVDAState
from gui.messageDialog import MessageDialog as NMD


if NVDAState._allowDeprecatedAPI():
Expand Down Expand Up @@ -367,7 +369,7 @@ def onInputGesturesCommand(self, evt):

def onAboutCommand(self, evt):
# Translators: The title of the dialog to show about info for NVDA.
messageBox(versionInfo.aboutMessage, _("About NVDA"), wx.OK)
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
MessageDialog(None, versionInfo.aboutMessage, _("About NVDA")).Show()

@blockAction.when(blockAction.Context.SECURE_MODE)
def onCheckForUpdateCommand(self, evt):
Expand Down Expand Up @@ -575,6 +577,29 @@ def onConfigProfilesCommand(self, evt):
ProfilesDialog(mainFrame).Show()
self.postPopup()

def onModelessOkCancelDialog(self, evt):
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
self.prePopup()
dlg = (
NMD(
self,
"This is a modeless dialog with OK and Cancel buttons. Test that:\n"
"- The dialog appears correctly both visually and to NVDA\n"
"- The dialog has the expected buttons\n"
"- Pressing the Ok or Cancel button has the intended effect\n"
"- Pressing Esc has the intended effect\n"
"- Pressing Alt+F4 has the intended effect\n"
"- Using the close icon/system menu close item has the intended effect\n"
"- You are still able to interact with NVDA's GUI\n"
"- Exiting NVDA does not cause errors",
"Non-modal OK/Cancel Dialog",
)
.addOkButton(callback=lambda: messageBox("You pressed OK!"))
.addCancelButton(callback=lambda: messageBox("You pressed Cancel!"))
)

dlg.ShowModal()
self.postPopup()


class SysTrayIcon(wx.adv.TaskBarIcon):
def __init__(self, frame: MainFrame):
Expand Down Expand Up @@ -681,6 +706,15 @@ def __init__(self, frame: MainFrame):
)
self.Bind(wx.EVT_MENU, frame.onExitCommand, item)

dialogMenu = wx.Menu()
item = dialogMenu.Append(wx.ID_ANY, "Ok")
item = dialogMenu.Append(wx.ID_ANY, "Ok and Cancel")
self.Bind(wx.EVT_MENU, frame.onModelessOkCancelDialog, item)
item = dialogMenu.Append(wx.ID_ANY, "Yes and No")
item = dialogMenu.Append(wx.ID_ANY, "Yes, No and Cancel")

self.menu.AppendSubMenu(dialogMenu, "&Dialog")

self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.onActivate)
self.Bind(wx.adv.EVT_TASKBAR_RIGHT_DOWN, self.onActivate)

Expand Down
13 changes: 11 additions & 2 deletions source/gui/blockAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from functools import wraps
import globalVars
from typing import Callable
from speech.priorities import SpeechPriority
import ui
from utils.security import isLockScreenModeActive, isRunningOnSecureDesktop
from gui.message import isModalMessageBoxActive
import queueHandler
import core


@dataclass
Expand Down Expand Up @@ -74,7 +75,15 @@ def _wrap(func):
def funcWrapper(*args, **kwargs):
for context in contexts:
if context.blockActionIf():
queueHandler.queueFunction(queueHandler.eventQueue, ui.message, context.translatedMessage)
if context == Context.MODAL_DIALOG_OPEN:
# Import late to avoid circular import
from gui.messageDialog import MessageDialog

if MessageDialog.BlockingInstancesExist():
MessageDialog.FocusBlockingInstances()
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
# We need to delay this message so that, if a dialog is to be focused, the appearance of the dialog doesn't interrupt it.
# 1ms is a magic number. It can be increased if it is found to be too short, but it should be kept to a minimum.
core.callLater(1, ui.message, context.translatedMessage, SpeechPriority.NOW)
return
return func(*args, **kwargs)

Expand Down
6 changes: 6 additions & 0 deletions source/gui/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Optional

import wx
import warnings

import extensionPoints

Expand Down Expand Up @@ -97,6 +98,11 @@ def messageBox(
Because an answer is required to continue after a modal messageBox is opened,
some actions such as shutting down are prevented while NVDA is in a possibly uncertain state.
"""
warnings.warn(
DeprecationWarning(
"gui.message.messageBox is deprecated. Use gui.message.MessageDialog instead.",
),
)
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
from gui import mainFrame
import core
from logHandler import log
Expand Down
Loading