klauer / qtpynodeeditor

Python Qt NodeEditor (qtpy, PyQt5, PySide)
https://klauer.github.io/qtpynodeeditor/
Other
192 stars 54 forks source link

Using a widget value inside the nodes compute method #56

Closed nexusuk closed 1 year ago

nexusuk commented 1 year ago

I can see from the calculator example how a nodes widget (e.g. the QLineEdit widget in NumberSourceDataModel) can output data 'downstream' in the nodegraph via the data_updated signal and subsequent call to the out_data() method. However, this process does not involve rerunning the nodes compute() method when a widget is updated and forces all node input variables to be additional nodes in the tree.

If I want to have a nodes widget play a part in the computation of the result (e.g. a 'math' node with 2 inputs connections and a QCombo box for selecting the math operation) what is a suitable approach? Move the computation of the result to the out_data() method and have an empty compute() method?