-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Changes from 1 commit
6a3f7e3
0cf311e
c47f165
6e00241
617f176
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
#NVDAObjects/WinConsole.py | ||
#NVDAObjects/IAccessible/winConsoleLegacy.py | ||
#A part of NonVisual Desktop Access (NVDA) | ||
#This file is covered by the GNU General Public License. | ||
#See the file COPYING for more details. | ||
#Copyright (C) 2007-2012 NV Access Limited | ||
#Copyright (C) 2007-2019 NV Access Limited, Bill Dengler | ||
|
||
import winConsoleHandler | ||
from . import Window | ||
import winConsoleHandlerLegacy as winConsoleHandler | ||
from . import IAccessible | ||
from ..behaviors import Terminal, EditableTextWithoutAutoSelectDetection | ||
import api | ||
import core | ||
|
||
class WinConsole(Terminal, EditableTextWithoutAutoSelectDetection, Window): | ||
class winConsoleLegacy(Terminal, EditableTextWithoutAutoSelectDetection, IAccessible): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
STABILIZE_DELAY = 0.03 | ||
|
||
def _get_TextInfo(self): | ||
consoleObject=winConsoleHandler.consoleObject | ||
if consoleObject and self.windowHandle == consoleObject.windowHandle: | ||
return winConsoleHandler.WinConsoleTextInfo | ||
return super(WinConsole,self).TextInfo | ||
return winConsoleHandler.legacyConsoleTextInfo | ||
return super(winConsoleLegacy,self).TextInfo | ||
|
||
def event_becomeNavigatorObject(self, isFocus=False): | ||
if winConsoleHandler.consoleObject is not self: | ||
|
@@ -28,17 +28,17 @@ def event_becomeNavigatorObject(self, isFocus=False): | |
# The user is returning to the focus object with object navigation. | ||
# The focused console should always be monitored if possible. | ||
self.startMonitoring() | ||
super(WinConsole,self).event_becomeNavigatorObject(isFocus=isFocus) | ||
super(winConsoleLegacy,self).event_becomeNavigatorObject(isFocus=isFocus) | ||
|
||
def event_gainFocus(self): | ||
if winConsoleHandler.consoleObject is not self: | ||
if winConsoleHandler.consoleObject: | ||
winConsoleHandler.disconnectConsole() | ||
winConsoleHandler.connectConsole(self) | ||
super(WinConsole, self).event_gainFocus() | ||
super(winConsoleLegacy, self).event_gainFocus() | ||
|
||
def event_loseFocus(self): | ||
super(WinConsole, self).event_loseFocus() | ||
super(winConsoleLegacy, self).event_loseFocus() | ||
if winConsoleHandler.consoleObject is self: | ||
winConsoleHandler.disconnectConsole() | ||
|
||
|
@@ -49,7 +49,7 @@ def _getTextLines(self): | |
return winConsoleHandler.getConsoleVisibleLines() | ||
|
||
def script_caret_backspaceCharacter(self, gesture): | ||
super(WinConsole, self).script_caret_backspaceCharacter(gesture) | ||
super(winConsoleLegacy, self).script_caret_backspaceCharacter(gesture) | ||
# #2586: We use console update events for typed characters, | ||
# so the typedCharacter event is never fired for the backspace key. | ||
# Call it here so that speak typed words works as expected. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -416,9 +416,9 @@ def handlePowerStatusChange(self): | |
log.warning("Java Access Bridge not available") | ||
except: | ||
log.error("Error initializing Java Access Bridge support", exc_info=True) | ||
import winConsoleHandler | ||
log.debug("Initializing winConsole support") | ||
winConsoleHandler.initialize() | ||
import winConsoleHandlerLegacy | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. To avoid confusion (in anticipation of UIA becoming the default). |
||
log.debug("Initializing legacy winConsole support") | ||
winConsoleHandlerLegacy.initialize() | ||
import UIAHandler | ||
log.debug("Initializing UIA support") | ||
try: | ||
|
@@ -542,7 +542,7 @@ def run(self): | |
_terminate(treeInterceptorHandler) | ||
_terminate(IAccessibleHandler, name="IAccessible support") | ||
_terminate(UIAHandler, name="UIA support") | ||
_terminate(winConsoleHandler, name="winConsole support") | ||
_terminate(winConsoleHandlerLegacy, name="Legacy winConsole support") | ||
_terminate(JABHandler, name="Java Access Bridge support") | ||
_terminate(appModuleHandler, name="app module handler") | ||
_terminate(NVDAHelper) | ||
|
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: