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

Remove remaining support for Windows 7 start after logon #15644

Merged
merged 5 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions source/easeOfAccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
import NVDAState
import winreg
import winUser
import winVersion


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


Expand All @@ -32,6 +29,9 @@ def __getattr__(attrName: str) -> Any:
if attrName == "APP_KEY_NAME" and NVDAState._allowDeprecatedAPI():
log.warning("APP_KEY_NAME is deprecated.")
return _APP_KEY_NAME
if attrName == "canConfigTerminateOnDesktopSwitch" and NVDAState._allowDeprecatedAPI():
log.warning("canConfigTerminateOnDesktopSwitch is deprecated.")
return True
raise AttributeError(f"module {repr(__name__)} has no attribute {repr(attrName)}")


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 @@ -76,6 +76,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
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)

- ``languageHandler.makeNpgettext`` and ``languageHandler.makePgettext`` have been removed.
``npgettext`` and ``pgettext`` are supported natively now. (#15546)
% Insert new list items here as the alias appModule table should be kept at the bottom of this list
Expand Down