Updated flowchart documentation
This commit is contained in:
parent
5786a627b5
commit
60836462d2
@ -23,6 +23,7 @@ Contents:
|
|||||||
exporting
|
exporting
|
||||||
prototyping
|
prototyping
|
||||||
parametertree/index
|
parametertree/index
|
||||||
|
flowchart/index
|
||||||
internals
|
internals
|
||||||
apireference
|
apireference
|
||||||
|
|
||||||
|
@ -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.
|
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
|
Graphical Canvas
|
||||||
----------------
|
----------------
|
||||||
|
@ -113,8 +113,11 @@ class Flowchart(Node):
|
|||||||
self.inputNode.setOutput(**args)
|
self.inputNode.setOutput(**args)
|
||||||
|
|
||||||
def outputChanged(self):
|
def outputChanged(self):
|
||||||
self.widget().outputChanged(self.outputNode.inputValues())
|
## called when output of internal node has changed
|
||||||
self.sigOutputChanged.emit(self)
|
vals = self.outputNode.inputValues()
|
||||||
|
self.widget().outputChanged(vals)
|
||||||
|
self.setOutput(**vals)
|
||||||
|
#self.sigOutputChanged.emit(self)
|
||||||
|
|
||||||
def output(self):
|
def output(self):
|
||||||
return self.outputNode.inputValues()
|
return self.outputNode.inputValues()
|
||||||
@ -261,7 +264,9 @@ class Flowchart(Node):
|
|||||||
def process(self, **args):
|
def process(self, **args):
|
||||||
"""
|
"""
|
||||||
Process data through the flowchart, returning the output.
|
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
|
data = {} ## Stores terminal:value pairs
|
||||||
|
@ -229,7 +229,11 @@ class Node(QtCore.QObject):
|
|||||||
return "<Node %s @%x>" % (self.name(), id(self))
|
return "<Node %s @%x>" % (self.name(), id(self))
|
||||||
|
|
||||||
def ctrlWidget(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
|
return None
|
||||||
|
|
||||||
def bypass(self, byp):
|
def bypass(self, byp):
|
||||||
|
Loading…
Reference in New Issue
Block a user