Skip to content

Commit 07328b1

Browse files
authored
Merge 0c53b5f into ca871a4
2 parents ca871a4 + 0c53b5f commit 07328b1

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

source/config/configSpec.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@
279279
[featureFlag]
280280
# 0:default, 1:yes, 2:no
281281
cancelExpiredFocusSpeech = integer(0, 2, default=0)
282+
# 0:Only in test versions, 1:yes
283+
playErrorSound = integer(0, 1, default=0)
282284
"""
283285

284286
#: The configuration specification

source/gui/settingsDialogs.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,6 +2838,20 @@ def __init__(self, parent):
28382838
self._getDefaultValue(['debugLog', x])
28392839
)
28402840
]
2841+
2842+
# Translators: Label for the Play a sound for logged errors combobox, in the Advanced settings panel.
2843+
label = _("Play a sound for logged e&rrors:")
2844+
playErrorSoundChoices = (
2845+
# Translators: Label for a value in the Play a sound for logged errors combobox, in the Advanced settings panel.
2846+
pgettext("advanced.playErrorSound", "Only in NVDA test versions"),
2847+
# Translators: Label for a value in the Play a sound for logged errors combobox, in the Advanced settings panel.
2848+
pgettext("advanced.playErrorSound", "Yes"),
2849+
)
2850+
self.playErrorSoundCombo = debugLogGroup.addLabeledControl(label, wx.Choice, choices=playErrorSoundChoices)
2851+
self.bindHelpEvent("PlayErrorSound", self.playErrorSoundCombo)
2852+
self.playErrorSoundCombo.SetSelection(config.conf["featureFlag"]["playErrorSound"])
2853+
self.playErrorSoundCombo.defaultValue = self._getDefaultValue(["featureFlag", "playErrorSound"])
2854+
28412855
self.Layout()
28422856

28432857
def onOpenScratchpadDir(self,evt):
@@ -2912,6 +2926,7 @@ def onSave(self):
29122926
config.conf["annotations"]["reportDetails"] = self.annotationsDetailsCheckBox.IsChecked()
29132927
for index,key in enumerate(self.logCategories):
29142928
config.conf['debugLog'][key]=self.logCategoriesList.IsChecked(index)
2929+
config.conf["featureFlag"]["playErrorSound"] = self.playErrorSoundCombo.GetSelection()
29152930

29162931
class AdvancedPanel(SettingsPanel):
29172932
enableControlsCheckBox = None # type: wx.CheckBox

source/logHandler.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,13 @@ def emit(self, record):
266266
class FileHandler(logging.FileHandler):
267267

268268
def handle(self,record):
269-
# Only play the error sound if this is a test version.
270-
shouldPlayErrorSound = buildVersion.isTestVersion
269+
import config
270+
# Only play the error sound if this is a test version or if the config states it explicitely.
271+
shouldPlayErrorSound = (
272+
buildVersion.isTestVersion
273+
# Play error sound: 1 = Yes
274+
or config.conf["featureFlag"]["playErrorSound"] == 1
275+
)
271276
if record.levelno>=logging.CRITICAL:
272277
try:
273278
winsound.PlaySound("SystemHand",winsound.SND_ALIAS)

user_docs/en/userGuide.t2t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,11 @@ The checkboxes in this list allow you to enable specific categories of debug mes
19151915
Logging these messages can result in decreased performance and large log files.
19161916
Only turn one of these on if specifically instructed to by an NVDA developer e.g. when debugging why a braille display driver is not functioning correctly.
19171917

1918+
==== Play a sound for logged errors ====[PlayErrorSound]
1919+
This option allows you to specify if NVDA will play an error sound in case an error is logged.
1920+
Choosing Only in test versions (default) makes NVDA play error sounds only if the current NVDA version is a test version (alpha, beta or run from source).
1921+
Choosing Yes allows to enable error sounds whatever your current NVDA version is.
1922+
19181923
++ miscellaneous Settings ++[MiscSettings]
19191924
Besides the [NVDA Settings #NVDASettings] dialog, The Preferences sub-menu of the NVDA Menu contains several other items which are outlined below.
19201925

0 commit comments

Comments
 (0)