Skip to content

Commit 3ab8b6c

Browse files
authored
Merge da8bc4b into 8ec1116
2 parents 8ec1116 + da8bc4b commit 3ab8b6c

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

source/gui/message.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
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
89
import threading
910
import time
1011
import 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

161167
class _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()

source/synthDrivers/sapi4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def _mmDeviceEndpointIdToWaveOutId(targetEndpointId: str) -> int:
486486
def _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)):

0 commit comments

Comments
 (0)