Removes all nodes, connections, and groups from the scene.
(self)
| 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 |