Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions examples/nested_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def MyNode(file):
# o file<> | +--->o file<> | +--->o file<> |
# | file o-----+ | file o-----+ | file o
# +----------------+ +----------------------------+ +----------------+
udpate_db_from_file = Graph(name="udpate_db_from_file")
find_file = MyNode(name="Find File", graph=udpate_db_from_file)
update_db_from_file = Graph(name="update_db_from_file")
find_file = MyNode(name="Find File", graph=update_db_from_file)
values_from_file = MyNode(
name="Read Values from File", graph=udpate_db_from_file
name="Read Values from File", graph=update_db_from_file
)
update_db = MyNode(name="Update DB", graph=udpate_db_from_file)
update_db = MyNode(name="Update DB", graph=update_db_from_file)
find_file.outputs["file"].connect(values_from_file.inputs["file"])
values_from_file.outputs["file"].connect(update_db.inputs["file"])

Expand All @@ -61,7 +61,7 @@ def MyNode(file):
# Now the update_db graph can connect nodes to the fix_file graph
find_file.outputs["file"].connect(fix_file.inputs["file_to_clean"])
fix_file.outputs["clean_file"].connect(
udpate_db_from_file["Read Values from File"].inputs["file"]
update_db_from_file["Read Values from File"].inputs["file"]
)

# Display the graph
Expand All @@ -73,11 +73,17 @@ def MyNode(file):
)

window = QtWidgets.QWidget()
window.setWindowTitle("Flowpipe-Editor Nestd Graphs Example")
window.setWindowTitle("Flowpipe-Editor Nested Graphs Example")
window.resize(1100, 800)

flowpipe_editor_widget = FlowpipeEditorWidget(parent=window)
flowpipe_editor_widget.load_graph(fix_file)

# all nodes in one graph
# flowpipe_editor_widget.load_graph(fix_file)

# using nested sub-graphs
flowpipe_editor_widget.load_subgraphs(update_db_from_file)

layout = QtWidgets.QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(flowpipe_editor_widget)
Expand Down
Loading
Loading