pyface.action.group module¶
A group of action manager items.
- class pyface.action.group.Group(*items, **traits)[source]¶
Bases:
HasTraits
A group of action manager items.
By default, a group declares itself as requiring a separator when it is visualized, but this can be changed by setting its ‘separator’ trait to False.
- enabled = Bool(True)¶
Is the group enabled?
- visible = Bool(True)¶
Is the group visible?
- id = Str()¶
The group’s unique identifier (only needs to be unique within the action manager that the group belongs to).
- items = Property¶
All of the items in the group.
- parent = Any # Instance('pyface.action.ActionManager')¶
The action manager that the group belongs to.
- separator = Bool(True)¶
Does this group require a separator when it is visualized?
- append(item)[source]¶
Appends an item to the group.
- Parameters
item (ActionManagerItem, Action or callable) – The item to append.
- Returns
item – The actually inserted item.
- Return type
Notes
If the item is an ActionManagerItem instance it is simply appended. If the item is an Action instance, an ActionItem is created for the action, and that is appended. If the item is a callable, then an Action is created for the callable, and then that is handled as above.
- destroy()[source]¶
Called when the manager is no longer required.
By default this method simply calls ‘destroy’ on all items in the group.
- insert(index, item)[source]¶
Inserts an item into the group at the specified index.
- Parameters
index (int) – The position to insert the item.
item (ActionManagerItem, Action or callable) – The item to insert.
- Returns
item – The actually inserted item.
- Return type
Notes
If the item is an ActionManagerItem instance it is simply inserted. If the item is an Action instance, an ActionItem is created for the action, and that is inserted. If the item is a callable, then an Action is created for the callable, and then that is handled as above.
- remove(item)[source]¶
Removes an item from the group.
- Parameters
item (ActionManagerItem) – The item to remove.
- insert_before(before, item)[source]¶
Inserts an item into the group before the specified item.
- Parameters
before (ActionManagerItem) – The item to insert before.
item (ActionManagerItem, Action or callable) – The item to insert.
- Returns
index, item – The position inserted, and the item actually inserted.
- Return type
Notes
If the item is an ActionManagerItem instance it is simply inserted. If the item is an Action instance, an ActionItem is created for the action, and that is inserted. If the item is a callable, then an Action is created for the callable, and then that is handled as above.
- insert_after(after, item)[source]¶
Inserts an item into the group after the specified item.
- Parameters
before (ActionManagerItem) – The item to insert after.
item (ActionManagerItem, Action or callable) – The item to insert.
- Returns
index, item – The position inserted, and the item actually inserted.
- Return type
Notes
If the item is an ActionManagerItem instance it is simply inserted. If the item is an Action instance, an ActionItem is created for the action, and that is inserted. If the item is a callable, then an Action is created for the callable, and then that is handled as above.