Inherits from
- HasPrivateTraits: enthought.traits.has_traits.HasPrivateTraits
- DictMixin: UserDict.DictMixin
Attributes
- clear
clear = single_event(DictMixin.clear)
- context_modified
Fired when any change occurs to the contents of the context. The value is a ContextModified object, which describes all the changes that have occurred:
context_modified = Event(ContextModified)
- context_selection
Current selection mask (none for the base context):
context_selection = Constant(None)
- dict_modified
Fired when any change occurs to the structure of the context's dictionary (or its base context's dictionary, if it doesn't have its own). Unlike 'context_modified', 'dict_modified' only fires when the dictionary itself changes, and not when objects in the dictionary change.
dict_modified = Event(TraitDictEvent)
- dirty
Whether the context is "dirty" -- just a placeholder until HasDirty is factored out of encode.
dirty = Bool
- get
Prefer 'DictMixin.get' to 'HasTraits.get'
get = DictMixin.get
- update
Don't generate multiple events
update = single_event(DictMixin.update)
Inherited from base classes
Method summary
- __cmp__(self, other)
- __delitem__(self, name)
- __getitem__(self, name)
- __setitem__(self, name, value)
- bind_dynamic(self, value, trait_name)
- contains_context(self, context)
- context_group_for(self, name, names = None)
- copy(self)
- dump_context(self, indent = 0)
- get_context_base(self)
- get_context_data(self, name)
- get_context_reference(self, name)
- get_context_undefined(self, name, value)
- get_dotted(self, name)
- get_mapping_context(self, mode = CreateContext)
- get_reduction_context(self, mode = CreateContext)
- get_selection_context(self, mode = CreateContext)
- has_dotted(self, name)
- is_valid_array(self, value)
- keys(self)
- post_context_modified(self, event)
- post_dict_modified(self, event)
- remove_context(self, context)
- set_context_data(self, name, value)
- set_context_undefined(self, name, value)
- set_dotted(self, name, value)
Inherited from base classes
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name, is_set)
- __reduce_ex__(self, protocol)
- __setstate__(self, state, trait_change_notify = True)
- add_class_trait(cls, name, *trait)
- add_trait(self, name, *trait)
- add_trait_category(cls, category)
- add_trait_listener(self, object, prefix = '')
- all_trait_names(self)
- base_trait(self, name)
- class_default_traits_view(cls)
- class_editable_traits(cls)
- class_trait_names(cls, **metadata)
- class_trait_view(cls, name = None, view_element = None)
- class_trait_view_elements(cls)
- class_traits(cls, **metadata)
- clone_traits(self, traits = None, memo = None, copy = None, **metadata)
- configure_traits(self, filename = None, view = None, kind = None, edit = True, context = None, handler = None, id = '', scrollable = None, **args)
- copy_traits(self, other, traits = None, memo = None, copy = None, **metadata)
- copyable_trait_names(self, **metadata)
- default_traits_view(self)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- has_traits_interface(self, *interfaces)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same', priority = False, deferred = False)
- print_traits(self, show_help = False, **metadata)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- reset_traits(self, traits = None, **metadata)
- set_trait_dispatch_handler(cls, name, klass, override = False)
- sync_trait(self, trait_name, object, alias = None, mutual = True, remove = False)
- trait(self, name, force = False, copy = False)
- trait_context(self)
- trait_get(self, *names, **metadata)
- trait_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- trait_set(self, trait_change_notify = True, **traits)
- trait_setq(self, **traits)
- trait_subclasses(cls, all = False)
- trait_view(self, name = None, view_element = None)
- trait_view_elements(self)
- trait_views(self, klass = None)
- traits(self, **metadata)
- validate_trait(self, name, value)
Methods
- __cmp__(self, other)
- __delitem__(self, name)
- __getitem__(self, name)
- __setitem__(self, name, value)
- bind_dynamic(self, value, trait_name)
Create a dynamic binding to the trait named 'trait_name' on 'value'.
Dynamic bindings maintain the invariant
self[ getattr( value, trait_name ) ] == value
when either 'getattr( value, trait_name )' is changed or when 'value' is renamed within 'self.context_data'. An odd consequence of this is that a dynamically bound value can't be stored under multiple names simultaneously.
Assumes the 'value' and 'getattr( value, trait_name )' domains are disjoint and hashable. (A convenient and probably acceptable restriction.)
See the unit tests for more details.
NOTE: A context with dynamic bindings is (arguably) no longer a dictionary because it might violate substitutability. Consider:
d['a'] = x d['b'] = x assert 'a' in d and 'b' in d
Although we have no set of "mapping object axioms" specifying minimal behavior, I think most users would expect the above assert to always hold for mapping objects, but it can fail if 'd' is a numeric context with a dynamic binding for 'x'.
- contains_context(self, context)
Returns whether a context contains a specified context in its pipeline.
- context_group_for(self, name, names = None)
Gets/Sets the contents of a specified context group.
- copy(self)
- dump_context(self, indent = 0)
- get_context_base(self)
Returns the context base any upstream contexts should use.
- get_context_data(self, name)
Returns the value of a specified item.
- get_context_reference(self, name)
- get_context_undefined(self, name, value)
Sets the value of a currently undefined item.
- get_dotted(self, name)
Get a dotted name that may exist only in a sub-context.
If there are multiple sub-contexts whose names are dot-prefixes of 'name' (e.g. "foo.bar" dot-prefixes "foo.bar.baz"), then the longest valid match wins. If none matches, a KeyError is raised.
- get_mapping_context(self, mode = CreateContext)
Gets a MappingContext associated with the context.
- get_reduction_context(self, mode = CreateContext)
Gets a ReductionContext associated with the context.
- get_selection_context(self, mode = CreateContext)
Gets a SelectionContext associated with the context.
- has_dotted(self, name)
Whether 'get_dotted' would succeed.
- is_valid_array(self, value)
Returns whether a value is of interest to the pipeline.
The pipeline only operates on numeric arrays with non-zero dimension. Different kinds of data simply bypass it.
- keys(self)
- post_context_modified(self, event)
Post a 'context_modified' event.
Calling this method instead of directly assigning to 'context_modified' enables us to defer events.
- post_dict_modified(self, event)
Post a 'dict_modified' event.
Calling this method instead of directly assigning to 'dict_modified' enables us to defer events.
- remove_context(self, context)
Removes a specified context from a context chain.
- set_context_data(self, name, value)
Sets the value of a specified item.
- set_context_undefined(self, name, value)
Sets the value of a currently undefined item.
- set_dotted(self, name, value)
Set a dotted name that may end up in a sub-context.
If there are multiple sub-contexts whose names are dot-prefixes of 'name' (e.g. "foo.bar" dot-prefixes "foo.bar.baz"), then the longest match wins. If no dot-prefix of 'name' is a sub-context, set name=value in this context.