A CompositeNode is a Node that contains other nodes connected in a directed
graph. A CompositeNodeFactory instance is a factory that build CompositeNode
instances. Different instances of the same factory can coexist and can be
modified in a dataflow.
-
exception core.compositenode.IncompatibleNodeError[source]
Bases: exceptions.Exception
todo
-
class core.compositenode.CompositeNode(inputs=(), outputs=())[source]
Bases: openalea.core.node.Node, openalea.core.dataflow.DataFlow
The CompositeNode is a container that interconnect
different node instances between them in directed graph.
-
add_node(node, vid=None, modify=True)[source]
Add a node in the Graph with a particular id
if id is None, autogenrate one
Parameters: |
- node -- the node instance
- vid -- element id
|
Returns: | the id
|
-
close()[source]
-
compute_external_io(vertex_selection, new_vid)[source]
Return the list of input and output edges to connect the composite
node.
-
compute_io(v_list=None)[source]
Return (inputs, outputs, connections)
representing the free port of node
v_list is a vertex id list
-
connect(src_id, port_src, dst_id, port_dst)[source]
Connect 2 elements
Parameters: |
- src_id -- source node id
- port_src -- source output port number
- dst_id -- destination node id
- port_dst -- destination input port number
|
-
copy_to(other)[source]
-
disconnect(src_id, port_src, dst_id, port_dst)[source]
Deconnect 2 elements
Parameters: |
- src_id -- source node id
- port_src -- source output port number
- dst_id -- destination node id
- port_dst -- destination input port number
|
-
eval(*args, **kwds)[source]
Evaluate the graph
Return True if the node need a reevaluation (like generator)
-
eval_as_expression(vtx_id=None, step=False)[source]
Evaluate a vtx_id
if node_id is None, then all the nodes without sons are evaluated
-
get_eval_algo()[source]
Return the evaluation algo instance
-
get_input(index_key)[source]
Return the composite node input
-
get_output(index_key)[source]
Retrieve values from output node input ports
-
invalidate()[source]
Invalidate nodes
-
node(vid)[source]
Convenience function
-
notify_vertex_addition(vertex, vid=None)[source]
-
notify_vertex_removal(vertex)[source]
-
remove_edge(eid)[source]
-
remove_node(vtx_id)[source]
remove a node from the graph
:param vtx_id: element id
-
replace_node(vid, newnode)[source]
Replace the node vid by newnode
-
reset()[source]
Reset nodes
-
set_continuous_eval(vid, state=True)[source]
set vid as a continuous evaluated node
-
set_input(index_key, val=None, *args)[source]
Copy val into input node output ports
-
set_io(inputs, outputs)[source]
Define inputs and outputs
Inputs and outputs are list of dict(name='', interface='', value='')
-
set_output(index_key, val)[source]
Set a value to an output
-
simulate_destruction_notifications()[source]
emits messages as if we were adding elements to
the composite node
-
to_factory(sgfactory, listid=None, auto_io=False)[source]
Update CompositeNodeFactory to fit with the graph
listid is a list of element to export. If None, select all id.
if auto_io is true : inputs and outputs are connected to the free
ports
-
to_script()[source]
Translate the dataflow into a python script.
-
update_eval_listeners(vid)[source]
Update continuous evaluation listener for node vid
-
mimetype = 'openalea/compositenode'
-
class core.compositenode.CompositeNodeFactory(*args, **kargs)[source]
Bases: openalea.core.node.AbstractFactory
-
clear()[source]
todo
-
copy(**args)[source]
Copy factory.
Parameters: |
- path -- new search path
- replace_pkg -- old and new package names.
|
When replace package is set, change the package id for all the
elt factories.
-
create_fake_node(vid)[source]
Return an empty node with the correct number of inputs
and output
-
get_documentation()[source]
-
get_writer()[source]
Return the writer class
-
instantiate(call_stack=None)[source]
Create a CompositeNode instance and allocate all elements
This function overide default implementation of NodeFactory
Parameters: | call_stack -- the list of NodeFactory id already in recursion stack (in order to avoid infinite loop) |
-
instantiate_node(vid, call_stack=None)[source]
Partial instantiation
instantiate only elt_id in CompositeNode
Parameters: | call_stack -- a list of parent id (to avoid infinite recursion) |
-
instantiate_widget(node=None, parent=None, edit=False, autonomous=False)[source]
Return the corresponding widget initialised with node
If node is None, the node is allocated else a composite
widget composed with the node sub widget is returned.
-
is_composite_node()[source]
-
load_ad_hoc_data(node, elt_data, elt_ad_hoc=None)[source]
-
paste(cnode, data_modifiers=, []call_stack=None, meta=False)[source]
Paste to an existing CompositeNode instance
Parameters: |
- cnode -- composite node instance
- data_modifiers -- list of 2-uple (key, function) to apply
to internal data (for instance to move the node)
- call_stack -- the list of NodeFactory id already in recursion
stack (in order to avoid infinite loop)
|
Returns: | the list of created id
|
-
mimetype = 'openalea/compositenodefactory'
The CompositeNodeFactory is able to create CompositeNode instances
Each node has an unique id : the element id (elt_id)
-
class core.compositenode.CompositeNodeInput(inputs)[source]
Bases: openalea.core.node.Node
Dummy node to represent the composite node inputs
-
eval()[source]
-
get_input(input_pid)[source]
Return the input value
-
set_input(input_pid, val=None, *args)[source]
Define input value
-
to_script()[source]
-
class core.compositenode.CompositeNodeOutput(outputs)[source]
Bases: openalea.core.node.Node
Dummy node to represent the composite node outputs
-
eval()[source]
-
get_output(output_pid)[source]
Return Output value
-
set_output(output_pid, val)[source]
Define output
-
to_script()[source]
-
class core.compositenode.ContinuousEvalListener(dataflow, vid)[source]
Bases: openalea.grapheditor.observer.AbstractListener
When notified this listener reexecute a dataflow on a particular vid)
-
notify(sender, event)[source]
Notification
-
class core.compositenode.JSONCNFactoryWriter(factory)[source]
Bases: core.compositenode.PyCNFactoryWriter
-
class core.compositenode.PyCNFactoryWriter(factory)[source]
Bases: object
CompositeNodeFactory python Writer
-
pprint_repr(obj, indent=3)[source]
Pretty print repr
-
sgfactory_template = '\n\n$NAME = CompositeNodeFactory(name=$PNAME,\n description=$DESCRIPTION,\n category=$CATEGORY,\n doc=$DOC,\n inputs=$INPUTS,\n outputs=$OUTPUTS,\n elt_factory=$ELT_FACTORY,\n elt_connections=$ELT_CONNECTIONS,\n elt_data=$ELT_DATA,\n elt_value=$ELT_VALUE,\n elt_ad_hoc=$ELT_AD_HOC,\n lazy=$LAZY,\n eval_algo=$EVALALGO,\n )\n\n'