File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55# This file is covered by the GNU General Public License.
66# See the file COPYING for more details.
77
8+ from dataclasses import dataclass
89import threading
910import time
1011import warnings
@@ -154,8 +155,13 @@ def displayError(self, parentWindow: wx.Window):
154155 )
155156
156157
158+ @dataclass (frozen = True )
159+ class Payload :
160+ """Payload of information to pass to message dialog callbacks."""
161+
162+
157163# TODO: Change to type statement when Python 3.12 or later is in use.
158- _Callback_T : TypeAlias = Callable [[], Any ]
164+ _Callback_T : TypeAlias = Callable [[Payload ], Any ]
159165
160166
161167class _Missing_Type :
@@ -1139,7 +1145,8 @@ def _executeCommand(
11391145 if callback is not None :
11401146 if close :
11411147 self .Hide ()
1142- callback ()
1148+ payload = Payload ()
1149+ callback (payload )
11431150 if close :
11441151 self .SetReturnCode (returnCode )
11451152 self .Close ()
Original file line number Diff line number Diff line change @@ -486,7 +486,7 @@ def _mmDeviceEndpointIdToWaveOutId(targetEndpointId: str) -> int:
486486def _sapi4DeprecationWarning (synth : SynthDriver , audioOutputDevice : str , isFallback : bool ):
487487 """A synthChanged event handler to alert the user about the deprecation of SAPI4."""
488488
489- def setShown ():
489+ def setShown (payload : gui . message . Payload ):
490490 synth ._hasWarningBeenShown = True
491491 synth .saveSettings ()
492492
@@ -509,7 +509,7 @@ def impl():
509509 ).addHelpButton (
510510 # Translators: A button in a dialog.
511511 label = _ ("Open user guide" ),
512- callback = lambda : gui .contextHelp .showHelp ("SupportedSpeechSynths" ),
512+ callback = lambda payload : gui .contextHelp .showHelp ("SupportedSpeechSynths" ),
513513 ).Show ()
514514
515515 if (not isFallback ) and (synth .name == "sapi4" ) and (not getattr (synth , "_hasWarningBeenShown" , False )):
You can’t perform that action at this time.
0 commit comments