Node and NodeFactory classes.
A Node is generalized functor which is embeded in a dataflow.
A Factory build Node from its description. Factories instantiate
Nodes on demand for the dataflow.
-
exception core.node.InstantiationError[source]
Bases: exceptions.Exception
todo
-
exception core.node.RecursionError[source]
Bases: exceptions.Exception
todo
-
class core.node.AbstractFactory(name, description='', category='', inputs=(), outputs=(), lazy=True, delay=0, view=None, alias=None, authors=None, **kargs)[source]
Bases: openalea.grapheditor.observer.Observed
Abstract Factory is Factory base class
-
clean_files()[source]
Remove files depending of factory
-
copy(**args)[source]
Copy factory
-
get_authors()[source]
returns node authors
if no authors is found within the node, then it takes the authors field
found in its package.
-
get_documentation()[source]
-
get_id()[source]
Returns the node factory Id
-
get_pkg()[source]
todo
-
get_python_name()[source]
Returns a valid python variable as name.
This is used to store the factory into a python list (i.e. __all__).
-
get_tip(asRst=False)[source]
Return the node description
if no authors is found within the node, then it takes the authors field
found in its package.
-
get_writer()[source]
Return the writer class
-
instantiate(call_stack=[])[source]
Return a node instance
Parameters: | call_stack -- the list of NodeFactory id already in call stack
(in order to avoir infinite recursion) |
-
instantiate_widget(node=None, parent=None, edit=False, autonomous=False)[source]
Return the corresponding widget initialised with node
-
is_composite_node()[source]
-
is_data()[source]
-
is_node()[source]
-
is_valid()[source]
Return True if the factory is valid
else raise an exception
-
set_pkg(port)[source]
An openalea package contains factories.
The factory has a link to this package (weakref).
The package id is the name of the package when the package is the
Python object.
-
mimetype = 'openalea/nodefactory'
-
package
todo
-
class core.node.AbstractNode[source]
Bases: openalea.grapheditor.observer.Observed, core.metadatadict.HasAdHoc
An AbstractNode is the atomic entity in a dataflow.
internal_data contains properties specified by users.
They can be extended and the number is not fixed.
We use a dict to distinguish these public properties to the others
which are used for protected management.
-
close()[source]
-
get_factory()[source]
Return the factory of the node (if any)
-
get_id()[source]
-
get_raise_exception()[source]
-
invalidate()[source]
Invalidate Node
-
reload()[source]
Reset Node
-
reset()[source]
Reset Node
-
set_compositenode(upper)[source]
-
set_data(key, value, notify=True)[source]
Set internal node data
-
set_factory(factory)[source]
Set the factory of the node (if any)
-
set_id(id)[source]
-
set_raise_exception(val)[source]
-
mimetype = 'openalea/node'
-
raise_exception
-
class core.node.AbstractPort(vertex)[source]
Bases: dict, openalea.grapheditor.observer.Observed, core.metadatadict.HasAdHoc
The class describing the ports.
AbstractPort is a dict for historical reason.
-
copy_to(other)[source]
-
get_default()[source]
todo
-
get_desc()[source]
Gets default description
-
get_id()[source]
-
get_interface()[source]
Gets the interface
-
get_tip(current_value=None)[source]
Return the tool tip
-
set_id(id)[source]
-
class core.node.Annotation[source]
Bases: core.node.AbstractNode
-
to_script()[source]
Script translation of this node.
-
core.node.Factory
alias of NodeFactory
-
class core.node.FuncNode(inputs, outputs, func)[source]
Bases: core.node.Node
Node with external function or function
-
get_process_obj()[source]
Return the process obj
-
process_obj
Return the process obj
-
class core.node.InputPort(node)[source]
Bases: core.node.AbstractPort
The class describing the input ports
-
get_label()[source]
Gets default label
-
is_hidden()[source]
True if the port should not be displayed.
-
class core.node.Node(inputs=(), outputs=())[source]
Bases: core.node.AbstractNode
It is a callable object with typed inputs and outputs.
Inputs and Outpus are indexed by their position or by a name (str)
-
add_input(**kargs)[source]
Create an input port
-
add_output(**kargs)[source]
Create an output port
-
clear_inputs()[source]
-
clear_outputs()[source]
-
copy_to(other)[source]
-
eval()[source]
Evaluate the node by calling __call__
Return True if the node needs a reevaluation
and a timed delay if the node needs a reevaluation at a later time.
-
get_block()[source]
todo
-
get_caption()[source]
Return the node caption
-
get_delay()[source]
todo
-
get_input(index_key)[source]
Return the input value for the specified index/key
-
get_input_port(name=None)[source]
Gets port by name.
Long description of the function functionality.
Parameters: | name (string) -- the name of the port |
Returns: | Input port characterized by name |
Return type: | InputPort |
-
get_input_state(index_key)[source]
-
get_lazy()[source]
todo
-
get_nb_input()[source]
Return the nb of input ports
-
get_nb_output()[source]
Return the nb of output ports
-
get_output(index_key)[source]
Return the output for the specified index/key
-
get_process_obj()[source]
Return the process obj
-
get_tip()[source]
-
get_user_application()[source]
todo
-
invalidate()[source]
Invalidate node
-
static is_deprecated_event(event)[source]
-
is_port_hidden(index_key)[source]
Return the hidden state of a port
-
notify_listeners(event)[source]
-
output(key)[source]
-
reload()[source]
Reset ports
-
reset()[source]
Reset ports
-
set_block(data)[source]
todo
-
set_caption(newcaption)[source]
Define the node caption
-
set_delay(delay)[source]
todo
-
set_factory(factory)[source]
Set the factory of the node (if any)
and uptdate caption
-
set_input(key, val=None, notify=True)[source]
Define the input value for the specified index/key
-
set_input_state(index_key, state)[source]
Set the state of the input index/key (state is a string)
-
set_io(inputs, outputs)[source]
Define the number of inputs and outputs
Parameters: |
- inputs -- list of dict(name='X', interface=IFloat, value=0)
- outputs -- list of dict(name='X', interface=IFloat)
|
-
set_lazy(data)[source]
todo
-
set_output(key, val)[source]
Define the input value for the specified index/key
-
set_port_hidden(index_key, state)[source]
Set the hidden state of a port.
Parameters: |
- index_key -- the input port index.
- state -- a boolean value.
|
-
set_user_application(data)[source]
todo
-
to_script()[source]
Script translation of this node.
-
unvalidate_input(index_key, notify=True)[source]
Unvalidate node and notify listeners.
This method is called when the input value has changed.
-
block
todo
-
caption
Return the node caption
-
delay
todo
-
lazy
todo
-
process_obj
Return the process obj
-
user_application
todo
-
class core.node.NodeFactory(name, description='', category='', inputs=None, outputs=None, nodemodule='', nodeclass=None, widgetmodule=None, widgetclass=None, search_path=None, authors=None, **kargs)[source]
Bases: core.node.AbstractFactory
A Node factory is able to create nodes on demand,
and their associated widgets.
-
apply_new_src(newsrc)[source]
Execute new src and store the source into the factory.
-
copy(**args)[source]
Copy factory
:param path: new search path
-
get_classobj()[source]
-
get_documentation()[source]
-
get_node_file()[source]
Return the path of the python module.
-
get_node_module()[source]
Return the python module object (if available)
Raise an Import Error if no module is associated
-
get_node_src(cache=True)[source]
Return a string containing the node src
Return None if src is not available
If cache is False, return the source on the disk
-
get_python_name()[source]
Return a python valid name
-
get_writer()[source]
Return the writer class
-
instantiate(call_stack=[])[source]
Returns a node instance.
:param call_stack: the list of NodeFactory id already in call stack
(in order to avoir infinite recursion)
-
instantiate_widget(node=None, parent=None, edit=False, autonomous=False)[source]
Return the corresponding widget initialised with node
-
is_node()[source]
-
save_new_src(newsrc)[source]
Execute the new source and replace the text into the old file
containing the source.
-
class core.node.OutputPort(node)[source]
Bases: core.node.AbstractPort
The class describing the output ports
-
class core.node.PyNodeFactoryWriter(factory)[source]
Bases: object
NodeFactory python Writer
-
nodefactory_template = '\n\n$NAME = Factory(name=$PNAME,\n authors=$AUTHORS,\n description=$DESCRIPTION,\n category=$CATEGORY,\n nodemodule=$NODEMODULE,\n nodeclass=$NODECLASS,\n inputs=$LISTIN,\n outputs=$LISTOUT,\n widgetmodule=$WIDGETMODULE,\n widgetclass=$WIDGETCLASS,\n )\n\n'
-
core.node.Alias(factory, name)[source]
Create a alias for factory
-
core.node.gen_port_list(size)[source]
Generate a list of port description
-
core.node.initialise_standard_metadata()[source]
Declares the standard keys used by the Node structures. Called at the end of this file