Release 1.4.1: a Bonded checkbox in the terminal tables
tests / ubuntu-latest · py3.11 (push) Successful in 54s
tests / ubuntu-latest · py3.13 (push) Successful in 58s
tests / archlinux:latest (push) Successful in 41s
tests / debian:12 (push) Successful in 1m10s
tests / fedora:latest (push) Successful in 42m6s
tests / ubuntu:24.04 (push) Successful in 1m15s
tests / NixOS (FHS wrapper from docs/NIXOS.md) (push) Skipped
Build PCM package / build (push) Successful in 11s
tests / ubuntu-latest · py3.11 (push) Successful in 54s
tests / ubuntu-latest · py3.13 (push) Successful in 58s
tests / archlinux:latest (push) Successful in 41s
tests / debian:12 (push) Successful in 1m10s
tests / fedora:latest (push) Successful in 42m6s
tests / ubuntu:24.04 (push) Successful in 1m15s
tests / NixOS (FHS wrapper from docs/NIXOS.md) (push) Skipped
Build PCM package / build (push) Successful in 11s
The config's per-terminal bonded key becomes editable in the dialog (previously file-only, shown as a text suffix): checked, the terminal's contacts short into one internally joined lug - the total value stays prescribed, the per-contact split is a solve outcome. Same-name rectangle groups seed it checked as before; unchecking one falls back to the per-cell area share, and checking a single-contact terminal gives it an equipotential-lug contact instead of uniform injection. Save config... writes the flag back (removed when unchecked - false is the schema default). With this, every non-structural terminal option (active, values, v_oc, contact layer, bonded, comment) is table-editable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,4 +4,4 @@ __version__ is the runtime source of truth (metadata.json and
|
||||
pyproject.toml are not deployed with the plugin); a test keeps the
|
||||
three in sync.
|
||||
"""
|
||||
__version__ = "1.4.0"
|
||||
__version__ = "1.4.1"
|
||||
|
||||
@@ -769,8 +769,9 @@ def save_classic_config(path: Path, selection) -> None:
|
||||
def updated_terminals_json(raw_terminals: list, rows: list) -> list:
|
||||
"""Config-backed PDN save: each raw terminal object is deep-copied
|
||||
verbatim (parts, "_"-prefixed keys preserved) and only the
|
||||
dialog-editable values - I / R_out / V_oc and the terminal-level
|
||||
contact layer - are written back POSITIONALLY: the dialog never
|
||||
dialog-editable values - I / R_out / V_oc, the bonded flag and the
|
||||
terminal-level contact layer - are written back POSITIONALLY: the
|
||||
dialog never
|
||||
reorders its tables, so index i is the same terminal in both lists.
|
||||
A supply row's v_oc of None REMOVES the key (restoring the
|
||||
defaults-to-v_nominal semantics); a contact of "auto" removes the
|
||||
@@ -800,6 +801,10 @@ def updated_terminals_json(raw_terminals: list, rows: list) -> list:
|
||||
t["contact"] = contact
|
||||
else:
|
||||
t.pop("contact", None)
|
||||
if getattr(row, "bonded", False):
|
||||
t["bonded"] = True
|
||||
else:
|
||||
t.pop("bonded", None) # false is the schema default
|
||||
if getattr(row, "active", True):
|
||||
t.pop("active", None) # true is the schema default
|
||||
else:
|
||||
|
||||
+25
-11
@@ -122,10 +122,13 @@ class PdnTerminalRow:
|
||||
i_draw_a: float | None = None # loads; None = not entered yet
|
||||
r_out_ohm: float | None = None # supplies; None = not entered yet
|
||||
v_oc: float | None = None # supplies; None = v_nominal
|
||||
bonded: bool = False # multi-contact lug: the TOTAL value
|
||||
# applies, the per-contact split is a
|
||||
# solve outcome (display/data only -
|
||||
# not editable in the table)
|
||||
bonded: bool = False # checkbox: short the contacts into
|
||||
# one lug - the TOTAL value applies,
|
||||
# the per-contact split is a solve
|
||||
# outcome. Seeded True for same-name
|
||||
# rectangle groups and from the
|
||||
# config's "bonded" key; a single
|
||||
# contact checked = equipotential lug
|
||||
contact: str = "all" # terminal-level layer scope: "auto"
|
||||
# (per contact part - config-backed
|
||||
# rows only), "all", or a layer name
|
||||
@@ -304,8 +307,10 @@ class _Dialog(QDialog):
|
||||
# the role/layer mapping lives in the table titles now
|
||||
hints.append("name from a text item inside the "
|
||||
"rectangle; empty V_oc = V nominal")
|
||||
hints.append("Layer = the copper the terminal contacts; "
|
||||
"values take SI suffixes (50m = 0.05)")
|
||||
hints.append("Bonded = contacts joined into one lug (the "
|
||||
"per-contact split is solved); Layer = the "
|
||||
"copper the terminal contacts; values take SI "
|
||||
"suffixes (50m = 0.05)")
|
||||
hint = QLabel(" — ".join(hints))
|
||||
hint.setWordWrap(True)
|
||||
hint.setStyleSheet("color: gray; font-size: 10px;")
|
||||
@@ -532,10 +537,11 @@ class _Dialog(QDialog):
|
||||
for role, cols in (
|
||||
("supply",
|
||||
["Active", "Name", "Component", "R_out [Ω]",
|
||||
"V_oc [V]", "Layer", "Contact parts", "Comment"]),
|
||||
"V_oc [V]", "Bonded", "Layer", "Contact parts",
|
||||
"Comment"]),
|
||||
("load",
|
||||
["Active", "Name", "Component", "I draw [A]", "Layer",
|
||||
"Contact parts", "Comment"])):
|
||||
["Active", "Name", "Component", "I draw [A]",
|
||||
"Bonded", "Layer", "Contact parts", "Comment"])):
|
||||
n = sum(1 for r in pdn.rows if r.role == role)
|
||||
panel = QWidget()
|
||||
pv = QVBoxLayout(panel)
|
||||
@@ -562,7 +568,8 @@ class _Dialog(QDialog):
|
||||
self._pdn_map.append((t, i))
|
||||
values = ([row.r_out_ohm, row.v_oc] if row.role == "supply"
|
||||
else [row.i_draw_a])
|
||||
last = t.columnCount() - 1 # ... | Layer | parts | Comment
|
||||
# tail columns: ... | Bonded | Layer | parts | Comment
|
||||
last = t.columnCount() - 1
|
||||
cells = [(1, row.name, False), (2, row.component, False)]
|
||||
for col, value in enumerate(values, start=3):
|
||||
cells.append((col, "" if value is None else f"{value:g}",
|
||||
@@ -579,6 +586,11 @@ class _Dialog(QDialog):
|
||||
box.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
|
||||
box.setCheckState(Qt.Checked if row.active else Qt.Unchecked)
|
||||
t.setItem(i, 0, box)
|
||||
bond = QTableWidgetItem("")
|
||||
bond.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
|
||||
bond.setCheckState(Qt.Checked if row.bonded
|
||||
else Qt.Unchecked)
|
||||
t.setItem(i, last - 3, bond)
|
||||
combo = QComboBox()
|
||||
idx = len(self._pdn_layer_combos)
|
||||
self._pdn_layer_combos.append(combo)
|
||||
@@ -695,12 +707,14 @@ class _Dialog(QDialog):
|
||||
new = PdnTerminalRow(name=row.name, role=row.role,
|
||||
resolved=row.resolved,
|
||||
component=row.component,
|
||||
bonded=row.bonded,
|
||||
from_config=row.from_config)
|
||||
box = t.item(r, 0)
|
||||
checked = (box is None
|
||||
or box.checkState() == Qt.Checked)
|
||||
new.active = checked and not self._row_hidden(i)
|
||||
bond = t.item(r, t.columnCount() - 4)
|
||||
new.bonded = (bond is not None
|
||||
and bond.checkState() == Qt.Checked)
|
||||
new.comment = cell(t.columnCount() - 1)
|
||||
combo = self._pdn_layer_combos[i]
|
||||
new.contact = (combo.currentData() if combo.count()
|
||||
|
||||
@@ -237,9 +237,10 @@ def main() -> None:
|
||||
def marker_desc(mt):
|
||||
if len(mt.electrodes) == 1:
|
||||
return rect_desc(mt.electrodes[0])
|
||||
# same-named rectangles grouped into one bonded lug
|
||||
# same-named rectangles grouped into one terminal (the
|
||||
# Bonded checkbox shows/controls the lug behavior)
|
||||
return (f"{len(mt.electrodes)}× "
|
||||
f"{rect_desc(mt.electrodes[0])} … — bonded")
|
||||
f"{rect_desc(mt.electrodes[0])} …")
|
||||
|
||||
def live_row(mt, hint, tn):
|
||||
return dialog.PdnTerminalRow(
|
||||
@@ -253,8 +254,7 @@ def main() -> None:
|
||||
n_cfg = len(terminals)
|
||||
rows = [dialog.PdnTerminalRow(
|
||||
name=t.label, role=t.role,
|
||||
resolved=(group_label(t.electrodes)
|
||||
+ (" — bonded" if t.bonded else "")),
|
||||
resolved=group_label(t.electrodes),
|
||||
component=hint,
|
||||
i_draw_a=(t.i_draw_a if t.role == "load"
|
||||
else None),
|
||||
@@ -418,7 +418,7 @@ def main() -> None:
|
||||
if row.i_draw_a is not None else 0.0),
|
||||
r_out_ohm=(row.r_out_ohm
|
||||
if row.r_out_ohm is not None else 0.0),
|
||||
v_oc=row.v_oc, bonded=mt.bonded,
|
||||
v_oc=row.v_oc, bonded=row.bonded,
|
||||
component=row.component, comment=row.comment)
|
||||
if pdn_cfg:
|
||||
cfg_rows = selection.pdn_rows[:len(terminals)]
|
||||
@@ -448,6 +448,7 @@ def main() -> None:
|
||||
else:
|
||||
t.r_out_ohm = row.r_out_ohm
|
||||
t.v_oc = row.v_oc
|
||||
t.bonded = row.bonded
|
||||
t.component = row.component
|
||||
t.comment = row.comment
|
||||
terminals = (
|
||||
|
||||
Reference in New Issue
Block a user