MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / write_bundle

Method write_bundle

SLiCAP/schematic/symbol_library.py:372–386  ·  view source on GitHub ↗

Write the given symbols' raw definitions to a bundle SVG, so the schematic carries a frozen copy of every symbol it uses.

(self, names, path)

Source from the content-addressed store, hash-verified

370 self._add_g(g, svg_file.name, override=True)
371
372 def write_bundle(self, names, path) -> None:
373 """Write the given symbols&#x27; raw <g> definitions to a bundle SVG, so the
374 schematic carries a frozen copy of every symbol it uses."""
375 seen: set[str] = set()
376 parts: list[str] = []
377 for n in names:
378 if n in seen:
379 continue
380 seen.add(n)
381 sym = self._symbols.get(n)
382 if sym is not None:
383 parts.append(sym.g_xml)
384 content = (f'<svg xmlns="{SVG_NS}">\n <defs>\n'
385 + "\n".join(parts) + "\n </defs>\n</svg>\n")
386 Path(path).write_text(content, encoding="utf-8")
387
388 def update_symbols(self, other: "SymbolLibrary", names) -> list[str]:
389 """Replace this library&#x27;s definitions of *names* with those from *other*.

Callers 1

_save_toMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected