MCPcopy Index your code
hub / github.com/bhowiebkr/PyFlowGraph / clear_graph

Method clear_graph

src/core/node_graph.py:96–112  ·  view source on GitHub ↗

Removes all nodes, connections, and groups from the scene.

(self)

Source from the content-addressed store, hash-verified

94 return self.command_history.get_redo_description()
95
96 def clear_graph(self):
97 """Removes all nodes, connections, and groups from the scene."""
98 # Remove all connections first
99 for connection in list(self.connections):
100 self.remove_connection(connection, use_command=False)
101
102 # Remove all nodes directly (bypass command pattern for clearing)
103 for node in list(self.nodes):
104 self.remove_node(node, use_command=False)
105
106 # Remove all groups
107 if hasattr(self, 'groups'):
108 for group in list(self.groups):
109 self.removeItem(group)
110 self.groups.clear()
111
112 self.update()
113
114 def keyPressEvent(self, event: QKeyEvent):
115 # Handle undo/redo shortcuts

Callers 15

deserializeMethod · 0.95
new_sceneMethod · 0.80
test_user_scenarioFunction · 0.80
tearDownMethod · 0.80
tearDownMethod · 0.80
tearDownMethod · 0.80
test_user_scenarioFunction · 0.80
setUpMethod · 0.80
setup_methodMethod · 0.80
test_reroute_undo_redoFunction · 0.80

Calls 3

remove_connectionMethod · 0.95
remove_nodeMethod · 0.95
clearMethod · 0.80

Tested by 15

test_user_scenarioFunction · 0.64
tearDownMethod · 0.64
tearDownMethod · 0.64
tearDownMethod · 0.64
test_user_scenarioFunction · 0.64
setUpMethod · 0.64
setup_methodMethod · 0.64
test_reroute_undo_redoFunction · 0.64
test_reroute_redoFunction · 0.64