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)
| 370 | self._add_g(g, svg_file.name, override=True) |
| 371 | |
| 372 | def write_bundle(self, names, path) -> None: |
| 373 | """Write the given symbols' 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's definitions of *names* with those from *other*. |