traitsui.editor_factory module

Defines the abstract EditorFactory class, which represents a factory for creating the Editor objects used in a Traits-based user interface.

class traitsui.editor_factory.EditorFactory(*args, **traits)[source]

Bases: HasPrivateTraits

Represents a factory for creating the Editor objects in a Traits-based user interface.

custom_editor(ui, object, name, description, parent)[source]

Generates an editor using the “custom” style.

custom_editor_class = Property()

The editor class to use for ‘custom’ style views.

enabled = Bool(True)

Are created editors initially enabled?

format_func = Callable()

Function to use for string formatting

format_str = Str()

Format string to use for formatting (used if format_func not set).

init()[source]

Performs any initialization needed after all constructor traits have been set.

invalid = Str()

The extended trait name of the trait containing editor invalid state status:

is_grid_cell = Bool(False)

Is the editor being used to create table grid cells?

named_value(name, ui)[source]

Returns the value of a specified extended name of the form: name or context_object_name.name[.name…]:

readonly_editor(ui, object, name, description, parent)[source]

Generates an “editor” that is read-only.

readonly_editor_class = Property()

The editor class to use for ‘readonly’ style views.

simple_editor(ui, object, name, description, parent)[source]

Generates an editor using the “simple” style.

simple_editor_class = Property()

The editor class to use for ‘simple’ style views.

string_value(value, format_func=None)[source]

Returns the text representation of a specified object trait value.

If the format_func attribute is set on the editor factory, then this method calls that function to do the formatting. If the format_str attribute is set on the editor factory, then this method uses that string for formatting. If neither attribute is set, then this method just calls the appropriate text type to format.

text_alignment = Str()

Text aligment to use in most readonly editors Possible values: left, right, top, bottom, just, vcenter, hcenter, center Example: left,vcenter

text_editor(ui, object, name, description, parent)[source]

Generates an editor using the “text” style.

text_editor_class = Property()

The editor class to use for ‘text’ style views.

class traitsui.editor_factory.EditorWithListFactory(*args, **traits)[source]

Bases: EditorFactory

Base class for factories of editors for objects that contain lists.

name = Str()

Name of the trait on ‘object’ containing the enumeration data

object = Str("object")

Extended name of the trait on object containing the enumeration data

values = Any()

Values to enumerate (can be a list, tuple, dict, or a CTrait or TraitHandler that is “mapped”):