|
2 | 2 |
|
3 | 3 | from pathlib import Path |
4 | 4 |
|
5 | | -from flowpipe import Graph |
| 5 | +from flowpipe import Graph, INode |
6 | 6 | from NodeGraphQt import BaseNode, NodeGraph |
7 | 7 |
|
8 | 8 | # pylint: disable=no-name-in-module |
@@ -46,7 +46,6 @@ def __init__( |
46 | 46 | """ |
47 | 47 | super().__init__(parent) |
48 | 48 |
|
49 | | - # apply_dark_theme(properties_bin) |
50 | 49 | self.setLayout(QtWidgets.QHBoxLayout(self)) |
51 | 50 |
|
52 | 51 | # Create a horizontal splitter (left/right layout) |
@@ -117,10 +116,16 @@ def clear(self): |
117 | 116 | """Clear the graph and reset the flowpipe graph.""" |
118 | 117 | self.flowpipe_graph = Graph() |
119 | 118 | self.graph.clear_session() |
120 | | - self.node_deselected() |
121 | 119 |
|
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 | + """ |
124 | 129 | qt_node = self.graph.create_node( |
125 | 130 | "flowpipe.FlowpipeNode", |
126 | 131 | name=fp_node.name, |
@@ -156,8 +161,9 @@ def load_graph(self, graph: Graph): |
156 | 161 | """Load a Flowpipe graph into the editor widget. |
157 | 162 |
|
158 | 163 | Args: |
159 | | - graph (Graph): Flowpipe graph to load. |
| 164 | + graph (Graph): Flowpipe graph to load |
160 | 165 | """ |
| 166 | + self.clear() |
161 | 167 | self.flowpipe_graph = graph |
162 | 168 | x_pos = 0 |
163 | 169 | for row in graph.evaluation_matrix: |
|
0 commit comments