A helper method called by a timer to run the final layout pass.
(self, nodes_to_update)
| 486 | QTimer.singleShot(0, lambda: self.final_load_update(nodes_to_update)) |
| 487 | |
| 488 | def final_load_update(self, nodes_to_update): |
| 489 | """A helper method called by a timer to run the final layout pass.""" |
| 490 | from utils.debug_config import should_debug, DEBUG_FILE_LOADING |
| 491 | |
| 492 | for node in nodes_to_update: |
| 493 | # Check if node is still valid (not deleted) |
| 494 | try: |
| 495 | if node.scene() is None: |
| 496 | continue # Node has been removed from scene |
| 497 | |
| 498 | # Re-validate minimum size now that GUI is fully constructed |
| 499 | min_width, min_height = node.calculate_absolute_minimum_size() |
| 500 | current_width, current_height = node.width, node.height |
| 501 | |
| 502 | # Check if current size is still too small after GUI construction |
| 503 | required_width = max(current_width, min_width) |
| 504 | required_height = max(current_height, min_height) |
| 505 | |
| 506 | if required_width != current_width or required_height != current_height: |
| 507 | if should_debug(DEBUG_FILE_LOADING): |
| 508 | print(f"DEBUG: Final size validation - Node '{node.title}' needs resize from " |
| 509 | f"{current_width}x{current_height} to {required_width}x{required_height}") |
| 510 | |
| 511 | node.width = required_width |
| 512 | node.height = required_height |
| 513 | |
| 514 | # Force a complete layout rebuild like manual resize does |
| 515 | node._update_layout() |
| 516 | # Update all pin connections like manual resize does |
| 517 | for pin in node.pins: |
| 518 | pin.update_connections() |
| 519 | # Force node visual update |
| 520 | node.update() |
| 521 | except RuntimeError: |
| 522 | # Node has been deleted, skip |
| 523 | continue |
| 524 | self.update() |
| 525 | |
| 526 | # --- Other methods remain the same --- |
| 527 | def create_node(self, title, pos=(0, 0), is_reroute=False, use_command=True): |
no test coverage detected