diff --git a/doc/source/index.rst b/doc/source/index.rst index 7a1a77e9051af06a1359bfaf0d6e6169f5d2d6ea..9727aaab8fc92f5a6d686a9640832ec5fab75825 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -23,6 +23,7 @@ Contents: exporting prototyping parametertree/index + flowchart/index internals apireference diff --git a/doc/source/prototyping.rst b/doc/source/prototyping.rst index 63815a086c99a8eb79ba6b6ddbbae142259a5c51..e8dffb6607ece6368febcf0d008b8607b0479157 100644 --- a/doc/source/prototyping.rst +++ b/doc/source/prototyping.rst @@ -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 ---------------- diff --git a/pyqtgraph/flowchart/Flowchart.py b/pyqtgraph/flowchart/Flowchart.py index 6b1352d5cd5696aa790b83f78c11c24d03b8dde2..5d7dc093d7ca904f948f683e9148b3708734b24a 100644 --- a/pyqtgraph/flowchart/Flowchart.py +++ b/pyqtgraph/flowchart/Flowchart.py @@ -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 diff --git a/pyqtgraph/flowchart/Node.py b/pyqtgraph/flowchart/Node.py index e6e98d1af8a192fbced9991397d03aea181baf5a..cd73b42ba149cd0f6552864e4c63d808c74dfd8f 100644 --- a/pyqtgraph/flowchart/Node.py +++ b/pyqtgraph/flowchart/Node.py @@ -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):