Atspi.Device

g Atspi.Device Atspi.Device GObject.Object GObject.Object GObject.Object->Atspi.Device

Subclasses:

Atspi.DeviceLegacy, Atspi.DeviceX11

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add_key_grab (kd, callback, *user_data)

add_key_watcher (*user_data)

get_grab_by_id (id)

get_locked_modifiers ()

get_modifier (keycode)

grab_keyboard ()

map_modifier (keycode)

notify_key (pressed, keycode, keysym, state, text)

remove_key_grab (id)

ungrab_keyboard ()

unmap_modifier (keycode)

Virtual Methods

Inherited:

GObject.Object (7)

do_add_key_grab (kd)

do_get_locked_modifiers ()

do_get_modifier (keycode)

do_grab_keyboard ()

do_map_modifier (keycode)

do_remove_key_grab (id)

do_ungrab_keyboard ()

do_unmap_modifier (keycode)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Atspi.Device(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Atspi.DeviceClass

classmethod new()
Returns:

a pointer to a newly-created Atspi.Device.

Return type:

Atspi.Device

Creates a new Atspi.Device with a specified callback function.

add_key_grab(kd, callback, *user_data)
Parameters:
Returns:

an identifier that can be later used to remove the grab. Add a key grab for the given key/modifier combination.

Return type:

int

add_key_watcher(*user_data)
Parameters:

user_data (object or None) – Data to be passed to callback.

Add a callback that will receive a notification whenever a key is pressed or released.

get_grab_by_id(id)
Parameters:

id (int) –

Return type:

Atspi.KeyDefinition

get_locked_modifiers()
Returns:

a int of modifier flags.

Return type:

int

Returns the locked modifiers (ie, num lock, caps lock) associated with this keyboard.

get_modifier(keycode)
Parameters:

keycode (int) – the keycode to map.

Returns:

the modifier that is mapped to this keycode.

Return type:

int

Gets the modifier for a given keycode, if one exists. Does not create a new mapping. This function should be used when the intention is to query a locking modifier such as num lock via Atspi.Device.get_locked_modifiers, rather than to add key grabs.

grab_keyboard()
Returns:

True if successful, False otherwise.

Return type:

bool

Attempts to grab the entire keyboard. This should only be done temporarily, as it may conflict with other applications that also want to grab the keyboard.

map_modifier(keycode)
Parameters:

keycode (int) – the keycode to map.

Returns:

the modifier that is now mapped to this keycode. This return value can be passed to Atspi.Device.add_key_grab.

Return type:

int

Maps the specified key code to a modifier so that it can be used in conjunction with other keys to create a key grab. If the given keycode is already mapped, then this function will return the modifier that is currently mapped to the keycode, without doing anything else. Otherwise, it will use the last modifier that AT-SPI used to map a key. If no keys have yet been mapped using this device, then it will look for a modifier that is not currently being used. If no unused modifier can be found, then it will use the first modifier by default.

notify_key(pressed, keycode, keysym, state, text)
Parameters:
  • pressed (bool) –

  • keycode (int) –

  • keysym (int) –

  • state (int) –

  • text (str) –

Return type:

bool

remove_key_grab(id)
Parameters:

id (int) – the identifier of the grab to be removed.

Removes the key grab specified by id.

ungrab_keyboard()

Removes a keyboard grab added via a call to atspi_device_add_keyboard.

unmap_modifier(keycode)
Parameters:

keycode (int) – the keycode to unmap.

Removes a mapped modifier from the given keycode.

do_add_key_grab(kd) virtual
Parameters:

kd (Atspi.KeyDefinition) –

do_get_locked_modifiers() virtual
Returns:

a int of modifier flags.

Return type:

int

Returns the locked modifiers (ie, num lock, caps lock) associated with this keyboard.

do_get_modifier(keycode) virtual
Parameters:

keycode (int) – the keycode to map.

Returns:

the modifier that is mapped to this keycode.

Return type:

int

Gets the modifier for a given keycode, if one exists. Does not create a new mapping. This function should be used when the intention is to query a locking modifier such as num lock via Atspi.Device.get_locked_modifiers, rather than to add key grabs.

do_grab_keyboard() virtual
Returns:

True if successful, False otherwise.

Return type:

bool

Attempts to grab the entire keyboard. This should only be done temporarily, as it may conflict with other applications that also want to grab the keyboard.

do_map_modifier(keycode) virtual
Parameters:

keycode (int) – the keycode to map.

Returns:

the modifier that is now mapped to this keycode. This return value can be passed to Atspi.Device.add_key_grab.

Return type:

int

Maps the specified key code to a modifier so that it can be used in conjunction with other keys to create a key grab. If the given keycode is already mapped, then this function will return the modifier that is currently mapped to the keycode, without doing anything else. Otherwise, it will use the last modifier that AT-SPI used to map a key. If no keys have yet been mapped using this device, then it will look for a modifier that is not currently being used. If no unused modifier can be found, then it will use the first modifier by default.

do_remove_key_grab(id) virtual
Parameters:

id (int) – the identifier of the grab to be removed.

Removes the key grab specified by id.

do_ungrab_keyboard() virtual

Removes a keyboard grab added via a call to atspi_device_add_keyboard.

do_unmap_modifier(keycode) virtual
Parameters:

keycode (int) – the keycode to unmap.

Removes a mapped modifier from the given keycode.