pyface.action.action_controller module

The default action controller for menus, menu bars and tool bars.

class pyface.action.action_controller.ActionController[source]

Bases: traits.has_traits.HasTraits

The default action controller for menus, menu bars and tool bars.

perform(action, event)[source]

Control an action invocation.

Parameters
  • action (Action instance) – The action to perform.

  • event (ActionEvent instance) – The event that triggered the action.

Returns

result – The result of the action’s perform method (usually None).

Return type

any

can_add_to_menu(action)[source]

Can add an action to a menu

Parameters

action (Action instance) – The action to consider.

Returns

can_addTrue if the action can be added to a menu/menubar.

Return type

bool

add_to_menu(action)[source]

Called when an action is added to the a menu/menubar.

Parameters

action (Action instance) – The action added to the menu.

can_add_to_toolbar(action)[source]

Returns True if the action can be added to a toolbar.

Parameters

action (Action instance) – The action to consider.

Returns

can_addTrue if the action can be added to a toolbar.

Return type

bool

add_to_toolbar(action)[source]

Called when an action is added to the a toolbar.

Parameters

action (Action instance) – The action added to the toolbar.