2.2.2
Recognized Metadata Attributes
The following metadata attributes are not predefined, but
are recognized by HasTraits objects:
·
desc: A string describing the
intended meaning of the trait. It is used in exception messages and fly-over
help in user interface trait editors.
·
editor: Specifies an instance
of a subclass of TraitEditor to use when creating a user interface editor for
the trait. Refer to the Traits UI User Guide for
more information on trait editors.
·
label: A string providing a
human-readable name for the trait. It is used to label trait attribute values
in user interface trait editors.
·
rich_compare: A Boolean
indicating whether the basis for considering a trait attribute value to have
changed is a “rich” comparison (True, the default), or simple object identity
(False). This attribute can be useful in cases where a detailed comparison of
two objects is very expensive, or where you do not care if the details of an
object change, as long as the same object is used.
· trait_value:
A Boolean indicating whether the trait attribute accepts values that are
instances of TraitValue. The default
is False. The TraitValue class provides a mechanism for dynamically modifying
trait definitions. See the Traits API Reference for details on TraitValue. If trait_value
is True, then setting the trait attribute to TraitValue(), with no arguments,
resets the attribute to it original default value.
·
transient: A Boolean
indicating whether the trait value is persisted when the object containing it
is persisted. The default value for most predefined traits is True. You can set
it to False for traits whose values you know you do not want to persist. Do not
set it to False on traits where it is set internally to True, as doing so is
likely to create unintended consequences. See Section 6.5, “Persistence” for
more information.
Other metadata attributes may be recognized by specific
predefined traits.
|