Add a .lib include for lib_path unless one is already on the canvas.
(self, lib_path: str)
| 346 | self._scene.start_placement(defn.name, svg) |
| 347 | |
| 348 | def _ensure_library_include(self, lib_path: str): |
| 349 | """Add a .lib include for lib_path unless one is already on the canvas.""" |
| 350 | from .library_item import LibraryItem |
| 351 | target = str(Path(lib_path).resolve()) |
| 352 | for item in self._scene.items(): |
| 353 | if isinstance(item, LibraryItem) and \ |
| 354 | str(Path(item.file_path).resolve()) == target: |
| 355 | return |
| 356 | pos = self._view.mapToScene(20, 20) |
| 357 | self._scene.addItem(LibraryItem(str(lib_path), pos)) |
| 358 | |
| 359 | def _on_place_image(self): |
| 360 | from .image_dialog import ImageDialog |
no test coverage detected