Skip to content

Option to configure when the error sound may be played.#12689

Merged
feerrenrut merged 9 commits into
nvaccess:masterfrom
CyrilleB79:beepOnError
Aug 26, 2021
Merged

Option to configure when the error sound may be played.#12689
feerrenrut merged 9 commits into
nvaccess:masterfrom
CyrilleB79:beepOnError

Conversation

@CyrilleB79

@CyrilleB79 CyrilleB79 commented Jul 27, 2021

Copy link
Copy Markdown
Contributor

Link to issue number:

#12672

Summary of the issue:

The error sound that is played in test versions may also be useful to testers on stable and RC releases.
The motivation to have this feature included in NVDA's core rather than in an add-on is that it may be useful to test NVDA stable versions with add-ons disabled.

Description of how this pull request fixes the issue:

Added a 'Play a sound for logged errors' option in the advanced settings panel. It is a combo-box with two choices:

  • 'Only in test versions': NVDA plays error sounds as today, i.e. only in NVDA test versions (alpha, beta and from source) but not in RC or stable.
  • Yes: NVDA plays the error sound whatever its version (test or stable)
    According to the discussion in Have a way to configure beep on error #12672, I do not provide an option to disable error sounds in tests versions, since test versions are aimed to capture potential issues. Thus error notifications should not be disabled for this usage.

If an error occurs before the config is initialized, the default behaviour is applied, i.e. the error sound is played only in test versions.

Note for reviewers:

  • I have had to import config in the handle method rather than at the top of the module since NVDA could not start in the latter case. I do not know why however, since I do not know anymore how to debug this since the virtual environment has been set up.
  • Please native English speakers, check my writings (GUI and user guide)

Additional modification:
While working on this part of the code, I have made the critical error sound played asynchronously upon @LeonarddeR's suggestion. It should allow to spare 2-3 seconds (the time of the error sound) in the code execution time.
NV Access, if you prefer not to include this modification for whatever reason, I or you may revert this commit.

Testing strategy:

Manual testing:
Triggered an error in the 4 following situations and checked that the error sound is played for the 3 first ones and not the last one:

  • NVDA test version (from source) and option set to 'Yes'
  • NVDA test version (from source) and option set to 'Only in NVDA test versions'
  • NVDA stable version (simulated from source) and option set to 'Yes'
  • NVDA stable version (simulated from source) and option set to 'Only in NVDA test versions'

The stable version is simulated running NVDA from source with this branch and entering the 2 following lines in the Python console:

import buildVersion
buildVersion.isTestVersion = False

The error is triggered by trying to enable the screen curtain while Windows Magnifier is enabled with color inversion activated. But many other ways could have been used.

I will also check context help on the snapshot generated by appVeyor.

Known issues with pull request:

If an error occurs before the config is initialized, the default behaviour is applied, i.e. the error sound is played only in test versions whatever the value of this option is in the config.

Change log entries:

New features (or Changes? Or For developers?)
It is now possible to configure the error sound to be played in any version of NVDA, not only in test versions. (#12672)

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual testing.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers

@CyrilleB79 CyrilleB79 changed the title Beep on error Option to configure when the error sound may be played. Jul 27, 2021
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 07328b1303

Comment thread source/logHandler.py Outdated
Comment thread source/logHandler.py Outdated
CyrilleB79 and others added 3 commits July 27, 2021 13:00
Co-authored-by: Łukasz Golonka <lukasz.golonka@mailbox.org>
@CyrilleB79 CyrilleB79 marked this pull request as ready for review July 27, 2021 12:58
@CyrilleB79 CyrilleB79 requested review from a team as code owners July 27, 2021 12:58
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

I have checked context help on the appVeyor artifact. And I have addressed @lukaszgo1's comments (thanks Lukasz for the review).
Thus I have passed this PR to ready state.

@lukaszgo1

Copy link
Copy Markdown
Contributor

Looking at this again would it be possible to move the code which is responsible for determining if the error sound should play into a separate method/function? It would allow add-on developers / power users to monkey patch just a single function rather than the entire emit and would allow to indirectly add 'never' option for developers.

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Looking at this again would it be possible to move the code which is responsible for determining if the error sound should play into a separate method/function? It would allow add-on developers / power users to monkey patch just a single function rather than the entire emit and would allow to indirectly add 'never' option for developers.

Done.

Comment thread source/logHandler.py Outdated
While modifying this part of code, let's make critical error sound playing asynchronous - allows to spare a few seconds in the code execution. Thanks @LeonarddeR for suggestion.

Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

This PR is ready again.

@feerrenrut you may want to review this one since you gave indications in #12672 (comment).

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing that concerns me is the async sound playing. It is probably fine, and I'm happy for this to get some testing on alpha. But if there is an issue, we'll need to revert that aspect.

I won't merge this immediately, to give others a chance to review.

@feerrenrut feerrenrut merged commit 5c0a1d1 into nvaccess:master Aug 26, 2021
@nvaccessAuto nvaccessAuto added this to the 2021.3 milestone Aug 26, 2021
@CyrilleB79 CyrilleB79 deleted the beepOnError branch September 3, 2021 19:49
seanbudd pushed a commit that referenced this pull request Sep 15, 2022
Fix-up of #12689.

Summary of the issue:
When pressing "Restore defaults" button in advanced settings panel, the option "Play a sound for logged errors" is not restored.

Description of user facing changes
Pressing "Restore defaults" in adv settings panel now restores all the options of this panel.

Description of development approach
Added self.playErrorSoundCombo in restoreToDefaults and haveConfigDefaultsBeenRestored functions where it was missing.
Also reordered the statements in these two functions to match the advanced settings panel layout (tab order) so that checking all the items be more easy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants