Module eventHandler
[hide private]

Module eventHandler

source code

Classes [hide private]
  _EventExecuter
Facilitates execution of a chain of event functions.
Functions [hide private]
 
queueEvent(eventName, obj, **kwargs)
Queues an NVDA event to be executed.
source code
 
_queueEventCallback(eventName, obj, kwargs) source code
boolean
isPendingEvents(eventName=None, obj=None)
Are there currently any events queued?
source code
 
executeEvent(eventName, obj, **kwargs)
Executes an NVDA event.
source code
 
doPreGainFocus(obj, sleepMode=False) source code
 
doPreDocumentLoadComplete(obj) source code
 
requestEvents(eventName=None, processId=None, windowClassName=None)
Request that particular events be accepted from a platform API.
source code
 
handleAppTerminate(appModule) source code
 
shouldAcceptEvent(eventName, windowHandle=None)
Check whether an event should be accepted from a platform API.
source code
Variables [hide private]
  _pendingEventCountsByName = {}
  _pendingEventCountsByObj = {}
  _pendingEventCountsByNameAndObj = {}
  _pendingEventCountsLock = threading.RLock()
  lastQueuedFocusObject = None
the last object queued for a gainFocus event.
  _acceptEvents = set()
set of (eventName, processId, windowClassName) of events to accept.
  _acceptEventsByProcess = {}
Maps process IDs to sets of events so they can be cleaned up when the process exits.
Function Details [hide private]

queueEvent(eventName, obj, **kwargs)

source code 

Queues an NVDA event to be executed.

Parameters:
  • eventName (string) - the name of the event type (e.g. 'gainFocus', 'nameChange')

isPendingEvents(eventName=None, obj=None)

source code 

Are there currently any events queued?

Parameters:
  • eventName (string) - an optional name of an event type. If given then only if there are events of this type queued will it return True.
  • obj (NVDAObjects.NVDAObject) - the NVDAObject the event is for
Returns: boolean
True if there are events queued, False otherwise.

executeEvent(eventName, obj, **kwargs)

source code 

Executes an NVDA event.

Parameters:
  • eventName (string) - the name of the event type (e.g. 'gainFocus', 'nameChange')
  • obj (NVDAObjects.NVDAObject) - the object the event is for
  • kwargs - Additional event parameters as keyword arguments.

requestEvents(eventName=None, processId=None, windowClassName=None)

source code 

Request that particular events be accepted from a platform API. Normally, shouldAcceptEvent rejects certain events, including most show events, events indicating changes in background processes, etc. This function allows plugins to override this for specific cases; e.g. to receive show events from a specific control or to receive certain events even when in the background. Note that NVDA may block some events at a lower level and doesn't listen for some event types at all. In these cases, you will not be able to override this. This should generally be called when a plugin is instantiated. All arguments must be provided.

shouldAcceptEvent(eventName, windowHandle=None)

source code 

Check whether an event should be accepted from a platform API. Creating NVDAObjects and executing events can be expensive and might block the main thread noticeably if the object is slow to respond. Therefore, this should be used before NVDAObject creation to filter out any unnecessary events. A platform API handler may do its own filtering before this.


Variables Details [hide private]

lastQueuedFocusObject

the last object queued for a gainFocus event. Useful for code running outside NVDA's core queue

Value:
None