pyface.action.schema.action_manager_builder module

Base action manager builder class

This module provides a base class that takes a schema for an action manager and builds the concrete action manager and its groups and items, folding in schema additions.

class pyface.action.schema.action_manager_builder.ActionManagerBuilder[source]

Bases: traits.has_traits.HasTraits

Builds action managers from schemas, merging schema additions.

controller = Instance("pyface.action.action_controller.ActionController")

An ActionController to use with the action managers created by the builder. May be None.

additions = List(Instance(SchemaAddition))

Schema additions to apply to all managers built by this builder. Any additions which do not match part of the supplied schema will be ignored.


Create a manager for the given schema using the additions.

Any additions whose paths do not match the supplied


schema (Schema) – An Schema for an ActionManager subclass (ie. one of MenuBarSchema, MenuSchema, or ToolBarSchema).


manager – The concrete ActionManager instance corresponding to the Schema with addtions. This does not yet have concrete toolkit widgets associated with it: usually those will be created separately.

Return type



Get any top-level toolbars from additions.

Unlike menus, there is no base toolbar manager, so additions which contribute new toolbars appear with no path. It is up to the class using the builder how it wants to handle these additional toolbars.


schemas – The additional toolbars specified in self.additions.

Return type

list of ToolBarSchema

prepare_item(item, path)[source]

Called immediately after a concrete Pyface item has been created (or, in the case of items that are not produced from schemas, immediately before they are processed).

This hook can be used to perform last-minute transformations or configuration. Returns a concrete Pyface item.

  • item (pyface.action item) – A concrete Pyface item.

  • path (str) – The path to the item in the Schema.


item – A modified or transformed Pyface item.

Return type

pyface.action item