Module IAccessibleHandler
[hide private]

Module IAccessibleHandler

source code

Classes [hide private]
  OrderedWinEventLimiter
Collects and limits winEvents based on whether they are focus changes, or just generic (all other ones).
  SecureDesktopNVDAObject
Functions [hide private]
 
normalizeIAccessible(pacc, childID=0) source code
 
accessibleObjectFromEvent(window, objectID, childID) source code
 
accessibleObjectFromPoint(x, y) source code
 
windowFromAccessibleObject(ia) source code
 
accessibleChildren(ia, startIndex, numChildren) source code
 
accFocus(ia) source code
 
accHitTest(ia, x, y) source code
 
accChild(ia, child) source code
 
accParent(ia, child) source code
 
accNavigate(pacc, childID, direction) source code
tuple of string and NVDAObjects.IAccessible.IAccessible
winEventToNVDAEvent(eventID, window, objectID, childID, useCache=True)
Tries to convert a win event ID to an NVDA event name, and instanciate or fetch an NVDAObject for the win event parameters.
source code
 
winEventCallback(handle, eventID, window, objectID, childID, threadID, timestamp) source code
boolean
processGenericWinEvent(eventID, window, objectID, childID)
Converts the win event to an NVDA event, Checks to see if this NVDAObject equals the current focus.
source code
boolean
processFocusWinEvent(window, objectID, childID, force=False)
checks to see if the focus win event is not the same as the existing focus, then converts the win event to an NVDA event (instanciating an NVDA Object) then calls processFocusNVDAEvent.
source code
boolean
processFocusNVDAEvent(obj, force=False)
Processes a focus NVDA event.
source code
 
processDesktopSwitchWinEvent(window, objectID, childID) source code
 
_correctFocus() source code
boolean
processForegroundWinEvent(window, objectID, childID)
checks to see if the foreground win event is not the same as the existing focus or any of its parents, then converts the win event to an NVDA event (instanciating an NVDA Object) and then checks the NVDAObject against the existing focus object.
source code
 
processShowWinEvent(window, objectID, childID) source code
 
processDestroyWinEvent(window, objectID, childID)
Process a destroy win event.
source code
 
processMenuStartWinEvent(eventID, window, objectID, childID, validFocus)
Process a menuStart win event.
source code
 
processFakeFocusWinEvent(eventID, window, objectID, childID)
Process a fake focus win event.
source code
 
_fakeFocus(oldFocus) source code
 
initialize() source code
 
pumpAll() source code
 
terminate() source code
 
getIAccIdentity(pacc, childID) source code
 
findGroupboxObject(obj) source code
 
getRecursiveTextFromIAccessibleTextObject(obj, startOffset=0, endOffset=-1) source code
{str: str or {str: str}}
splitIA2Attribs(attribsString)
Split an IAccessible2 attributes string into a dict of attribute keys and values.
source code
 
isMarshalledIAccessible(IAccessibleObject)
Looks at the location of the first function in the IAccessible object's vtable (IUnknown::AddRef) to see if it was implemented in oleacc.dll (its local) or ole32.dll (its marshalled).
source code
Variables [hide private]
  MAX_WINEVENTS = 500
  MAX_WINEVENTS_PER_THREAD = 10
  NAVRELATION_LABEL_FOR = 0x1002
  NAVRELATION_LABELLED_BY = 0x1003
  NAVRELATION_NODE_CHILD_OF = 0x1005
  NAVRELATION_EMBEDS = 0x1009
  IA2_RELATION_FLOWS_FROM = "flowsFrom"
  IA2_RELATION_FLOWS_TO = "flowsTo"
  MENU_EVENTIDS = winUser.EVENT_SYSTEM_MENUSTART, winUser.EVENT_...
  winEventLimiter = OrderedWinEventLimiter()
  liveNVDAObjectTable = weakref.WeakValueDictionary()
  MAX_FOREGROUND_DEFERS = 2
  _deferUntilForegroundWindow = None
