Inherits from
- TraitType: enthought.traits.trait_handlers.TraitType
Attributes
- smart_notify
Call the notifiers smartly only when the value has really changed. If this is set to False, the notification will always occur.
smart_notify = True
- trait_type
Not really necessary but specifies the attribute up front.
trait_type = None
Inherited from base classes
Method summary
- __init__(self, trait_type, smart_notify = True, **metadata)
- get(self, object, name)
- set(self, object, name, value)
- validate(self, object, name, value)
Inherited from base classes
- __call__(self, *args, **kw)
- __getattr__(self, name)
- arg_error(self, method, arg_num, object, name, value)
- as_ctrait(self)
- clone(self, default_value = Missing, **metadata)
- create_editor(self)
- dup_arg_error(self, method, arg_num, object, name)
- error(self, object, name, value)
- full_info(self, object, name, value)
- get_default_value(self)
- get_editor(self, trait = None)
- get_value(self, object, name, trait = None)
- info(self)
- init(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)
- set_value(self, object, name, value)
Methods
- __init__(self, trait_type, smart_notify = True, **metadata)
Defines a shadow property trait that is best explained by example:
class Thing(HasTraits): x = ShadowProperty(Float, smart_notify=False) def _x_changed(self, value): print valueIn this example, the actual value of the property (x) will be stored in _x and _x_changed will be called regardless whether the value actually changed or not. If smart_notify is set to True then the handler is called only if the value has actually changed.
Note that the validation uses the validation of the specified trait_type parameter.
- get(self, object, name)
Get the value of the trait.
- set(self, object, name, value)
Set the value of the trait.
- validate(self, object, name, value)
Validates that a specified value is valid for this trait.