-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
UI Automation in Windows Console: only enable UIA when available #9650
UI Automation in Windows Console: only enable UIA when available #9650
Conversation
Why do you consider this necessary? This breaks all add-ons that somehow use NVDAObjects.window.winConsole.
This change makes much sense. |
source/core.py
Outdated
import winConsoleHandler | ||
log.debug("Initializing winConsole support") | ||
winConsoleHandler.initialize() | ||
import winConsoleHandlerLegacy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you rename this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid confusion (in anticipation of UIA becoming the default).
Legacy winConsoles must be handled by IAccessible now so that order of
choice can go UIA, then IAccessible. I think it is logical that
WinConsoleLegacy be stored in NVDAObjects.IAccessible, but I do
understand that this could break add-ons.
Would it be good enough to add back an NVDAObjects.window.winconsole
module that imports NVDAObjects.IAccessible.winConsoleLegacy as
WinConsole, and also logs a deprecation warning?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again like with NVDAObjects.window.winConsole, can you please provide modules for winConsoleHandler and winCon with warnings when imported?
At the top of each you can just import everything from their respective new module. E.g for wincon:
from winCon import *
@@ -528,6 +528,9 @@ def findOverlayClasses(self,clsList): | |||
elif windowClassName.startswith("Chrome_"): | |||
from . import chromium | |||
chromium.findExtraOverlayClasses(self, clsList) | |||
elif windowClassName == "ConsoleWindowClass": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than placing the code directly here, you can just place an entry in the _staticMap directory in this file. But as well as the window class, also check for an MSAA role of ROLE_SYSTEM_CLIENT. This will ensure that the subclass is only used for the actual client of the window, and not the system menu or scrollbars etc.
Something like:
("ConsoleWindowClass",oleacc.ROLE_SYSTEM_CLIENT):"winConsoleLegacy.WinConsoleLegacy",
import api | ||
import core | ||
|
||
class winConsoleLegacy(Terminal, EditableTextWithoutAutoSelectDetection, IAccessible): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is a class, please use a capital W, I.e. WinConsoleLegacy.
# Copyright (C) 2019 Bill Dengler | ||
|
||
import warnings | ||
from ..IAccessible.winConsoleLegacy import winConsoleLegacy as WinConsole |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When capitalizing WinConsoleLegacy, don't forget to change it here.
from ..IAccessible.winConsoleLegacy import winConsoleLegacy as WinConsole | ||
|
||
warnings.warn("NVDAObjects.window.winConsole is deprecated. Use NVDAObjects.IAccessible.winConsoleLegacy or NVDAObjects.UIA.winConsoleUIA instead", | ||
DeprecationWarning, stacklevel=3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a blank line at the end of this file.
79c2458
to
c47f165
Compare
@michaelDCurran Interestingly, this one merged without conflicts! |
like @LeonarddeR I am a little concirned having so many modules renamed, even though of course we do have backwards compatibility wrapper modules with deprecation warnings. |
I strongly second Micks proposal. Lets aim for master and revert the renames. Even on Threshold, these names are not required. I think it is enough to state in the module doc strings that this with a legacy implementation. Having said that, what's the definition of legacy? Even on Windows Server 2016, the legacy code will still be the used one, so I think this code will stick around for many years to come.
|
@LeonarddeR @michaelDCurran Is this better? |
Link to issue number:
Split from #9646 (builds on #9614).
Summary of the issue:
Currently, in consoles with UI Automation enabled:
Description of how this pull request fixes the issue:
The legacy console code has been moved to
NVDAObjects.IAccessible.winConsoleLegacy
, and the check for consoles has been moved fromNVDAObjects.window.findOverlayClasses
toNVDAObjects.IAccessible.findOverlayClasses
. Since NVDA prefers UIA over MSAA, UIA is used when enabled and available and legacy is used otherwise.Testing performed:
Tested all combinations of the "use legacy console" and UIA checkboxes on Windows 10 versions 1803 and 1903.
Known issues with pull request:
See #9646 for all UIA console known issues to date.
Change log entry:
None.