Skip to content

Commit 1c27896

Browse files
authored
Merge 8e76ed7 into d0614df
2 parents d0614df + 8e76ed7 commit 1c27896

File tree

3 files changed

+27
-38
lines changed

3 files changed

+27
-38
lines changed

source/config/__init__.py

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,7 @@ def getStartAfterLogon() -> bool:
291291
has been registered to start after logon on Windows 7
292292
or by earlier NVDA versions.
293293
"""
294-
if (
295-
easeOfAccess.canConfigTerminateOnDesktopSwitch
296-
and easeOfAccess.willAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON)
297-
):
294+
if easeOfAccess.willAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON):
298295
return True
299296
try:
300297
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RegistryKey.RUN.value)
@@ -348,43 +345,34 @@ def setStartAfterLogon(enable: bool) -> None:
348345
"""Not to be confused with setStartOnLogonScreen.
349346
350347
Toggle if NVDA automatically starts after a logon.
351-
Sets easeOfAccess related registry keys on Windows 8 or newer.
352-
353-
On Windows 7 this sets the registry run key.
348+
Sets easeOfAccess related registry keys.
354349
355350
When toggling off, always delete the registry run key
356-
in case it was set by an earlier version of NVDA or on Windows 7 or earlier.
351+
in case it was set by an earlier version of NVDA.
357352
"""
358353
if getStartAfterLogon() == enable:
359354
return
360-
if easeOfAccess.canConfigTerminateOnDesktopSwitch:
361-
easeOfAccess.setAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON, enable)
362-
if enable:
363-
return
364-
# We're disabling, so ensure the run key is cleared,
365-
# as it might have been set by an old version.
366-
run = False
367-
else:
368-
run = enable
355+
easeOfAccess.setAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON, enable)
356+
if enable:
357+
return
358+
# We're disabling, so ensure the run key is cleared,
359+
# as it might have been set by an old version.
369360
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RegistryKey.RUN.value, 0, winreg.KEY_WRITE)
370-
if run:
371-
winreg.SetValueEx(k, "nvda", None, winreg.REG_SZ, sys.argv[0])
372-
else:
373-
try:
374-
winreg.QueryValue(k, "nvda")
375-
except FileNotFoundError:
376-
log.debug(
377-
"The run registry key is not set for setStartAfterLogon."
378-
"This is expected for Windows 8+ which uses ease of access"
379-
)
380-
return
381-
try:
382-
winreg.DeleteValue(k, "nvda")
383-
except WindowsError:
384-
log.error(
385-
"Couldn't unset registry key for nvda to start after logon.",
386-
exc_info=True
387-
)
361+
try:
362+
winreg.QueryValue(k, "nvda")
363+
except FileNotFoundError:
364+
log.debug(
365+
"The run registry key is not set for setStartAfterLogon."
366+
"This is expected since ease of access is used"
367+
)
368+
return
369+
try:
370+
winreg.DeleteValue(k, "nvda")
371+
except WindowsError:
372+
log.error(
373+
"Couldn't unset registry key for nvda to start after logon.",
374+
exc_info=True
375+
)
388376

389377

390378
SLAVE_FILENAME = os.path.join(globalVars.appDir, "nvda_slave.exe")

source/easeOfAccess.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313
import NVDAState
1414
import winreg
1515
import winUser
16-
import winVersion
1716

1817

19-
# Windows >= 8
20-
canConfigTerminateOnDesktopSwitch: bool = winVersion.getWinVer() >= winVersion.WIN8
2118
_APP_KEY_NAME = "nvda_nvda_v1"
2219

2320

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

3737

user_docs/en/changes.t2t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ That method receives a ``DriverRegistrar`` object on which the ``addUsbDevices``
7676
- ``IoThread.autoDeleteApcReference`` has been removed. (#14924, @LeonarddeR)
7777
- To support capital pitch changes, synthesizers must now explicitly declare their support for the ``PitchCommand`` in the ``supportedCommands`` attribute on the driver. (#15433, @LeonarddeR)
7878
- ``speechDictHandler.speechDictVars`` has been removed. Use ``NVDAState.WritePaths.speechDictsDir`` instead of ``speechDictHandler.speechDictVars.speechDictsPath``. (#15614, @lukaszgo1)
79+
- ``easeOfAccess.canConfigTerminateOnDesktopSwitch`` has been removed, as it became obsolete since Windows 7 is no longer supported. (#15644, @LeonarddeR)
7980
- ``languageHandler.makeNpgettext`` and ``languageHandler.makePgettext`` have been removed.
8081
``npgettext`` and ``pgettext`` are supported natively now. (#15546)
8182
% Insert new list items here as the alias appModule table should be kept at the bottom of this list

0 commit comments

Comments
 (0)