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

Class PlaceSubcircuitDialog

SLiCAP/schematic/place_subcircuit_dialog.py:70–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69
70class PlaceSubcircuitDialog(QDialog):
71 def __init__(self, parent=None):
72 super().__init__(parent, Qt.Window)
73 self.setWindowTitle("Place Subcircuit")
74 self.setMinimumWidth(560)
75
76 self._defn: SubcktDef | None = None
77 self._lib_path: str | None = None
78 self._extra_w: float = 0.0 # half-width added beyond the auto-fit min
79 self._extra_h: float = 0.0 # half-height added beyond the auto-fit min
80
81 outer = QVBoxLayout(self)
82
83 # ── library file picker ─────────────────────────────────────────────────
84 file_row = QHBoxLayout()
85 self._file = QLineEdit(); self._file.setReadOnly(True)
86 self._file.setPlaceholderText("Select a subcircuit .lib file…")
87 browse = QPushButton("Browse…"); browse.clicked.connect(self._choose_file)
88 file_row.addWidget(self._file); file_row.addWidget(browse)
89 outer.addLayout(file_row)
90
91 self._stale = QLabel()
92 self._stale.setWordWrap(True)
93 self._stale.setStyleSheet("color:#b00;")
94 self._stale.setVisible(False)
95 outer.addWidget(self._stale)
96
97 # ── interface (left) + preview (right) ──────────────────────────────────
98 body = QHBoxLayout()
99
100 left = QVBoxLayout()
101 form = QFormLayout()
102 self._name = QLabel("—")
103 self._params = QLabel("—")
104 self._sch = QLabel("—")
105 form.addRow("<b>Subcircuit:</b>", self._name)
106 form.addRow("Parameters:", self._params)
107 form.addRow("Schematic:", self._sch)
108 left.addLayout(form)
109
110 left.addWidget(QLabel("Pin placement (top → clockwise):"))
111 pin_row = QHBoxLayout()
112 self._pins = QListWidget()
113 self._pins.currentRowChanged.connect(lambda _r: self._refresh_preview())
114 pin_row.addWidget(self._pins)
115 btns = QVBoxLayout()
116 up = QPushButton("Up"); dn = QPushButton("Down")
117 up.clicked.connect(lambda: self._move(-1))
118 dn.clicked.connect(lambda: self._move(+1))
119 btns.addWidget(up); btns.addWidget(dn); btns.addStretch(1)
120 pin_row.addLayout(btns)
121 left.addLayout(pin_row)
122 body.addLayout(left, 1)
123
124 right = QVBoxLayout()
125 self._preview = _SymbolPreview()
126 right.addWidget(self._preview, 1)
127 size_row = QHBoxLayout()

Callers 1

_on_place_subcircuitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected