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

Method _on_update_symbols_from_library

SLiCAP/schematic/window.py:458–500  ·  view source on GitHub ↗

Drop the whole frozen symbol cache and reload every symbol fresh from the system library. Unlike "Load selected symbols…", this rebuilds the active library without the schematic's frozen .symbols overlay, refreshes every instance on the canvas, and deletes the

(self)

Source from the content-addressed store, hash-verified

456 )
457
458 def _on_update_symbols_from_library(self):
459 """Drop the whole frozen symbol cache and reload every symbol fresh from
460 the system library.
461
462 Unlike "Load selected symbols…", this rebuilds the active library without
463 the schematic&#x27;s frozen <name>.symbols overlay, refreshes every instance on
464 the canvas, and deletes the on-disk cache (it is regenerated on save).
465 Pin positions may move, so connections can break — restoring them is left
466 to the user."""
467 from .component_item import ComponentItem
468 ret = QMessageBox.warning(
469 self, "Update symbols from library",
470 "This deletes the schematic's symbol cache and reloads every symbol "
471 "from the system library, refreshing all instances on the canvas.\n\n"
472 "Pin positions may differ from the cached symbols, which can break "
473 "existing wire connections — restoring them is up to you.\n\nProceed?",
474 QMessageBox.Yes | QMessageBox.No, QMessageBox.No,
475 )
476 if ret != QMessageBox.Yes:
477 return
478
479 # Rebuild the active library from the system (+ project lib/) symbols,
480 # dropping the frozen overlay, and republish the metadata.
481 self._build_library(None)
482 for item in self._scene.items():
483 if isinstance(item, ComponentItem):
484 svg = self._library.svg_bytes(item.symbol_name)
485 if svg is not None:
486 item.reload_svg(svg)
487 self._scene._sync_junctions()
488
489 # Delete the on-disk cache so it is regenerated from the live library on
490 # the next save.
491 cache = project.symbols_path()
492 if cache is not None and cache.is_file():
493 cache.unlink()
494 self._dirty = True
495
496 QMessageBox.information(
497 self, "Update symbols from library",
498 "All symbols reloaded from the system library.\n\n"
499 "Save the schematic to regenerate its symbol cache.",
500 )
501
502 def _on_place_text(self):
503 from .text_dialog import TextDialog

Callers

nothing calls this directly

Calls 4

_build_libraryMethod · 0.95
reload_svgMethod · 0.80
_sync_junctionsMethod · 0.80
svg_bytesMethod · 0.45

Tested by

no test coverage detected