class documentation

class MultiContext(ListenableMixin, PersistableMixin, DictMixin): (source)

View In Hierarchy

Wrap several subcontexts.

Method __contains__ Undocumented
Method __delitem__ Remove the given key with [] access.
Method __getitem__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __repr__ Undocumented
Method __setitem__ Set item with [] access.
Method __str__ Undocumented
Method allows Undocumented
Method checkpoint Make a shallow copy of the context.
Method keys Undocumented
Method subcontexts_items_modified Pass events up.
Class Variable name Undocumented
Class Variable subcontexts Undocumented
Class Variable veto_subcontext_modified Undocumented
Method _subcontexts_items_changed Trait listener for items of subcontexts list.

Inherited from ListenableMixin:

Method deferred_events Context manager that sets defer_events to False
Instance Variable defer_events Undocumented
Method _add_deferred_event Defer this event.
Method _defer_events_changed Undocumented
Method _defer_events_changed_refire Undocumented
Method _fire_event Fire an ItemsModifiedEvent.
Class Variable _deferred_events Undocumented

Inherited from PersistableMixin:

Static Method load Unpickle the context from a file
Method save Pickle the data context out to a file
def __contains__(self, key): (source)

Undocumented

def __delitem__(self, key): (source)

Remove the given key with [] access. Only deletes the first instance of the key. Parameters ---------- key : str Raises ------ KeyError if the kew is not available in the context.

def __getitem__(self, key): (source)

Undocumented

def __init__(self, *subcontexts, **traits): (source)

Undocumented

def __iter__(self): (source)

Undocumented

def __len__(self): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def __setitem__(self, key, value): (source)

Set item with [] access. The first subcontext which allows the key/value pair will get it. If an earlier subcontext has the key, but does not allow the assignment, then that key will be deleted. Later contexts with the key will be untouched. If the key/value pair cannot be assigned to anything, no deletion will take place. Parameters ---------- key : str value : object Raises ------ ValueError if the key is not permitted to be assigned that value.

def __str__(self): (source)

Undocumented

def allows(self, value, name=None): (source)

Undocumented

def checkpoint(self): (source)

Make a shallow copy of the context. Technically, this is actually a fairly deep copy. All of the object structure should be replicated, but the actual dictionary storage will be shallowly copied:: copy = context.shallow_copy() copy[key] is context[key] for key in context.keys() These semantics are useful for saving out checkpointed versions of the context for implementing an undo/redo stack. They may not be useful for other purposes. Returns ------- copy : IContext

def keys(self): (source)

Undocumented

@on_trait_change('subcontexts:items_modified')
def subcontexts_items_modified(self, event): (source)

Pass events up.

name = (source)

Undocumented

subcontexts = (source)

Undocumented

veto_subcontext_modified = (source)

Undocumented

def _subcontexts_items_changed(self, event): (source)

Trait listener for items of subcontexts list.