Functions

deregister_device_event_listener (listener, filter)

deregister_keystroke_listener (listener, key_set, modmask, event_types)

event_main ()

event_quit ()

exit ()

generate_keyboard_event (keyval, keystring, synth_type)

generate_mouse_event (x, y, name)

generate_mouse_event_async (x, y, name, callback, *callback_data)

get_desktop (i)

get_desktop_count ()

get_desktop_list ()

get_version ()

init ()

is_initialized ()

register_device_event_listener (listener, event_types, filter)

register_keystroke_listener (listener, key_set, modmask, event_types, sync_type)

role_get_localized_name (role)

role_get_name (role)

set_main_context (cnx)

set_reference_window (accessible)

set_timeout (val, startup_time)

Details

Atspi.deregister_device_event_listener(listener, filter)
Parameters:
Raises:

GLib.Error

Returns:

True if successful, otherwise False.

Return type:

bool

Removes a device event listener from the registry’s listener queue, ceasing notification of events of the specified type.

Atspi.deregister_keystroke_listener(listener, key_set, modmask, event_types)
Parameters:
  • listener (Atspi.DeviceListener) – a pointer to the Atspi.DeviceListener for which keystroke events are requested.

  • key_set ([Atspi.KeyDefinition] or None) – a pointer to the Atspi.KeyDefinition array indicating which keystroke events are requested, or None to indicate that all keycodes and keyvals for the specified modifier set are to be included.

  • modmask (int) – the key modifier mask for which this listener is to be ‘deregistered’ (of type #AtspiKeyMaskType).

  • event_types (int) – an #AtspiKeyMaskType mask indicating which types of key events were requested (Atspi.KeyEventType.PRESSED, etc.).

Raises:

GLib.Error

Returns:

True if successful, otherwise False.

Return type:

bool

Removes a keystroke event listener from the registry’s listener queue, ceasing notification of events with modifiers matching modmask.

Atspi.event_main()

Starts/enters the main event loop for the AT-SPI services.

NOTE: This method does not return control; it is exited via a call to Atspi.Event.quit from within an event handler.

Atspi.event_quit()

Quits the last main event loop for the AT-SPI services, See: Atspi.Event.main

Atspi.exit()
Returns:

0 if there were no leaks, otherwise other integer values.

Return type:

int

Disconnects from #AtspiRegistry instances and releases any floating resources. Call only once at exit.

Atspi.generate_keyboard_event(keyval, keystring, synth_type)
Parameters:
Raises:

GLib.Error

Returns:

True if successful, otherwise False.

Return type:

bool

Synthesizes a keyboard event (as if a hardware keyboard event occurred in the current UI context).

Atspi.generate_mouse_event(x, y, name)
Parameters:
  • x (int) – a int indicating the screen x coordinate of the mouse event.

  • y (int) – a int indicating the screen y coordinate of the mouse event.

  • name (str) – a string indicating which mouse event to be synthesized (e.g. “b1p”, “b1c”, “b2r”, “rel”, “abs”).

Raises:

GLib.Error

Returns:

True if successful, otherwise False.

Return type:

bool

Synthesizes a mouse event at a specific screen coordinate. Most AT clients should use the #AccessibleAction interface when tempted to generate mouse events, rather than this method. Event names: b1p = button 1 press; b2r = button 2 release; b3c = button 3 click; b2d = button 2 double-click; abs = absolute motion; rel = relative motion.

Atspi.generate_mouse_event_async(x, y, name, callback, *callback_data)
Parameters:
  • x (int) – a int indicating the screen x coordinate of the mouse event.

  • y (int) – a int indicating the screen y coordinate of the mouse event.

  • name (str) – a string indicating which mouse event to be synthesized (e.g. “b1p”, “b1c”, “b2r”, “rel”, “abs”).

  • callback (Atspi.GenerateMouseEventCB or None) – a callback to be called when a reply is received. May be None.

  • callback_data (object or None) – data to be passed to callback.

Raises:

GLib.Error

Like Atspi.generate_mouse_event, but asynchronous.

Atspi.get_desktop(i)
Parameters:

i (int) – a int indicating which of the accessible desktops is to be returned.

Returns:

a pointer to the i-th virtual desktop’s Atspi.Accessible representation.

Return type:

Atspi.Accessible

Gets the virtual desktop indicated by index i. NOTE: currently multiple virtual desktops are not implemented; as a consequence, any i value different from 0 will not return a virtual desktop - instead it will return None.

Atspi.get_desktop_count()
Returns:

a int indicating the number of active virtual desktops.

Return type:

int

Gets the number of virtual desktops. NOTE: multiple virtual desktops are not implemented yet; as a consequence, this function always returns 1.

Atspi.get_desktop_list()
Returns:

a GLib.Array of desktops.

Return type:

[Atspi.Accessible]

Gets the list of virtual desktops. On return, list will point to a newly-created, None terminated array of virtual desktop pointers. It is the responsibility of the caller to free this array when it is no longer needed. NOTE: currently multiple virtual desktops are not implemented; this implementation always returns a #Garray with a single Atspi.Accessible desktop.

Atspi.get_version()
Returns:

major:

the major version.

minor:

the minor version.

micro:

the micro/patch version.

Return type:

(major: int, minor: int, micro: int)

Returns the version of the AT-SPI library being used at runtime.

New in version 2.50.

Atspi.init()
Returns:

0 on success, 1 if already initialized, or an integer error code.

Return type:

int

Connects to the accessibility registry and initializes the SPI.

Atspi.is_initialized()
Returns:

%True if initialized; %False otherwise.

Return type:

bool

Indicates whether AT-SPI has been initialized.

Atspi.register_device_event_listener(listener, event_types, filter)
Parameters:
Raises:

GLib.Error

Returns:

Always returns False.

Return type:

bool

This function does nothing and should not be called.

Atspi.register_keystroke_listener(listener, key_set, modmask, event_types, sync_type)
Parameters:
Raises:

GLib.Error

Returns:

True if successful, otherwise False.

Return type:

bool

Registers a listener for keystroke events, either pre-emptively for all windows (Atspi.KeyListenerSyncType.ALL_WINDOWS), non-preemptively (Atspi.KeyListenerSyncType.NOSYNC), or pre-emptively at the toolkit level (Atspi.KeyListenerSyncType.CANCONSUME). If ALL_WINDOWS or CANCONSUME are used, the event is consumed upon receipt if one of listener's callbacks returns True (other sync_type values may be available in the future).

Atspi.role_get_localized_name(role)
Parameters:

role (Atspi.Role) – an Atspi.Role object to query.

Returns:

the localized string describing the Atspi.Role

Return type:

str

Gets the localized description string describing the Atspi.Role role.

Atspi.role_get_name(role)
Parameters:

role (Atspi.Role) – an Atspi.Role object to query.

Returns:

a localizable string name for an Atspi.Role enumerated type.

Return type:

str

Gets a localizable string that indicates the name of an Atspi.Role.

Atspi.set_main_context(cnx)
Parameters:

cnx (GLib.MainContext) – The GLib.MainContext to use.

Sets the main loop context that AT-SPI should assume is in use when setting an idle callback. This function should be called by application-side implementors (ie, at-spi2-atk) when it is desirable to re-enter the main loop.

Atspi.set_reference_window(accessible)
Parameters:

accessible (Atspi.Accessible) – the Atspi.Accessible corresponding to the window to select. should be a top-level window with a role of Atspi.Role.APPLICATION.

Deprecated. This function no longer does anything and should not be used.

Atspi.set_timeout(val, startup_time)
Parameters:
  • val (int) – The timeout value, in milliseconds, or -1 to disable the timeout.

  • startup_time (int) – The amount of time, in milliseconds, to allow to pass before enforcing timeouts on an application. Can be used to prevent timeout exceptions if an application is likely to block for an extended period of time on initialization. -1 can be passed to disable this behavior.

Set the timeout used for method calls. If this is not set explicitly, a default of 800 ms is used. Note that at-spi2-registryd currently uses a timeout of 3 seconds when sending a keyboard event notification. This means that, if an AT makes a call in response to the keyboard notification and the application being called does not respond before the timeout is reached, at-spi2-registryd will time out on the keyboard event notification and pass the key onto the application (ie, reply to indicate that the key was not consumed), so this may make it undesirable to set a timeout larger than 3 seconds.

By default, the normal timeout is set to 800 ms, and the application startup timeout is set to 15 seconds.