pyface.action.action_manager_item module

Abstract base class for all action manager items.

class pyface.action.action_manager_item.ActionManagerItem[source]

Bases: traits.has_traits.HasTraits

Abstract base class for all action manager items.

An action manager item represents a contribution to a shared UI resource such as a menu bar, menu or tool bar.

Action manager items know how to add themselves to menu bars, menus and tool bars. In a tool bar a contribution item is represented as a tool or a separator. In a menu bar a contribution item is a menu, and in a menu a contribution item is a menu item or separator.

id = Str()

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

parent = Instance("pyface.action.api.Group")

The group the item belongs to.

enabled = Bool(True)

Is the item enabled?

visible = Bool(True)

Is the item visible?

add_to_menu(parent, menu, controller)[source]

Adds 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)[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.