fix: propagate board reload to project_commands after SVG logo import

save_project uses project_commands.board, which was NOT in the propagation
list after pcbnew.LoadBoard() in _handle_import_svg_logo. As a result,
save_project() wrote the old in-memory board (without logo gr_poly entries)
back to disk, erasing the logo every time.

Fix: call _update_command_handlers() after reload, which updates all
command handler board references including project_commands.
This commit is contained in:
Tom
2026-03-07 01:50:03 +01:00
parent 44c5e7f388
commit b6e1b8b7b1

View File

@@ -1609,11 +1609,8 @@ class KiCADInterface:
if result.get("success") and self.board:
try:
self.board = pcbnew.LoadBoard(pcb_path)
# Propagate to sub-command objects that hold a board reference
for attr in ("board_commands", "routing_commands", "component_commands"):
obj = getattr(self, attr, None)
if obj is not None:
obj.board = self.board
# Propagate updated board reference to all command handlers
self._update_command_handlers()
logger.info("Reloaded board into pcbnew after SVG logo import")
except Exception as reload_err:
logger.warning(f"Board reload after SVG import failed (non-fatal): {reload_err}")