Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 23 additions & 35 deletions source/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,7 @@ def getStartAfterLogon() -> bool:
has been registered to start after logon on Windows 7
or by earlier NVDA versions.
"""
if (
easeOfAccess.canConfigTerminateOnDesktopSwitch
and easeOfAccess.willAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON)
):
if easeOfAccess.willAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON):
return True
try:
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RegistryKey.RUN.value)
Expand Down Expand Up @@ -348,43 +345,34 @@ def setStartAfterLogon(enable: bool) -> None:
"""Not to be confused with setStartOnLogonScreen.

Toggle if NVDA automatically starts after a logon.
Sets easeOfAccess related registry keys on Windows 8 or newer.

On Windows 7 this sets the registry run key.
Sets easeOfAccess related registry keys.

When toggling off, always delete the registry run key
in case it was set by an earlier version of NVDA or on Windows 7 or earlier.
in case it was set by an earlier version of NVDA.
"""
if getStartAfterLogon() == enable:
return
if easeOfAccess.canConfigTerminateOnDesktopSwitch:
easeOfAccess.setAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON, enable)
if enable:
return
# We're disabling, so ensure the run key is cleared,
# as it might have been set by an old version.
run = False
else:
run = enable
easeOfAccess.setAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON, enable)
if enable:
return
# We're disabling, so ensure the run key is cleared,
# as it might have been set by an old version.
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RegistryKey.RUN.value, 0, winreg.KEY_WRITE)
if run:
winreg.SetValueEx(k, "nvda", None, winreg.REG_SZ, sys.argv[0])
else:
try:
winreg.QueryValue(k, "nvda")
except FileNotFoundError:
log.debug(
"The run registry key is not set for setStartAfterLogon."
"This is expected for Windows 8+ which uses ease of access"
)
return
try:
winreg.DeleteValue(k, "nvda")
except WindowsError:
log.error(
"Couldn't unset registry key for nvda to start after logon.",
exc_info=True
)
try:
winreg.QueryValue(k, "nvda")
except FileNotFoundError:
log.debug(
"The run registry key is not set for setStartAfterLogon."
"This is expected since ease of access is used"
)
return
try:
winreg.DeleteValue(k, "nvda")
except WindowsError:
log.error(
"Couldn't unset registry key for nvda to start after logon.",
exc_info=True
)


SLAVE_FILENAME = os.path.join(globalVars.appDir, "nvda_slave.exe")
Expand Down
2 changes: 0 additions & 2 deletions source/easeOfAccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import winVersion


# Windows >= 8
canConfigTerminateOnDesktopSwitch: bool = winVersion.getWinVer() >= winVersion.WIN8
Comment thread
seanbudd marked this conversation as resolved.
Resolved
_APP_KEY_NAME = "nvda_nvda_v1"


Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ That method receives a ``DriverRegistrar`` object on which the ``addUsbDevices``
- ``IoThread.autoDeleteApcReference`` has been removed. (#14924, @LeonarddeR)
- To support capital pitch changes, synthesizers must now explicitly declare their support for the ``PitchCommand`` in the ``supportedCommands`` attribute on the driver. (#15433, @LeonarddeR)
- ``speechDictHandler.speechDictVars`` has been removed. Use ``NVDAState.WritePaths.speechDictsDir`` instead of ``speechDictHandler.speechDictVars.speechDictsPath``. (#15614, @lukaszgo1)
- ``easeOfAccess.canConfigTerminateOnDesktopSwitch`` has been removed, as it became obsolete since Windows 7 is no longer supported. (#15644, @LeonarddeR)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be moved to the deprecations list

Suggested change
- ``easeOfAccess.canConfigTerminateOnDesktopSwitch`` has been removed, as it became obsolete since Windows 7 is no longer supported. (#15644, @LeonarddeR)
- ``easeOfAccess.canConfigTerminateOnDesktopSwitch`` has been deprecated, as it became obsolete since Windows 7 is no longer supported. (#15644, @LeonarddeR)

-

=== Deprecations ===
Expand Down