def activate(cls): """ Add this component to the active toolkit. """ tk = Toolkit.active_toolkit() cons = tk['EnableCanvas'].clone(shell_loader=lambda:cls) tk[cls.__name__] = cons
def __init__(self, thumbs=None): """ Initialize a ThumbnailModel Parameters ---------- thumbs : list, optional An initial list of Thumbnail objects to be used by the model. """ self._thumbs = thumbs[:] if thumbs is not None else [] self._toolkit = Toolkit.active_toolkit() self._icon_cls = self._toolkit['Icon']
def __enaml_call__(cls, identifiers=None, toolkit=None): """ Instantiate the shell class and load its abstract object. """ if identifiers is None: identifiers = {} if toolkit is None: toolkit = Toolkit.active_toolkit() # Look up the toolkit prefixes. file_prefix, class_prefix = cls.__get_toolkit_prefixes(toolkit) shell_obj = cls() abstract_obj = cls.__load_abstract_obj(file_prefix, class_prefix) shell_obj.abstract_obj = abstract_obj abstract_obj.shell_obj = shell_obj shell_obj.toolkit = toolkit shell_obj._bases.insert(0, cls) return shell_obj