Skip to content

Commit b643ec5

Browse files
committed
Merge branch 'master' into fixLCIDLookup
# Conflicts: # user_docs/en/changes.t2t
2 parents 0cdd271 + 21a61e5 commit b643ec5

12 files changed

Lines changed: 66 additions & 71 deletions

‎source/NVDAObjects/UIA/VisualStudio.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is covered by the GNU General Public License.
22
# See the file COPYING for more details.
3-
# Copyright (C) 2020 NV Access Limited, Leonard de Ruijter
3+
# Copyright (C) 2020-2022 NV Access Limited, Leonard de Ruijter
44

55
"""
66
Object overlay classes for Visual Studio components
@@ -17,7 +17,7 @@
1717
class IntelliSenseItem(UIA):
1818

1919
def _get_name(self):
20-
return self.UIAElement.cachedAutomationID
20+
return self.UIAAutomationId
2121

2222
def event_UIA_elementSelected(self):
2323
# Cancel speech to have speech announce the selection as soon as possible.

‎source/NVDAObjects/UIA/__init__.py‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# A part of NonVisual Desktop Access (NVDA)
22
# This file is covered by the GNU General Public License.
33
# See the file COPYING for more details.
4-
# Copyright (C) 2009-2021 NV Access Limited, Joseph Lee, Mohammad Suliman,
4+
# Copyright (C) 2009-2022 NV Access Limited, Joseph Lee, Mohammad Suliman,
55
# Babbage B.V., Leonard de Ruijter, Bill Dengler
66

77
"""Support for UI Automation (UIA) controls."""
@@ -1076,7 +1076,7 @@ def findOverlayClasses(self,clsList):
10761076
clsList.append(chromium.ChromiumUIA)
10771077
elif (
10781078
self.role == controlTypes.Role.DOCUMENT
1079-
and self.UIAElement.cachedAutomationId == "Microsoft.Windows.PDF.DocumentView"
1079+
and UIAAutomationId == "Microsoft.Windows.PDF.DocumentView"
10801080
):
10811081
# PDFs
10821082
from . import spartanEdge
@@ -1122,17 +1122,11 @@ def findOverlayClasses(self,clsList):
11221122
if isDialog:
11231123
clsList.append(Dialog)
11241124
# #6241: Try detecting all possible suggestions containers and search fields scattered throughout Windows 10.
1125-
try:
1126-
if UIAAutomationId in ("SearchTextBox", "TextBox"):
1127-
clsList.append(SearchField)
1128-
except COMError:
1129-
log.debug("Failed to locate UIA search field", exc_info=True)
1125+
if UIAAutomationId in ("SearchTextBox", "TextBox"):
1126+
clsList.append(SearchField)
11301127
# #12790: detect suggestions list views firing layout invalidated event.
1131-
try:
1132-
if UIAAutomationId == "SuggestionsList":
1133-
clsList.append(SuggestionsList)
1134-
except COMError:
1135-
log.debug("Could not detect suggestions list", exc_info=True)
1128+
if UIAAutomationId == "SuggestionsList":
1129+
clsList.append(SuggestionsList)
11361130
try:
11371131
# Nested block here in order to catch value error and variable binding error when attempting to access automation ID for invalid elements.
11381132
try:

‎source/NVDAObjects/UIA/winConsoleUIA.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# A part of NonVisual Desktop Access (NVDA)
22
# This file is covered by the GNU General Public License.
33
# See the file COPYING for more details.
4-
# Copyright (C) 2019-2021 Bill Dengler
4+
# Copyright (C) 2019-2022 Bill Dengler
55

66
import ctypes
77
import NVDAHelper
@@ -413,9 +413,9 @@ def event_UIA_notification(self, **kwargs):
413413

414414

415415
def findExtraOverlayClasses(obj, clsList):
416-
if obj.UIAElement.cachedAutomationId == "Text Area":
416+
if obj.UIAAutomationId == "Text Area":
417417
clsList.append(WinConsoleUIA)
418-
elif obj.UIAElement.cachedAutomationId == "Console Window":
418+
elif obj.UIAAutomationId == "Console Window":
419419
clsList.append(consoleUIAWindow)
420420

421421

‎source/NVDAObjects/UIA/wordDocument.py‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is covered by the GNU General Public License.
22
# A part of NonVisual Desktop Access (NVDA)
33
# See the file COPYING for more details.
4-
# Copyright (C) 2016-2021 NV Access Limited, Joseph Lee, Jakub Lukowicz
4+
# Copyright (C) 2016-2022 NV Access Limited, Joseph Lee, Jakub Lukowicz
55

66
from typing import (
77
Optional,
@@ -192,15 +192,15 @@ def _get_controlFieldNVDAObjectClass(self):
192192

193193
def _getControlFieldForUIAObject(self, obj, isEmbedded=False, startOfNode=False, endOfNode=False):
194194
# Ignore strange editable text fields surrounding most inner fields (links, table cells etc)
195-
automationID=obj.UIAElement.cachedAutomationID
195+
automationId = obj.UIAAutomationId
196196
field = super(WordDocumentTextInfo, self)._getControlFieldForUIAObject(
197197
obj,
198198
isEmbedded=isEmbedded,
199199
startOfNode=startOfNode,
200200
endOfNode=endOfNode
201201
)
202-
if automationID.startswith('UIA_AutomationId_Word_Page_'):
203-
field['page-number']=automationID.rsplit('_',1)[-1]
202+
if automationId.startswith('UIA_AutomationId_Word_Page_'):
203+
field['page-number'] = automationId.rsplit('_', 1)[-1]
204204
elif obj.UIAElement.cachedControlType==UIAHandler.UIA_GroupControlTypeId and obj.name:
205205
field['role']=controlTypes.Role.EMBEDDEDOBJECT
206206
field['alwaysReportName']=True
@@ -416,7 +416,10 @@ class WordBrowseModeDocument(UIABrowseModeDocument):
416416

417417
def _shouldSetFocusToObj(self, obj: NVDAObject) -> bool:
418418
# Ignore strange editable text fields surrounding most inner fields (links, table cells etc)
419-
if obj.role==controlTypes.Role.EDITABLETEXT and obj.UIAElement.cachedAutomationID.startswith('UIA_AutomationId_Word_Content'):
419+
if (
420+
obj.role == controlTypes.Role.EDITABLETEXT
421+
and obj.UIAAutomationId.startswith('UIA_AutomationId_Word_Content')
422+
):
420423
return False
421424
elif obj.role == controlTypes.Role.MATH:
422425
# Don't set focus to math equations otherwise they cannot be interacted with mathPlayer.
@@ -425,7 +428,10 @@ def _shouldSetFocusToObj(self, obj: NVDAObject) -> bool:
425428

426429
def shouldPassThrough(self,obj,reason=None):
427430
# Ignore strange editable text fields surrounding most inner fields (links, table cells etc)
428-
if obj.role==controlTypes.Role.EDITABLETEXT and obj.UIAElement.cachedAutomationID.startswith('UIA_AutomationId_Word_Content'):
431+
if (
432+
obj.role == controlTypes.Role.EDITABLETEXT
433+
and obj.UIAAutomationId.startswith('UIA_AutomationId_Word_Content')
434+
):
429435
return False
430436
elif obj.role == controlTypes.Role.MATH:
431437
# Don't activate focus mode for math equations otherwise they cannot be interacted with mathPlayer.

‎source/appModules/explorer.py‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: UTF-8 -*-
22
# A part of NonVisual Desktop Access (NVDA)
3-
# Copyright (C) 2006-2021 NV Access Limited, Joseph Lee, Łukasz Golonka, Julien Cochuyt
3+
# Copyright (C) 2006-2022 NV Access Limited, Joseph Lee, Łukasz Golonka, Julien Cochuyt
44
# This file is covered by the GNU General Public License.
55
# See the file COPYING for more details.
66

@@ -185,13 +185,9 @@ class GridGroup(UIA):
185185
# Normally the name is the first tile which is rather redundant
186186
# However some groups have custom header text which should be read instead
187187
def _get_name(self):
188-
child=self.firstChild
189-
if isinstance(child,UIA):
190-
try:
191-
automationID=child.UIAElement.currentAutomationID
192-
except COMError:
193-
automationID=None
194-
if automationID=="GridListGroupHeader":
188+
child = self.firstChild
189+
if isinstance(child, UIA):
190+
if child.UIAAutomationId == "GridListGroupHeader":
195191
return child.name
196192

197193

@@ -339,7 +335,7 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
339335
clsList.insert(0, GridGroup)
340336
elif uiaClassName == "ImmersiveLauncher" and role == controlTypes.Role.PANE:
341337
clsList.insert(0, ImmersiveLauncher)
342-
elif uiaClassName == "ListViewItem" and obj.UIAElement.cachedAutomationId.startswith('Suggestion_'):
338+
elif uiaClassName == "ListViewItem" and obj.UIAAutomationId.startswith('Suggestion_'):
343339
clsList.insert(0, SuggestionListItem)
344340
# Multitasking view frame window
345341
elif (
@@ -354,7 +350,7 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
354350
# RS4 and below we can match on a window class
355351
windowClass == "MultitaskingViewFrame" or
356352
# RS5 and above we must look for a particular UIA automationID on the list
357-
isinstance(obj.parent,UIA) and obj.parent.UIAElement.cachedAutomationID=="SwitchItemListControl"
353+
isinstance(obj.parent, UIA) and obj.parent.UIAAutomationId == "SwitchItemListControl"
358354
):
359355
clsList.insert(0, MultitaskingViewFrameListItem)
360356
elif uiaClassName == "UIProperty" and role == controlTypes.Role.EDITABLETEXT:

‎source/appModules/openwith.py‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# A part of NonVisual Desktop Access (NVDA)
2-
# Copyright (C) 2011-2020 NV Access Limited, Joseph Lee
2+
# Copyright (C) 2011-2022 NV Access Limited, Joseph Lee
33
# This file is covered by the GNU General Public License.
44
# See the file COPYING for more details.
55

6-
from comtypes import COMError
76
import appModuleHandler
87
import controlTypes
98
from NVDAObjects.UIA import UIA
@@ -33,16 +32,13 @@ def event_focusEntered(self):
3332

3433
class AppModule(appModuleHandler.AppModule):
3534

36-
def chooseNVDAObjectOverlayClasses(self,obj,clsList):
37-
if isinstance(obj,UIA):
38-
try:
39-
automationID=obj.UIAElement.currentAutomationID
40-
except COMError:
41-
automationID=None
42-
if automationID=="NonDefaultAppTile":
43-
clsList.insert(0,NonDefaultAppTile)
44-
elif automationID=="ImmersiveOpenWithFlyout":
45-
clsList.insert(0,ImmersiveOpenWithFlyout)
35+
def chooseNVDAObjectOverlayClasses(self, obj, clsList):
36+
if isinstance(obj, UIA):
37+
automationId = obj.UIAAutomationId
38+
if automationId == "NonDefaultAppTile":
39+
clsList.insert(0, NonDefaultAppTile)
40+
elif automationId == "ImmersiveOpenWithFlyout":
41+
clsList.insert(0, ImmersiveOpenWithFlyout)
4642

4743
def isGoodUIAWindow(self, hwnd):
4844
# #11335: Open With dialog isn't read in Windows 10 Version 2004 (May 2020 Update).

‎source/appModules/shellexperiencehost.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#A part of NonVisual Desktop Access (NVDA)
2-
#Copyright (C) 2015-2019 NV Access Limited, Joseph Lee
3-
#This file is covered by the GNU General Public License.
4-
#See the file COPYING for more details.
1+
# A part of NonVisual Desktop Access (NVDA)
2+
# Copyright (C) 2015-2022 NV Access Limited, Joseph Lee
3+
# This file is covered by the GNU General Public License.
4+
# See the file COPYING for more details.
55

66
"""App module for Shell Experience Host, part of Windows 10.
77
Shell Experience Host is home to a number of things, including Action Center and other shell features.
@@ -51,11 +51,11 @@ def event_NVDAObject_init(self, obj):
5151
if isinstance(obj, UIA):
5252
# #8845: Brightness button in Action Center is a button, not a toggle button.
5353
# Brightness control is now a slider in build 18277.
54-
if obj.UIAElement.cachedAutomationID == "Microsoft.QuickAction.Brightness":
54+
if obj.UIAAutomationId == "Microsoft.QuickAction.Brightness":
5555
obj.role = controlTypes.Role.BUTTON
5656
obj.states.discard(controlTypes.State.CHECKABLE)
5757

