Skip to content
Next Next commit
UIAHandler: move base cacheRequest propertyIDs into their own set at …
…global level.
  • Loading branch information
michaelDCurran committed Oct 16, 2022
commit 0b19104e79789ec723b3b10b7e9fbcc18a6b55de
11 changes: 10 additions & 1 deletion source/UIAHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
from . import remote as UIARemote


baseCachePropertyIDs = set([
Comment thread
michaelDCurran marked this conversation as resolved.
Outdated
UIA.UIA_FrameworkIdPropertyId, UIA.UIA_AutomationIdPropertyId, UIA.UIA_ClassNamePropertyId,
Comment thread
seanbudd marked this conversation as resolved.
Outdated
UIA.UIA_ControlTypePropertyId, UIA.UIA_ProviderDescriptionPropertyId, UIA.UIA_ProcessIdPropertyId,
UIA.UIA_IsTextPatternAvailablePropertyId,
UIA.UIA_IsContentElementPropertyId, UIA.UIA_IsControlElementPropertyId,
UIA.UIA_NamePropertyId, UIA.UIA_LocalizedControlTypePropertyId,
])

#: The window class name for Microsoft Word documents.
# Microsoft Word's UI Automation implementation
# also exposes this value as the document UIA element's classname property.
Expand Down Expand Up @@ -366,7 +374,7 @@ def MTAThreadFunc(self):
self.UIAWindowHandleCache={}
self.baseTreeWalker=self.clientObject.RawViewWalker
self.baseCacheRequest=self.windowCacheRequest.Clone()
for propertyId in (UIA_FrameworkIdPropertyId,UIA_AutomationIdPropertyId,UIA_ClassNamePropertyId,UIA_ControlTypePropertyId,UIA_ProviderDescriptionPropertyId,UIA_ProcessIdPropertyId,UIA_IsTextPatternAvailablePropertyId,UIA_IsContentElementPropertyId,UIA_IsControlElementPropertyId):
for propertyId in baseCachePropertyIDs:
self.baseCacheRequest.addProperty(propertyId)
self.baseCacheRequest.addPattern(UIA_TextPatternId)
self.rootElement=self.clientObject.getRootElementBuildCache(self.baseCacheRequest)
Expand Down Expand Up @@ -651,6 +659,7 @@ def IUIAutomationFocusChangedEventHandler_HandleFocusChangedEvent(self,sender):
if _isDebug():
log.debug("HandleFocusChangedEvent: Ignoring for non native element")
return
log.info(f"UIA focus: {sender.currentName} {sender.currentLocalizedControlType}")
import NVDAObjects.UIA
if isinstance(eventHandler.lastQueuedFocusObject,NVDAObjects.UIA.UIA):
lastFocusObj = eventHandler.lastQueuedFocusObject
Expand Down