traitsui.editor module

Defines the abstract Editor class, which represents an editing control for an object trait in a Traits-based user interface.

class traitsui.editor.Editor(parent, **traits)

Bases: traits.has_traits.HasPrivateTraits

Represents an editing control for an object trait in a Traits-based user interface.

dispose()

Disposes of the contents of an editor.

error(excp)

Handles an error that occurs while setting the object’s trait value.

get_undo_item(object, name, old_value, new_value)

Creates an undo history entry.

init(parent)

Finishes initializing the editor by creating the underlying toolkit widget.

log_change(undo_factory, *undo_args)

Logs a change made in the editor.

parse_extended_name(name)

Returns a tuple of the form ( context_object, ‘name[.name…], callable ) for a specified extended name of the form: ‘name’ or ‘context_object_name.name[.name…]’.

prepare(parent)

Finishes setting up the editor.

restore_prefs(prefs)

Restores any saved user preference information associated with the editor.

save_prefs()

Returns any user preference information associated with the editor.

set_focus()

Assigns focus to the editor’s underlying toolkit widget.

string_value(value, format_func=None)

Returns the text representation of a specified object trait value.

This simply delegates to the factorys string_value method.

sync_value(user_name, editor_name, mode='both', is_list=False, is_event=False)

Set up synchronization between an editor trait and a user object trait.

Also sets the initial value of the editor trait from the user object trait (for modes ‘from’ and ‘both’), and the initial value of the user object trait from the editor trait (for mode ‘to’).

Parameters:
  • user_name (string) – The name of the trait to be used on the user object. If empty, no synchronization will be set up.
  • editor_name (string) – The name of the relevant editor trait.
  • mode (string, optional; one of 'to', 'from' or 'both') – The direction of synchronization. ‘from’ means that trait changes in the user object should be propagated to the editor. ‘to’ means that trait changes in the editor should be propagated to the user object. ‘both’ means changes should be propagated in both directions. The default is ‘both’.
  • is_list (bool, optional) – If true, synchronization for item events will be set up in addition to the synchronization for the object itself. The default is False.
  • is_event (bool, optional) – If true, this method won’t attempt to initialize the user object or editor trait values. The default is False.
update_editor()

Updates the editor when the object trait changes externally to the editor.

Previous topic

traitsui.dockable_view_element module

Next topic

traitsui.editor_factory module

This Page