hash(x)
  _foregroundDefers = 0
  IAccessibleRolesToNVDARoles = {oleacc.ROLE_SYSTEM_WINDOW: cont...
  IAccessibleStatesToNVDAStates = {oleacc.STATE_SYSTEM_TRAVERSED...
  IAccessible2StatesToNVDAStates = {IA2_STATE_REQUIRED: controlT...
  winEventHookIDs = []
  winEventIDsToNVDAEventNames = {winUser.EVENT_SYSTEM_DESKTOPSWI...
  cWinEventCallback = WINFUNCTYPE(None, c_int, c_int, c_int, c_i...
  accPropServices = None
hash(x)
Function Details [hide private]

winEventToNVDAEvent(eventID, window, objectID, childID, useCache=True)

source code 

Tries to convert a win event ID to an NVDA event name, and instanciate or fetch an NVDAObject for the win event parameters.

Parameters:
  • eventID (integer) - the win event ID (type)
  • window (integer) - the win event's window handle
  • objectID (integer) - the win event's object ID
  • childID (the win event's childID) - the win event's childID
  • useCache (boolean) - True to use the liveNVDAObjectTable cache when retrieving an NVDAObject, False if the cache should not be used.
Returns: tuple of string and NVDAObjects.IAccessible.IAccessible
the NVDA event name and the NVDAObject the event is for

processGenericWinEvent(eventID, window, objectID, childID)

source code 

Converts the win event to an NVDA event, Checks to see if this NVDAObject equals the current focus. If all goes well, then the event is queued and we return True

Parameters:
  • eventID (integer) - a win event ID (type)
  • window (integer) - a win event's window handle
  • objectID (integer) - a win event's object ID
  • childID (integer) - a win event's child ID
Returns: boolean
True if the event was processed, False otherwise.

processFocusWinEvent(window, objectID, childID, force=False)

source code 

checks to see if the focus win event is not the same as the existing focus, then converts the win event to an NVDA event (instanciating an NVDA Object) then calls processFocusNVDAEvent. If all is ok it returns True.

Parameters:
  • objectID (integer) - a win event's object ID
  • childID (integer) - a win event's child ID
  • force (boolean) - If True, the shouldAllowIAccessibleFocusEvent property of the object is ignored.
  • window (integer)
Returns: boolean
True if the focus is valid and was handled, False otherwise.

processFocusNVDAEvent(obj, force=False)

source code 

Processes a focus NVDA event. If the focus event is valid, it is queued.

Parameters:
  • obj (NVDAObjects.NVDAObject) - the NVDAObject the focus event is for
  • force (boolean) - If True, the shouldAllowIAccessibleFocusEvent property of the object is ignored.
Returns: boolean
True if the focus event is valid and was queued, False otherwise.

processForegroundWinEvent(window, objectID, childID)

source code 

checks to see if the foreground win event is not the same as the existing focus or any of its parents, then converts the win event to an NVDA event (instanciating an NVDA Object) and then checks the NVDAObject against the existing focus object. If all is ok it queues the foreground event to NVDA and returns True.

Parameters:
  • window (integer) - a win event's window handle
  • objectID (integer) - a win event's object ID
  • childID (integer) - a win event's child ID
Returns: boolean
True if the foreground was processed, False otherwise.

processDestroyWinEvent(window, objectID, childID)

source code 

Process a destroy win event. This removes the object associated with the event parameters from liveNVDAObjectTable if such an object exists.

processMenuStartWinEvent(eventID, window, objectID, childID, validFocus)

source code 

Process a menuStart win event.

Postcondition: Focus will be directed to the menu if appropriate.

processFakeFocusWinEvent(eventID, window, objectID, childID)

source code 

Process a fake focus win event.

Postcondition: The focus will be found and an event generated for it if appropriate.

splitIA2Attribs(attribsString)

source code 

Split an IAccessible2 attributes string into a dict of attribute keys and values. An invalid attributes string does not cause an error, but strange results may be returned. Subattributes are handled. Subattribute keys and values are placed into a dict which becomes the value of the attribute.

Parameters:
  • attribsString (str) - The IAccessible2 attributes string to convert.
Returns: {str: str or {str: str}}
A dict of the attribute keys and values, where values are strings or dicts.

Variables Details [hide private]

MENU_EVENTIDS

Value:
winUser.EVENT_SYSTEM_MENUSTART, winUser.EVENT_SYSTEM_MENUEND, winUser.\
EVENT_SYSTEM_MENUPOPUPSTART, winUser.EVENT_SYSTEM_MENUPOPUPEND

IAccessibleRolesToNVDARoles

Value:
{oleacc.ROLE_SYSTEM_WINDOW: controlTypes.ROLE_WINDOW, oleacc.ROLE_SYST\
EM_CLIENT: controlTypes.ROLE_PANE, oleacc.ROLE_SYSTEM_TITLEBAR: contro\
lTypes.ROLE_TITLEBAR, oleacc.ROLE_SYSTEM_DIALOG: controlTypes.ROLE_DIA\
LOG, oleacc.ROLE_SYSTEM_PANE: controlTypes.ROLE_PANE, oleacc.ROLE_SYST\
EM_CHECKBUTTON: controlTypes.ROLE_CHECKBOX, oleacc.ROLE_SYSTEM_RADIOBU\
TTON: controlTypes.ROLE_RADIOBUTTON, oleacc.ROLE_SYSTEM_STATICTEXT: co\
ntrolTypes.ROLE_STATICTEXT, oleacc.ROLE_SYSTEM_TEXT: controlTypes.ROLE\
_EDITABLETEXT, oleacc.ROLE_SYSTEM_PUSHBUTTON: controlTypes.ROLE_BUTTON\
...

IAccessibleStatesToNVDAStates

Value:
{oleacc.STATE_SYSTEM_TRAVERSED: controlTypes.STATE_VISITED, oleacc.STA\
TE_SYSTEM_UNAVAILABLE: controlTypes.STATE_UNAVAILABLE, oleacc.STATE_SY\
STEM_FOCUSED: controlTypes.STATE_FOCUSED, oleacc.STATE_SYSTEM_SELECTED\
: controlTypes.STATE_SELECTED, oleacc.STATE_SYSTEM_BUSY: controlTypes.\
STATE_BUSY, oleacc.STATE_SYSTEM_PRESSED: controlTypes.STATE_PRESSED, o\
leacc.STATE_SYSTEM_CHECKED: controlTypes.STATE_CHECKED, oleacc.STATE_S\
YSTEM_MIXED: controlTypes.STATE_HALFCHECKED, oleacc.STATE_SYSTEM_READO\
NLY: controlTypes.STATE_READONLY, oleacc.STATE_SYSTEM_EXPANDED: contro\
...

IAccessible2StatesToNVDAStates

Value:
{IA2_STATE_REQUIRED: controlTypes.STATE_REQUIRED, IA2_STATE_DEFUNCT: c\
ontrolTypes.STATE_DEFUNCT, IA2_STATE_INVALID_ENTRY: controlTypes.STATE\
_INVALID_ENTRY, IA2_STATE_MODAL: controlTypes.STATE_MODAL, IA2_STATE_S\
UPPORTS_AUTOCOMPLETION: controlTypes.STATE_AUTOCOMPLETE, IA2_STATE_MUL\
TI_LINE: controlTypes.STATE_MULTILINE, IA2_STATE_ICONIFIED: controlTyp\
es.STATE_ICONIFIED, IA2_STATE_EDITABLE: controlTypes.STATE_EDITABLE, I\
A2_STATE_PINNED: controlTypes.STATE_PINNED,}

winEventIDsToNVDAEventNames

Value:
{winUser.EVENT_SYSTEM_DESKTOPSWITCH: "desktopSwitch", winUser.EVENT_SY\
STEM_FOREGROUND: "gainFocus", winUser.EVENT_SYSTEM_ALERT: "alert", win\
User.EVENT_SYSTEM_MENUSTART: "menuStart", winUser.EVENT_SYSTEM_MENUEND\
: "menuEnd", winUser.EVENT_SYSTEM_MENUPOPUPSTART: "menuStart", winUser\
.EVENT_SYSTEM_MENUPOPUPEND: "menuEnd", winUser.EVENT_SYSTEM_SCROLLINGS\
TART: "scrollingStart", winUser.EVENT_SYSTEM_SWITCHEND: "switchEnd", w\
inUser.EVENT_OBJECT_FOCUS: "gainFocus", winUser.EVENT_OBJECT_SHOW: "sh\
ow", winUser.EVENT_OBJECT_HIDE: "hide", winUser.EVENT_OBJECT_DESTROY: \
...

cWinEventCallback

Value:
WINFUNCTYPE(None, c_int, c_int, c_int, c_int, c_int, c_int, c_int)(win\
EventCallback)