Updated flowchart documentation

This commit is contained in:
Luke Campagnola 2013-01-07 10:45:03 -05:00
parent 5786a627b5
commit 60836462d2
4 changed files with 15 additions and 11 deletions

View File

@ -23,6 +23,7 @@ Contents:
exporting
prototyping
parametertree/index
flowchart/index
internals
apireference

View File

@ -18,14 +18,8 @@ Visual Programming Flowcharts
Pyqtgraph's flowcharts provide a visual programming environment similar in concept to LabView--functional modules are added to a flowchart and connected by wires to define a more complex and arbitrarily configurable algorithm. A small number of predefined modules (called Nodes) are included with pyqtgraph, but most flowchart developers will want to define their own library of Nodes. At their core, the Nodes are little more than 1) a Python function 2) a list of input/output terminals, and 3) an optional widget providing a control panel for the Node. Nodes may transmit/receive any type of Python object via their terminals.
One major limitation of flowcharts is that there is no mechanism for looping within a flowchart. (however individual Nodes may contain loops (they may contain any Python code at all), and an entire flowchart may be executed from within a loop).
See the `flowchart documentation <flowchart>`_ and the flowchart examples for more information.
There are two distinct modes of executing the code in a flowchart:
1. Provide data to the input terminals of the flowchart. This method is slower and will provide a graphical representation of the data as it passes through the flowchart. This is useful for debugging as it allows the user to inspect the data at each terminal and see where exceptions occurred within the flowchart.
2. Call Flowchart.process. This method does not update the displayed state of the flowchart and only retains the state of each terminal as long as it is needed. Additionally, Nodes which do not contribute to the output values of the flowchart (such as plotting nodes) are ignored. This mode allows for faster processing of large data sets and avoids memory issues which can occur if doo much data is present in the flowchart at once (e.g., when processing image data through several stages).
See the flowchart example for more information.
Graphical Canvas
----------------

View File

@ -113,8 +113,11 @@ class Flowchart(Node):
self.inputNode.setOutput(**args)
def outputChanged(self):
self.widget().outputChanged(self.outputNode.inputValues())
self.sigOutputChanged.emit(self)
## called when output of internal node has changed
vals = self.outputNode.inputValues()
self.widget().outputChanged(vals)
self.setOutput(**vals)
#self.sigOutputChanged.emit(self)
def output(self):
return self.outputNode.inputValues()
@ -261,7 +264,9 @@ class Flowchart(Node):
def process(self, **args):
"""
Process data through the flowchart, returning the output.
Keyword arguments must be the names of input terminals
Keyword arguments must be the names of input terminals.
The return value is a dict with one key per output terminal.
"""
data = {} ## Stores terminal:value pairs

View File

@ -229,7 +229,11 @@ class Node(QtCore.QObject):
return "<Node %s @%x>" % (self.name(), id(self))
def ctrlWidget(self):
"""Return this Node's control widget."""
"""Return this Node's control widget.
By default, Nodes have no control widget. Subclasses may reimplement this
method to provide a custom widget. This method is called by Flowcharts
when they are constructing their Node list."""
return None
def bypass(self, byp):