ironflow.gui.gui module

Top-level objects for getting the front and back end (and various parts of the front end) to talk to each other.

class ironflow.gui.gui.GUI(*args, **kwargs)[source]

Bases: HasSession, DrawsWidgets

The main ironflow object, connecting a ryven backend with a jupyter-friendly ipywidgets+ipycanvas frontend.

draw()[source]

Build the ipywidget to interact with.

register_user_node()

Register with ironflow a new node from the current python process.

build_recommendations(port: NodeInput | NodeOutput)[source]
clear_recommendations()[source]
close()[source]

Call clear, then delete all widgets instantiated in init.

create_script(title: str | None = None, create_default_logs: bool = True, data: dict | None = None) None[source]
draw()[source]
load_from_data(data: dict) None[source]
log_to_display()[source]
log_to_stdout()[source]
main_widget_class

alias of Tab

property new_node_class
register_node(node_class: Type[Node], node_group: str | None = None)[source]

Registers a node class with the ryven session and model, storing it in nodes_dictionary. Some node attributes (identifier_prefix and type_) are also set on the Node class.

Parameters:
  • node_class (Type[Node]) – The node class to register.

  • node_group (str | None) – The sub-collection to which this node belongs. (Default is None, which uses the last bit of the module path.)

Note: The sub-collection in the nodes_dictionary to which the node gets added depends only on the tail of its

module path, so it is possible that nodes from two different sources get grouped together. In case this leads to a conflict, node_module can be explicitly provided and this will be used instead.

Note: You can re-register a class to update its functionality, but only newly placed nodes will see this

update. Already-placed nodes are still instances of the old class and need to be deleted.

Note: You can save the graph as normal, but new gui instances will need to register the same custom nodes before

loading the saved graph is possible.

Example

>>> from ironflow import GUI
>>> from ironflow.node_tools import Node, NodeInputBP, NodeOutputBP, dtypes, input_widgets
>>> gui = GUI(script_title='foo')
>>>
>>> class MyNode(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)
>>>
>>> gui.register_node(MyNode)
property selected_node: Node | None
serialize() dict[source]