def __init__(self, *args, **kargs): """ CompositeNodeFactory accept more optional parameters: - inputs: list of dict(name = '', interface='', value='') - outputs: list of dict(name = '', interface='', value='') - doc: documentation - elt_factory: map of elements with its corresponding factory - elt_connections: map of ( dst_id , input_port ):(src_id,output_port) - elt_data: Dictionary containing associated data - elt_value: Dictionary containing Lists of 2-uples (port, value) """ # Init parent (name, description, category, doc, node, widget=None) AbstractFactory.__init__(self, *args, **kargs) # A CompositeNode is composed by a set of element indexed by an elt_id # Each element is associated to NodeFactory # Each element will generate an node instance in the real CompositeNode # Dict mapping elt_id with its corresponding factory # the factory is identified by its unique id (package_id, factory_id) self.elt_factory = kargs.get("elt_factory", {}) # Dictionnary which contains tuples describing connection # ( source_vid , source_port ) : ( target_vid, target_port ) self.connections = kargs.get("elt_connections", {}) self.elt_data = kargs.get("elt_data", {}) self.elt_value = kargs.get("elt_value", {}) self.elt_ad_hoc = kargs.get("elt_ad_hoc", {}) from openalea.core.algo.dataflow_evaluation import DefaultEvaluation self.eval_algo = kargs.get("eval_algo", DefaultEvaluation.__name__) # Documentation self.doc = kargs.get('doc', "") self.__doc__ = self.doc
def __init__(self, name, description='', editors=None, includes=None, **kargs): """ name : filename description : file description editors : dictionnary listing external command to execute includes : List of data files that are included in the file. """ AbstractFactory.__init__(self, name, description, category='data', **kargs) self.pkgdata_cache = None self.editors = editors self.includes = includes
def copy(self, **args): """ Copy factory. :param path: new search path :param replace_pkg: old and new package names. When replace package is set, change the package id for all the elt factories. """ ret = AbstractFactory.copy(self, **args) # Replace old pkg name to new pkg name (old_pkg, new_pkg) = args['replace_pkg'] for k, v in ret.elt_factory.iteritems(): pkg_id, factory_id = v if(pkg_id == old_pkg.get_id()): pkg_id = new_pkg.get_id() ret.elt_factory[k] = pkg_id, factory_id return ret
def copy(self, **args): """ Copy factory. :param path: new search path :param replace_pkg: old and new package names. When replace package is set, change the package id for all the elt factories. """ ret = AbstractFactory.copy(self, **args) # Replace old pkg name to new pkg name (old_pkg, new_pkg) = args['replace_pkg'] for k, v in ret.elt_factory.iteritems(): pkg_id, factory_id = v if (pkg_id == old_pkg.get_id()): pkg_id = new_pkg.get_id() ret.elt_factory[k] = pkg_id, factory_id return ret