Inherits from
- BaseTraitHandler: enthought.traits.trait_handlers.BaseTraitHandler
Attributes
- default_value
default_value = Undefined
- metadata
metadata = { }
Inherited from base classes
Method summary
- __call__(self, *args, **kw)
- __getattr__(self, name)
- __init__(self, default_value = NoDefaultSpecified, **metadata)
- as_ctrait(self)
- clone(self, default_value = Missing, **metadata)
- get_default_value(self)
- get_value(self, object, name, trait = None)
- init(self)
- set_value(self, object, name, value)
Inherited from base classes
- arg_error(self, method, arg_num, object, name, value)
- create_editor(self)
- dup_arg_error(self, method, arg_num, object, name)
- error(self, object, name, value)
- full_info(self, object, name, value)
- get_editor(self, trait = None)
- info(self)
- inner_traits(self)
- is_valid(self, object, name, value)
- keyword_error(self, method, object, name, value)
- missing_arg_error(self, method, arg_num, object, name)
- repr(self, value)
- return_error(self, method, object, value)
Methods
- __call__(self, *args, **kw)
Allows a derivative trait to be defined from this one.
- __getattr__(self, name)
- __init__(self, default_value = NoDefaultSpecified, **metadata)
This constructor method is the only method normally called directly by client code. It defines the trait. The default implementation accepts an optional, untype-checked default value, and caller-supplied trait metadata. Override this method whenever a different method signature or a type-checked default value is needed.
- as_ctrait(self)
Returns a CTrait corresponding to the trait defined by this class.
- clone(self, default_value = Missing, **metadata)
Clones the contents of this object into a new instance of the same class, and then modifies the cloned copy using the specified default_value and metadata. Returns the cloned object as the result.
Note that subclasses can change the signature of this method if needed, but should always call the 'super' method if possible.
- get_default_value(self)
Returns a tuple of the form: (default_value_type, default_value) which describes the default value for this trait. The default implementation analyzes the value of the trait's default_value attribute and determines an appropriate default_value_type for default_value. If you need to override this method to provide a different result tuple, the following values are valid values for default_value_type:
- 0, 1: The default_value item of the tuple is the default value.
- 2: The object containing the trait is the default value.
- 3: A new copy of the list specified by default_value is the default value.
- 4: A new copy of the dictionary specified by default_value is the default value.
- 5: A new instance of TraitListObject constructed using the default_value list is the default value.
- 6: A new instance of TraitDictObject constructed using the default_value dictionary is the default value.
- 7: default_value is a tuple of the form: (callable, args, kw), where callable is a callable, args is a tuple, and kw is either a dictionary or None. The default value is the result obtained by invoking callable(*args, **kw).
- 8: default_value is a callable. The default value is the result obtained by invoking default_value*(*object), where object is the object containing the trait. If the trait has a validate() method, the validate() method is also called to validate the result.
- 9: A new instance of TraitSetObject constructed using the default_value set is the default value.
- get_value(self, object, name, trait = None)
Returns the current value of a property-based trait.
- init(self)
Allows the trait to perform any additional initialization needed.
- set_value(self, object, name, value)
Sets the cached value of a property-based trait and fires the appropriate trait change event.