pyiron/ironflow

Feature request: New node type with display data

Closed this issue · 2 comments

Make a new node class, similar to DualNodeBase that holds data to be displayed in GUI.out_plot. Similar to DualNodeBase this has some internally stored value, a representation, that can be sent to the gui's output display -- e.g. a matplotlib plot, an nglview figure, or even just text. This should be sent whenever you click a show button on the node, and as long as this node was the last one sent to the output display, the display should get updated whenever the node's input gets updated.

We already mostly have this as of #30, but we can pare down some of the stuff from DualNodeBase -- e.g. plotting can just be a leaf, we never need output from it -- and the exec input can be replaced with a show button.

Then this functionality can be inherited in many more pyiron nodes, and hopefully we can depend on pyiron_gui and just grab representations from there.

I thought more about it, and I think this should really be the base behaviour for pyiron nodes. They should all internally have a representation attribute (abstract method on the ABC). The node widget should look for the existence of this attribute, and if it's there provide a toggle to lock the display. Then the GUI can track the selected node (already done) and if the currently displayed node is not locked, then the selected node is displayed. So now "show" button, but rather a "lock display" toggle, and automatically display selected pyiron nodes in the absence of any locking. (And of course locking a new node automatically looks to the GUI to see who (if any) is locked and un-lock them.)

Resolved in #33