Joinery list: show what each feature connects to (not just "connected")

The connected indicator now reads "🔗 → <board>" naming the mating board, so a
part legitimately in two connections shows each feature's distinct mate, and a
free feature shows nothing. (A connection always links two features on two
different boards, so a board showing both features connected means it's in two
connections — verified the model never over-marks from a single connect.)

86 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
rob 2026-05-30 11:17:51 -03:00
parent 3e7375344e
commit 35adf5ee0d
1 changed files with 9 additions and 3 deletions

View File

@ -96,14 +96,20 @@ class FeaturePanel(QWidget):
part = self._part()
self.list.clear()
feats = part.features if part else []
connected = {c.anchor for c in self.c.scene.connections}
connected |= {c.moving for c in self.c.scene.connections}
# Map each connected feature -> the board(s) it mates with.
mates: dict[str, list[str]] = {}
for c in self.c.scene.connections:
if not self.c.scene._conn_valid(c):
continue
ap, mp = self.c.scene.feature_owner(c.anchor), self.c.scene.feature_owner(c.moving)
mates.setdefault(c.anchor, []).append(mp.name or mp.id)
mates.setdefault(c.moving, []).append(ap.name or ap.id)
# keep the active feature pointing at something on this board
ids = [f.id for f in feats]
if self.c.active_feature not in ids:
self.c.active_feature = ids[0] if ids else None
for f in feats:
mark = " 🔗 connected" if f.id in connected else ""
mark = f" 🔗 → {', '.join(mates[f.id])}" if f.id in mates else ""
label = f"{f.id}: {f.kind} · {f.face}{mark}"
item = QListWidgetItem(label)
item.setData(Qt.UserRole, f.id)