ironflow.model.node module
- class ironflow.model.node.Node(params)[source]
Bases:
NodeA parent class for all ironflow nodes. Apart from a small quality-of-life difference where outputs are accessible in the same way as inputs (i.e. with a method output(i)), the main change here is the before_update and after_update events. Callbacks to happen before and after the update can be added to (removed from) these with the connect (disconnect) methods on the event. Such callbacks need to take the node itself as the first argument, and the integer specifying which input channel is being updated as the second argument.
Also provides a “representation” that gets used in the GUI to give a more detailed look at node data, which defaults to showing output channel values.
Children should specify a title and some combination of initial input, output, and what to do when updated, e.g.:
>>> class My_Node(Node): >>> title = "MyUserNode" >>> init_inputs = [ >>> NodeInputBP(dtype=dtypes.Integer(default=1), label="foo") >>> ] >>> init_outputs = [ >>> NodeOutputBP(label="bar") >>> ] >>> color = 'cyan' >>> >>> def update_event(self, inp=-1): >>> self.set_output_val(0, self.input(0) + 42)
Note
When registering nodes from a module or .py file, only children of this class with names ending in _Node will get registered.
- color = '#ff69b4'
- main_widget_class
alias of
NodeWidget
- place_event()[source]
place_event() is called once the node object has been fully initialized and placed in the flow. When loading content, place_event() is executed before the connections are built, which is important for nodes that need to update once and, during this process, set output data values, to prevent later connected (potentially sequential) nodes from receiving false updates because of that. Notice that this method gets executed every time the node is added to the flow, which can happen multiple times for the same object, for example due to undo/redo operations. Also note that GUI content is usually not accessible yet from here, for that use view_place_event().
- property representations: dict