pyLinAcc :: Event :: Manager :: Class Manager
[hide private]
[frames] | no frames]

Class Manager

source code

object --+
         |
        Manager

Manages all event Observers. Allows clients to register and unregister callbacks for observed events. Acts as a point of serialization for events so events of the same klass (see EventType) can be gauranteed to be delivered to the registered clients in the order they were registered. No such guarantee is made across event klasses.

Instance Methods [hide private]
 
__init__(self)
Stores references to the Accessibility.Registery and creates the empty client and observer dictionaries.
source code
 
_registerClients(self, client, name)
Internal method that recursively associates a client with AT-SPI event names.
source code
 
_unregisterClients(self, client, name)
Internal method that recursively unassociates a client with AT-SPI event names.
source code
Observer
_registerObserver(self, name)
Creates a new Observer to watch for events of the given type or returns the existing observer if one is already registered.
source code
 
_unregisterObserver(self, name)
Destroys an existing Observer for the given event type only if no clients are registered for the events it is monitoring.
source code
 
close(self)
Shuts down the Manager by destroying all observers.
source code
 
addClient(self, client, *names)
Registers a new client callback for the given event names.
source code
boolean
removeClient(self, client, *names)
Unregisters an existing client callback for the given event names.
source code
 
generateKeyEvent(self, key_code, press=True)
Synthesizes a key press or key release to be sent to the foreground window with the input focus.
source code
 
handleEvent(self, event)
Handles an AT-SPI event.
source code
 
_dispatchEvent(self, event)
Dispatches Events to registered clients.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variables [hide private]
dictionary {event name : client callable} clients
Registered Clients to be notified about events
dictionary {event klass : Observer} observers
Observer objects registered to monitor events
Accessibility.Registry registry
Reference to the Gnome Accessibility.Registry
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Stores references to the Accessibility.Registery and creates the empty client and observer dictionaries.

Overrides: object.__init__

_registerClients(self, client, name)

source code 

Internal method that recursively associates a client with AT-SPI event names. Allows a clientto incompletely specify an event name in order to register for subevents without specifying their full names manually. See Manager.addClient for valid event names.

Parameters:
  • client (callable) - Client callback to receive event notifications
  • name (string) - Partial or full event name

_unregisterClients(self, client, name)

source code 

Internal method that recursively unassociates a client with AT-SPI event names. Allows a client to incompletely specify an event name in order to unregister for subevents without specifying their full names manually.

Parameters:
  • client (callable) - Client callback to receive event notifications
  • name (string) - Partial or full event name

_registerObserver(self, name)

source code 

Creates a new Observer to watch for events of the given type or returns the existing observer if one is already registered. One Observer is created for each event type which has no subevents.

Parameters:
  • name (string) - Name of the event to observe
Returns: Observer
Observer object that is monitoring the event

_unregisterObserver(self, name)

source code 

Destroys an existing Observer for the given event type only if no clients are registered for the events it is monitoring.

Parameters:
  • name (string) - Name of the event to observe
Raises:
  • KeyError - When an observer for the given event is not regist

addClient(self, client, *names)

source code 

Registers a new client callback for the given event names. Supports registration for all subevents if only partial event name is specified. Do not include a trailing colon. The valid event names are the following:

terminal terminal:line-changed terminal:columncount-changed terminal:linecount-changed terminal:application-changed', terminal:charwidth-changed document:load-complete document:reload document:load-stopped document:content-changed document:attributes-changed object object:bounds-changed object:link-selected object:property-change object:state-changed object:children-changed object:visible-data-changed object:selection-changed object:model-changed object:active-descendant-changed object:row-inserted object:row-reordered object:row-deleted object:column-inserted object:column-reordered object:column-deleted object:attributes-changed object:text-attributes-changed object:text-selection-changed object:text-caret-moved object:text-changed object:text-changed:insert object:text-changed:delete object:property-change object:property-change:accessible-parent object:property-change:accessible-name object:property-change:accessible-description object:property-change:accessible-value object:property-change:accessible-role object:property-change:accessible-table-caption object:property-change:accessible-table-column-description object:property-change:accessible-table-column-header object:property-change:accessible-table-row-description object:property-change:accessible-table-row-header object:property-change:accessible-table-summary object:children-changed object:children-changed:add object:children-changed:remove object:state-changed object:state-changed:active object:state-changed:armed object:state-changed:busy object:state-changed:checked object:state-changed:collapsed object:state-changed:defunct object:state-changed:editable object:state-changed:enabled object:state-changed:expandable object:state-changed:expanded object:state-changed:focusable object:state-changed:focused object:state-changed:has-tooltip object:state-changed:horizontal object:state-changed:iconified object:state-changed:indeterminate object:state-changed:invalid object:state-changed:last-defined object:state-changed:manages-descendants object:state-changed:modal object:state-changed:multi-line object:state-changed:multiselectable object:state-changed:opaque object:state-changed:pressed object:state-changed:resizable object:state-changed:selectable object:state-changed:selected object:state-changed:sensitive object:state-changed:showing object:state-changed:single-line object:state-changed:stale object:state-changed:transient object:state-changed:vertical object:state-changed:visible ... mouse mouse:abs mouse:rel mouse:button mouse:button mouse:button:1p mouse:button:1r mouse:button:2p mouse:button:2r mouse:button:3p mouse:button:3r window window:minimize window:maximize window:restore window:close window:create window:reparent window:desktop-create window:desktop-destroy window:activate window:deactivate window:raise window:lower window:move window:resize window:shade window:unshade window:restyle focus keyboard keyboard:press keyboard:release

For example, 'object' will register for all object events, 'object:property-change' will register for all property change events, and 'object:property-change:accessible-parent' will register only for the parent property change event.

Registered clients will not be automatically removed when the client dies. To ensure the client is properly garbage collected, call Manager.removeClient.

Parameters:
  • client (callable) - Callable to be invoked when the event occurs
  • names (list of string) - List of full or partial event names

removeClient(self, client, *names)

source code 

Unregisters an existing client callback for the given event names. Supports unregistration for all subevents if only partial event name is specified. Do not include a trailing colon.

This method must be called to ensure a client registered by Manager.addClient is properly garbage collected.

Parameters:
  • client (callable) - Client callback to remove
  • names (list of string) - List of full or partial event names
Returns: boolean
Were event names specified for which the given client was not registered?

generateKeyEvent(self, key_code, press=True)

source code 

Synthesizes a key press or key release to be sent to the foreground window with the input focus.

Parameters:
  • key_code (integer) - Key code representing the physical key on the keyboard to press
  • press (boolean) - True to send a key press, False to send a key release

handleEvent(self, event)

source code 

Handles an AT-SPI event. The default implementation immediately calls _dispatchEvent to send the event on to the registered clients. Override this method to implement some other default behavior (e.g. queueing events for later processing.

As of 9/12/05, the faster this method returns, the better, as AT-SPI event handling appears to be done synchronously across the Gnome desktop. If this method stalls, the entire desktop will freeze.

Parameters:
  • event (Event) - Wrapped AT-SPI event

_dispatchEvent(self, event)

source code 

Dispatches Events to registered clients. Clients are called in the order they were registered for the given AT-SPI event. If any client sets the Event consume flag to True, callbacks cease immediately for that event. For keyboard events, this also implies that no other observer registered with AT-SPI across the system will receive the event nor will the application with the input focus.

Parameters:
  • event (Event) - Wrapped AT-SPI event