Fix project reopen persistence

This commit is contained in:
=
2026-06-10 19:10:59 +08:00
parent 7195dea7cd
commit d577edf348
7 changed files with 262 additions and 53 deletions
+13 -1
View File
@@ -9,6 +9,7 @@ import tempfile
import yaml
from layout_files import load_layout_cell_files, write_layout_cells_to_directory
from router_dependency import require_router_stack
@@ -32,9 +33,20 @@ def create_routed_layout_svg(
# Build into a temporary GDS first, then convert the generated top cell into
# the SVG preview consumed by the canvas.
with tempfile.TemporaryDirectory(prefix="mxpic_routed_preview_") as temp_dir:
staged_project_dir = os.path.join(temp_dir, "project")
saved_cells, _warnings = load_layout_cell_files(project_dir)
staged_cells = [cell for cell in saved_cells if cell["name"] != cell_name]
staged_cells.append({
"filename": f"{cell_name}.yml",
"name": cell_name,
"data": layout,
"content": yaml_content,
})
write_layout_cells_to_directory(staged_cells, staged_project_dir)
temp_gds = os.path.join(temp_dir, f"{cell_name}.gds")
build_project_gds(
project_dir=project_dir,
project_dir=staged_project_dir,
output_path=temp_gds,
pdk_root=pdk_root,
technology_manifest_path=technology_manifest_path,