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