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
42 changes: 33 additions & 9 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,8 +32,9 @@
class _ExitAction(DisplayStringEnum):
EXIT = auto()
RESTART = auto()
RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING = auto()
RESTART_WITH_ADDONS_DISABLED = auto()
RESTART_WITH_DEBUG_LOGGING_ENABLED = auto()
RESTART_WITH_DEBUG_LOGGING = auto()
INSTALL_PENDING_UPDATE = auto()

@property
Expand All @@ -43,10 +44,16 @@ def _displayStringLabels(self):
self.EXIT: _("Exit"),
# Translators: An option in the combo box to choose exit action.
self.RESTART: _("Restart"),
self.RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING: _(
# Translators: An option in the combo box to choose exit action.
"Restart with add-ons disabled and debug logging",
),
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_ADDONS_DISABLED: _("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"),
self.RESTART_WITH_DEBUG_LOGGING: _("Restart with debug logging"),
CyrilleB79 marked this conversation as resolved.
Show resolved Hide resolved
# Translators: An option in the combo box to choose exit action.
self.INSTALL_PENDING_UPDATE: _("Install pending update"),
}
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)
# 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)
allowedActions.remove(_ExitAction.RESTART_WITH_DEBUG_LOGGING)
try:
allowedActions.remove(_ExitAction.RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING)
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,8 +147,19 @@ 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)
elif action == _ExitAction.RESTART_WITH_DEBUG_LOGGING_ENABLED:
queueHandler.queueFunction(
queueHandler.eventQueue,
core.restart,
disableAddons=True,
)
elif action == _ExitAction.RESTART_WITH_ADDONS_DISABLED_AND_DEBUG_LOGGING:
queueHandler.queueFunction(
queueHandler.eventQueue,
core.restart,
disableAddons=True,
debugLogging=True,
)
elif action == _ExitAction.RESTART_WITH_DEBUG_LOGGING:
queueHandler.queueFunction(queueHandler.eventQueue, core.restart, debugLogging=True)
elif action == _ExitAction.INSTALL_PENDING_UPDATE:
if updateCheck:
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The available options are:
* eSpeak NG has been updated to 1.52-dev commit `961454ff`. (#16775)
* Added new languages Faroese and Xextan.
* When using a multi-line braille display via the standard HID braille driver, all lines of cells will be used. (#16993, @alexmoon)
* The exit dialog now allow to restart NVDA with add-ons disabled and debug logging simultaneously. (#11538, @CyrilleB79)
CyrilleB79 marked this conversation as resolved.
Show resolved Hide resolved

### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion user_docs/en/userGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ 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, asking whether you want to exit, restart, restart with add-ons disabled and debug logging, restart with debug logging, or install pending updates (if any).
CyrilleB79 marked this conversation as resolved.
Show resolved Hide resolved
When unchecked, NVDA will exit immediately.

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