Skip to content

Commit 7cc5cca

Browse files
clear grpah before loading a differnt graph since the flowpipe_graph member is overwritten eitehr way
closes #11
1 parent 94aed67 commit 7cc5cca

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

flowpipe_editor/flowpipe_editor_widget.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from pathlib import Path
44

5-
from flowpipe import Graph
5+
from flowpipe import Graph, INode
66
from NodeGraphQt import BaseNode, NodeGraph
77

88
# pylint: disable=no-name-in-module
@@ -46,7 +46,6 @@ def __init__(
4646
"""
4747
super().__init__(parent)
4848

49-
# apply_dark_theme(properties_bin)
5049
self.setLayout(QtWidgets.QHBoxLayout(self))
5150

5251
# Create a horizontal splitter (left/right layout)
@@ -117,10 +116,16 @@ def clear(self):
117116
"""Clear the graph and reset the flowpipe graph."""
118117
self.flowpipe_graph = Graph()
119118
self.graph.clear_session()
120-
self.node_deselected()
121119

122-
def _add_node(self, fp_node, point):
123-
"""Helper function to add a Flowpipe node to the graph."""
120+
def _add_node(self, fp_node: INode, point: QtCore.QPoint) -> BaseNode:
121+
"""Helper function to add a Flowpipe node to the graph.
122+
123+
Args:
124+
fp_node (INode): Flowpipe node to add
125+
point (QtCore.QPoint): Position to place the node in the graph
126+
Returns:
127+
BaseNode: The created NodegraphQT Node instance
128+
"""
124129
qt_node = self.graph.create_node(
125130
"flowpipe.FlowpipeNode",
126131
name=fp_node.name,
@@ -156,8 +161,9 @@ def load_graph(self, graph: Graph):
156161
"""Load a Flowpipe graph into the editor widget.
157162
158163
Args:
159-
graph (Graph): Flowpipe graph to load.
164+
graph (Graph): Flowpipe graph to load
160165
"""
166+
self.clear()
161167
self.flowpipe_graph = graph
162168
x_pos = 0
163169
for row in graph.evaluation_matrix:

0 commit comments

Comments
 (0)