pyface.action.action_item module

An action manager item that represents an actual action.

class pyface.action.action_item.ActionItem[source]

Bases: pyface.action.action_manager_item.ActionManagerItem

An action manager item that represents an actual action.

id = Property(Str)

The item’s unique identifier (‘unique’ in this case means unique within its group).

action = Instance(Action)

The action!

control = Any()

The toolkit specific control created for this item.

add_to_menu(parent, menu, controller)[source]

Add the item to a menu.

Parameters
  • parent (toolkit control) – The parent of the new menu item control.

  • menu (toolkit menu) – The menu to add the action item to.

  • controller (ActionController instance or None) – The controller to use.

add_to_toolbar(parent, tool_bar, image_cache, controller, show_labels=True)[source]

Adds the item to a tool bar.

Parameters
  • parent (toolkit control) – The parent of the new menu item control.

  • tool_bar (toolkit toolbar) – The toolbar to add the action item to.

  • image_cache (ImageCache instance) – The image cache for resized images.

  • controller (ActionController instance or None) – The controller to use.

  • show_labels (bool) – Should the toolbar item show a label.

add_to_palette(tool_palette, image_cache, show_labels=True)[source]

Adds the item to a tool palette.

Parameters
  • parent (toolkit control) – The parent of the new menu item control.

  • tool_palette (toolkit tool palette) – The tool palette to add the action item to.

  • image_cache (ImageCache instance) – The image cache for resized images.

  • show_labels (bool) – Should the toolbar item show a label.

destroy()[source]

Called when the action is no longer required.

By default this method calls ‘destroy’ on the action itself.