traitsui.instance_choice module

Defines the various instance descriptors used by the instance editor and instance editor factory classes.

class traitsui.instance_choice.InstanceChoice[source]

Bases: InstanceChoiceItem

get_name(object=None)[source]

Returns the name of the item.

get_object()[source]

Returns the object associated with the item.

is_compatible(object)[source]

Indicates whether a specified object is compatible with the item.

name_trait = Str("name")

The name of the object trait containing its user interface name:

object = Any()

Object associated with the item

class traitsui.instance_choice.InstanceChoiceItem[source]

Bases: ABCHasStrictTraits

get_name(object=None)[source]

Returns the name of the item.

abstract get_object()[source]

Returns the object associated with the item.

get_view()[source]

Returns the view associated with the object.

abstract is_compatible(object)[source]

Indicates whether a specified object is compatible with the item.

is_droppable()[source]

Indicates whether the item supports drag and drop.

is_factory = Bool(False)

Does this item create new instances?

is_selectable()[source]

Indicates whether the item can be selected by the user.

name = Str()

User interface name for the item

view = AView

View associated with this item

class traitsui.instance_choice.InstanceDropChoice[source]

Bases: InstanceFactoryChoice

droppable = True

Indicates whether an instance compatible with this item can be dragged and dropped rather than created . This value overrides the default.

is_factory = False

Does this item create new instances? This value overrides the default.

selectable = False

Indicates whether the item can be selected by the user. This value overrides the default.

class traitsui.instance_choice.InstanceFactoryChoice[source]

Bases: InstanceChoiceItem

args = Tuple()

Tuple of arguments to pass to klass to create an instance

droppable = Bool(False)

Indicates whether an instance compatible with this item can be dragged and dropped rather than created

get_name(object=None)[source]

Returns the name of the item.

get_object()[source]

Returns the object associated with the item.

is_compatible(object)[source]

Indicates whether a specified object is compatible with the item.

is_droppable()[source]

Indicates whether the item supports drag and drop.

is_factory = True

Does this item create new instances? This value overrides the default.

is_selectable()[source]

Indicates whether the item can be selected by the user.

klass = Callable()

A class (or other callable) that can be used to create an item compatible with this item

kw_args = Dict(Str, Any)

Dictionary of arguments to pass to klass to create an instance

selectable = Bool(True)

Indicates whether the item can be selected by the user