class documentation

class TraitslikeContextWrapper(HasTraits): (source)

View In Hierarchy

Wrap a context with traits, primarily for use with Traits UI.

Method add_traits Add a set of traits to this object.
Method _anytrait_changed Undocumented
Method _context_changed Undocumented
Method _context_items_modified Receive change notifications from the context.
Method _in_context_trait_changed Generic trait change handler to propogate mirrored trait changes into the context.
Method _in_context_traits Return a list of names of all of the traits which mirror context variables.
Method _synch_off Undocumented
Class Variable _context Undocumented
Instance Variable _synched Undocumented
def add_traits(self, *args, **kwds): (source)

Add a set of traits to this object. Each trait corresponds to a name in the context. Each CTrait which is added will have .in_context metadata attribute as True. Parameters ---------- ``*args`` : strs These attributes will be created as Any traits. ``**kwds`` : str -> Trait These attributes will be created as the specified Traits. Example ------- >>> from traits.api import Int >>> from codetools.contexts.traitslike_context_wrapper import TraitsLikeContextWrapper >>> tcw = TraitsLikeContextWrapper(_context={}) >>> tcw.add_traits('a', 'b', c=Int)

def _anytrait_changed(self, name, old, new): (source)

Undocumented

@on_trait_change('_context')
def _context_changed(self, object, name, old, new): (source)

Undocumented

def _context_items_modified(self, event): (source)

Receive change notifications from the context.

def _in_context_trait_changed(self, name, new): (source)

Generic trait change handler to propogate mirrored trait changes into the context.

def _in_context_traits(self): (source)

Return a list of names of all of the traits which mirror context variables.

@contextmanager
def _synch_off(self): (source)

Undocumented

_context = (source)

Undocumented

_synched = (source)

Undocumented