pyface.action.field_action module

class pyface.action.field_action.FieldAction[source]

Bases: Action

A widget action containing an IField

When the value in the field is changed, the on_perform method is called with the new value as the argument.

style = Constant("widget")

This is a widget action.

field_type = Type(IField)

The field to display.

field_defaults = Dict(Str, Any)

The default trait values for the field.

create_control(parent)[source]

Called when creating a “widget” style action.

This constructs an IField-based control directly and binds changes to the value to the value_updated method.

Parameters

parent (toolkit control) – The toolkit control, usually a toolbar.

Returns

control – A toolkit control or None.

Return type

toolkit control

value_updated(event)[source]

Handle changes to the field value by calling perform.

The event passed to perform has the value as an attribute.

perform(event)[source]

Performs the action.

This dispacthes to the on_perform method with the new value passed as an argument.

Parameters

event (ActionEvent) – The event which triggered the action.