atk.Action
Prev | The atk Class Reference | Next

## atk.Action

atk.Action — the ATK interface provided by UI components that the user can activate/interact with,

## Synopsis

    class atk.Action(gobject.GInterface):
        def do_action(i)
        def get_n_actions()
        def get_description(i)
        def get_name(i)
        def get_keybinding(i)
        def set_description(i, desc)
        def get_localized_name(i)

## Description

`atk.Action` should be implemented by instances of `atk.Object` classes with which the user can interact directly, i.e. buttons, checkboxes, scrollbars, e.g. components which are not "passive" providers of UI information.

Exceptions: when the user interaction is already covered by another appropriate interface such as `atk.EditableText` (insert/delete test, etc.) or `atk.Value` (set value) then these actions should not be exposed by `atk.Action` as well.

Also note that the `atk.Action` API is limited in that parameters may not be passed to the object being activated; thus the action must be self-contained and specifiable via only a single "verb". Concrete examples include "press", "release", "click" for buttons, "drag" (meaning initiate drag) and "drop" for drag sources and drop targets, etc.

Though most UI interactions on components should be invocable via keyboard as well as mouse, there will generally be a close mapping between "mouse actions" that are possible on a component and the AtkActions. Where mouse and keyboard actions are redundant in effect, `atk.Action` should expose only one action rather than exposing redundant actions if possible. By convention we have been using "mouse centric" terminology for `atk.Action` names.

## Methods

### atk.Action.do_action

        def do_action(i)

`i` : | the action index corresponding to the action to be performed
Returns : | `True` if success, `False` otherwise

Perform the specified action on the object.

### atk.Action.get_n_actions

        def get_n_actions()

Returns : | a the number of actions, or 0 if `action` does not implement this interface.

Gets the number of accessible actions available on the object. If there are more than one, the first one is considered the "default" action of the object.

### atk.Action.get_description

        def get_description(i)

`i` : | the action index corresponding to the action to be performed
Returns : | a description string, or `None` if `action` does not implement this interface.

Returns a description of the specified action of the object.

### atk.Action.get_name

        def get_name(i)

`i` : | the action index corresponding to the action to be performed
Returns : | a name string, or `None` if `action` does not implement this interface.

Returns the name of the specified action of the object.

### atk.Action.get_keybinding

        def get_keybinding(i)

`i` : | the action index corresponding to the action to be performed
Returns : | a string representing the keybinding, or `None` if there is no keybinding for this action.

Returns a keybinding associated with this action, if one exists.

### atk.Action.set_description

        def set_description(i, desc)

`i` : | the action index corresponding to the action to be performed
`desc` : | the description to be assigned to this action
Returns : | `True` if the description was successfully set;

Sets a description of the specified action of the object.

### atk.Action.get_localized_name

        def get_localized_name(i)

`i` : | the action index corresponding to the action to be performed
Returns : | a name string, or `None` if `action` does not implement this interface.

Returns the localized name of the specified action of the object.

Prev | Up | Next
The atk Class Reference | Home | atk.Component