58-
def chooseNVDAObjectOverlayClasses(self,obj,clsList):
58+
def chooseNVDAObjectOverlayClasses(self, obj, clsList):
5959
if isinstance(obj, IAccessible):
6060
try:
6161
# #5288: Never use ContentGenericClient, as this uses displayModel

‎source/appModules/systemsettings.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# A part of NonVisual Desktop Access (NVDA)
2-
# Copyright (C) 2019-2021 NV Access Limited, Joseph Lee
2+
# Copyright (C) 2019-2022 NV Access Limited, Joseph Lee
33
# This file is covered by the GNU General Public License.
44
# See the file COPYING for more details.
55

@@ -19,10 +19,10 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
1919
# the progress bar's sibling might not be a UIA object at all.
2020
try:
2121
if (
22-
obj.next.UIAElement.cachedAutomationID.startswith(
22+
obj.next.UIAAutomationId.startswith(
2323
"SystemSettings_Audio_Output_VolumeValue_"
2424
)
25-
or obj.simplePrevious.UIAElement.cachedAutomationID.startswith(
25+
or obj.simplePrevious.UIAAutomationId.startswith(
2626
"SystemSettings_Audio_Input_VolumeValue_"
2727
)
2828
):

‎source/appModules/taskmgr.py‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#appModules/taskmgr.py
2-
#A part of NonVisual Desktop Access (NVDA)
3-
#Copyright (C) 2018 NV Access Limited, Derek Riemer
4-
#This file is covered by the GNU General Public License.
5-
#See the file COPYING for more details.
1+
# A part of NonVisual Desktop Access (NVDA)
2+
# Copyright (C) 2018-2022 NV Access Limited, Derek Riemer
3+
# This file is covered by the GNU General Public License.
4+
# See the file COPYING for more details.
65

76
import appModuleHandler
87
from NVDAObjects import NVDAObject
@@ -14,19 +13,19 @@ def isChildOfRow(obj):
1413
If obj is a child of a row, this returns true.
1514
"""
1615
while obj.parent and obj.parent.presentationType != obj.presType_content:
17-
if isinstance(obj.parent, UIA) and obj.parent.UIAElement.CachedAutomationID == u"TmViewRow":
16+
if isinstance(obj.parent, UIA) and obj.parent.UIAAutomationId == "TmViewRow":
1817
return True
1918
obj = obj.parent
2019
return False
2120

2221
class BrokenUIAChild(UIA):
23-
#This is A child which is layout, but should be content.
22+
# This is A child which is layout, but should be content.
2423
presentationType = NVDAObject.presType_content
2524

2625
class AppModule(appModuleHandler.AppModule):
2726
def chooseNVDAObjectOverlayClasses(self, obj, clsList):
28-
if isinstance(obj, UIA) and obj.UIAElement.CachedAutomationID == u"TmRowIcon":
29-
#This is an icon and really is layout. Don't show it.
27+
if isinstance(obj, UIA) and obj.UIAAutomationId == "TmRowIcon":
28+
# This is an icon and really is layout. Don't show it.
3029
return
3130
if obj.presentationType == obj.presType_layout and isChildOfRow(obj):
3231
clsList.insert(0, BrokenUIAChild)

‎source/appModules/windowsinternal_composableshell_experiences_textinput_inputapp.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# A part of NonVisual Desktop Access (NVDA)
2-
# Copyright (C) 2017-2021 NV Access Limited, Joseph Lee
2+
# Copyright (C) 2017-2022 NV Access Limited, Joseph Lee
33
# This file is covered by the GNU General Public License.
44
# See the file COPYING for more details.
55

@@ -123,7 +123,7 @@ def event_UIA_elementSelected(self, obj, nextHandler):
123123
# For consistent experience, report the new category first by traversing through controls.
124124
# #8189: do not announce candidates list itself (not items),
125125
# as this is repeated each time candidate items are selected.
126-
if obj.UIAElement.cachedAutomationID == "CandidateList":
126+
if obj.UIAAutomationId == "CandidateList":
127127
return
128128
speech.cancelSpeech()
129129
# Sometimes, due to bad tree traversal or wrong item getting selected,
@@ -139,7 +139,7 @@ def event_UIA_elementSelected(self, obj, nextHandler):
139139
if (
140140
obj and obj.UIAElement.cachedClassName == "ListViewItem"
141141
and obj.parent and isinstance(obj.parent, UIA)
142-
and obj.parent.UIAElement.cachedAutomationID != "TEMPLATE_PART_ClipboardItemsList"
142+
and obj.parent.UIAAutomationId != "TEMPLATE_PART_ClipboardItemsList"
143143
):
144144
# The difference between emoji panel and suggestions list is absence of categories/emoji separation.
145145
# Turns out automation ID for the container is different,
@@ -256,7 +256,7 @@ def event_nameChange(self, obj, nextHandler):
256256
(obj.UIAElement.cachedClassName in ("CRootKey", "GridViewItem"))
257257
# Just ignore useless clipboard status.
258258
# Also top emoji search result must be announced for better user experience.
259-
or (obj.UIAElement.cachedAutomationID in (
259+
or (obj.UIAAutomationId in (
260260
"TEMPLATE_PART_ClipboardItemsList",
261261
"TEMPLATE_PART_Search_TextBlock"
262262
))
@@ -271,21 +271,21 @@ def event_nameChange(self, obj, nextHandler):
271271
# In some cases, parent will be None, as seen when emoji panel is closed in build 18267.
272272
try:
273273
if (
274-
obj.UIAElement.cachedAutomationID == "TEMPLATE_PART_ClipboardItemIndex"
275-
or obj.parent.UIAElement.cachedAutomationID == "TEMPLATE_PART_ClipboardItemsList"
274+
obj.UIAAutomationId == "TEMPLATE_PART_ClipboardItemIndex"
275+
or obj.parent.UIAAutomationId == "TEMPLATE_PART_ClipboardItemsList"
276276
):
277277
return
278278
except AttributeError:
279279
return
280280
if (
281281
not self._emojiPanelJustOpened
282-
or obj.UIAElement.cachedAutomationID != "TEMPLATE_PART_ExpressionGroupedFullView"
282+
or obj.UIAAutomationId != "TEMPLATE_PART_ExpressionGroupedFullView"
283283
):
284284
speech.cancelSpeech()
285285
self._emojiPanelJustOpened = False
286286
# Don't forget to add "Microsoft Candidate UI" as something that should be suppressed.
287287
if (
288-
obj.UIAElement.cachedAutomationID not in (
288+
obj.UIAAutomationId not in (
289289
"TEMPLATE_PART_ExpressionFullViewItemsGrid",
290290
"TEMPLATE_PART_ClipboardItemIndex",
291291
"CandidateWindowControl"

0 commit comments

Comments
 (0)