Skip to content

Commit

Permalink
Enable debug logging when restarting NVDA with add-ons (#17043)
Browse files Browse the repository at this point in the history
Fixes the initial request of #11538.

Summary of the issue:
When a user encounters an issue with NVDA, a dev diagnosing the issue may need to ask them a log. In this situation, the most common use case is to ask a log with add-ons disabled (to eliminate possible add-on interferences) and log level set to debug (to get the maximum information to help debugging). Though, NVDA does not provide a handy way to restart with add-ons disabled and log level set to debug.

Description of user facing changes
NVDA's exit dialog now provides the 4 following permanent options:

"Exit" (as before)
"Restart" (as before)
"Restart with add-ons disabled and debug logging", replacing "Restart with add-ons disabled". This option may be used to discriminate if a bug comes from NVDA or from add-ons, and in case it comes from NVDA, help a developer to investigate and fix it.
"Restart with debug logging", just renamed from "Restart with debug logging enabled". This option is useful to get a log to investigate a bug in an add-on.
The non-permanent option to install pending updates remains unchanged.

And the options in secure mode remain unchanged. More specifically, "Restart with add-ons disabled" remains without enabling debug logging because logging is disabled in secure mode.

Description of development approach
Added the RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING item in gui.exit._ExitAction enum. And removed the unneeded items of this enum to display the combo-box. More specifically, RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING and RESTART_WITH_ADDONS_DISABLED cannot coexist in the allowed values of the combo-box.

Also renamed RESTART_WITH_DEBUG_LOGGING_ENABLED to RESTART_WITH_DEBUG_LOGGING so that RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING does not become a longer RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING_ENABLED; same (and more importantly) for the displayed string. Moreover, technically there is no debug logging that we can enable or disable in NVDA, but a debug level that may be set to "disabled", to "debug" or other intermediate levels.

At last, "Restart with debug logging" is not named "Restart with add-ons enabled and debug logging", because the add-ons can still be disabled all individually in the add-on store.
  • Loading branch information
CyrilleB79 authored Aug 29, 2024
1 parent dc5f7b9 commit 7d247ee
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
34 changes: 29 additions & 5 deletions source/gui/exit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2023 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
# Copyright (C) 2006-2024 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
# Thomas Stivers, Babbage B.V., Accessolutions, Julien Cochuyt, Cyrille Bougot
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -32,6 +32,7 @@
class _ExitAction(DisplayStringEnum):
EXIT = auto()
RESTART = auto()
RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING_ENABLED = auto()
RESTART_WITH_ADDONS_DISABLED = auto()
RESTART_WITH_DEBUG_LOGGING_ENABLED = auto()
INSTALL_PENDING_UPDATE = auto()
Expand All @@ -43,8 +44,14 @@ def _displayStringLabels(self):
self.EXIT: _("Exit"),
# Translators: An option in the combo box to choose exit action.
self.RESTART: _("Restart"),
# Translators: An option in the combo box to choose exit action.
self.RESTART_WITH_ADDONS_DISABLED: _("Restart with add-ons disabled"),
self.RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING_ENABLED: _(
# Translators: An option in the combo box to choose exit action.
"Restart with add-ons disabled and debug logging enabled",
),
self.RESTART_WITH_ADDONS_DISABLED: _(
# Translators: An option in the combo box to choose exit action.
"Restart with add-ons disabled",
),
# Translators: An option in the combo box to choose exit action.
self.RESTART_WITH_DEBUG_LOGGING_ENABLED: _("Restart with debug logging enabled"),
# Translators: An option in the combo box to choose exit action.
Expand Down Expand Up @@ -98,11 +105,17 @@ def __init__(self, parent):
allowedActions = list(_ExitAction)
# Windows Store version of NVDA does not support add-ons yet.
if config.isAppX:
allowedActions.remove(_ExitAction.RESTART_WITH_ADDONS_DISABLED)
allowedActions.remove(_ExitAction.RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING_ENABLED)
# Changing debug level on secure screen is not allowed.
# Logging on secure screens could allow keylogging of passwords and retrieval from the SYSTEM user.
if globalVars.appArgs.secure:
allowedActions.remove(_ExitAction.RESTART_WITH_DEBUG_LOGGING_ENABLED)
try:
allowedActions.remove(_ExitAction.RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING_ENABLED)
except ValueError: # If already removed before
pass
else:
allowedActions.remove(_ExitAction.RESTART_WITH_ADDONS_DISABLED)
# Installing updates should not happen in secure mode.
if globalVars.appArgs.secure or not (updateCheck and updateCheck.isPendingUpdate()):
allowedActions.remove(_ExitAction.INSTALL_PENDING_UPDATE)
Expand Down Expand Up @@ -134,7 +147,18 @@ def onOk(self, evt):
elif action == _ExitAction.RESTART:
queueHandler.queueFunction(queueHandler.eventQueue, core.restart)
elif action == _ExitAction.RESTART_WITH_ADDONS_DISABLED:
queueHandler.queueFunction(queueHandler.eventQueue, core.restart, disableAddons=True)
queueHandler.queueFunction(
queueHandler.eventQueue,
core.restart,
disableAddons=True,
)
elif action == _ExitAction.RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING_ENABLED:
queueHandler.queueFunction(
queueHandler.eventQueue,
core.restart,
disableAddons=True,
debugLogging=True,
)
elif action == _ExitAction.RESTART_WITH_DEBUG_LOGGING_ENABLED:
queueHandler.queueFunction(queueHandler.eventQueue, core.restart, debugLogging=True)
elif action == _ExitAction.INSTALL_PENDING_UPDATE:
Expand Down
4 changes: 4 additions & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

* In Mozilla Firefox, NVDA will report the highlighted text when a URL containing a text fragment is visited. (#16910, @jcsteh)

### Changes

* The exit dialog now allows you to restart NVDA with add-ons disabled and debug logging enabled simultaneously. (#11538, @CyrilleB79)

### Bug Fixes

* Native support for the Dot Pad tactile graphics device from Dot Inc as a multiline braille display. (#17007)
Expand Down
8 changes: 7 additions & 1 deletion user_docs/en/userGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,13 @@ This option is a checkbox that, when checked, tells NVDA to automatically save t
##### Show exit options when exiting NVDA {#GeneralSettingsShowExitOptions}

This option is a checkbox that allows you to choose whether or not a dialog appears when you exit NVDA that asks what action you want to perform.
When checked, a dialog will appear when you attempt to exit NVDA asking whether you want to exit, restart, restart with add-ons disabled or install pending updates (if any).
When checked, a dialog will appear when you attempt to exit NVDA, offering the following possibilities:
* exit
* restart
* restart with add-ons disabled and debug logging enabled
* restart with debug logging enabled
* install pending updates (if any).

When unchecked, NVDA will exit immediately.

##### Play sounds when starting or exiting NVDA {#GeneralSettingsPlaySounds}
Expand Down

0 comments on commit 7d247ee

Please sign in to comment.