Serializes all nodes, connections, and groups.
(self)
| 365 | return clipboard_data |
| 366 | |
| 367 | def serialize(self): |
| 368 | """Serializes all nodes, connections, and groups.""" |
| 369 | nodes_data = [node.serialize() for node in self.nodes] |
| 370 | connections_data = [conn.serialize() for conn in self.connections if conn.serialize()] |
| 371 | groups_data = [group.serialize() for group in self.groups] if hasattr(self, 'groups') else [] |
| 372 | return { |
| 373 | "graph_title": self.graph_title, |
| 374 | "graph_description": self.graph_description, |
| 375 | "nodes": nodes_data, |
| 376 | "connections": connections_data, |
| 377 | "groups": groups_data |
| 378 | } |
| 379 | |
| 380 | def deserialize(self, data, offset=QPointF(0, 0)): |
| 381 | """Deserializes graph data, creating all nodes, connections, and groups.""" |