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

Method open_subschematic

SLiCAP/schematic/window.py:616–647  ·  view source on GitHub ↗

Open a subcircuit's schematic in a new editable window (descending the hierarchy). Each window restores its own global context when activated (see changeEvent), since project/config and the symbol dicts are shared. If the schematic is already open in another window it is ra

(self, path: Path)

Source from the content-addressed store, hash-verified

614 return True
615
616 def open_subschematic(self, path: Path):
617 """Open a subcircuit's schematic in a new editable window (descending the
618 hierarchy). Each window restores its own global context when activated
619 (see changeEvent), since project/config and the symbol dicts are shared.
620
621 If the schematic is already open in another window it is raised instead of
622 opened twice — a subcircuit must be edited in one place at a time."""
623 path = Path(path)
624 if not path.is_file():
625 QMessageBox.warning(self, "Descend into subcircuit",
626 f"Source schematic not found:\n{path}")
627 return
628
629 existing = self._window_showing(path)
630 if existing is not None:
631 QMessageBox.information(
632 self, "Already open",
633 f"“{path.name}” is already open.\n"
634 "A subcircuit must be edited in one place at a time.",
635 )
636 existing.raise_()
637 existing.activateWindow()
638 return
639
640 win = MainWindow()
641 if not win._load_file(path):
642 return
643 win.show()
644 win.raise_()
645 win.activateWindow()
646 self._children = getattr(self, "_children", [])
647 self._children.append(win)
648
649 @staticmethod
650 def _window_showing(path: Path) -> "MainWindow | None":

Callers 1

mouseDoubleClickEventMethod · 0.80

Calls 3

_window_showingMethod · 0.95
_load_fileMethod · 0.95
MainWindowClass · 0.85

Tested by

no test coverage detected