Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable debug logging when restarting NVDA with add-ons #17043

Merged
merged 9 commits into from
Aug 29, 2024
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