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:
parent
3e7375344e
commit
35adf5ee0d
|
|
@ -96,14 +96,20 @@ class FeaturePanel(QWidget):
|
||||||
part = self._part()
|
part = self._part()
|
||||||
self.list.clear()
|
self.list.clear()
|
||||||
feats = part.features if part else []
|
feats = part.features if part else []
|
||||||
connected = {c.anchor for c in self.c.scene.connections}
|
# Map each connected feature -> the board(s) it mates with.
|
||||||
connected |= {c.moving for c in self.c.scene.connections}
|
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
|
# keep the active feature pointing at something on this board
|
||||||
ids = [f.id for f in feats]
|
ids = [f.id for f in feats]
|
||||||
if self.c.active_feature not in ids:
|
if self.c.active_feature not in ids:
|
||||||
self.c.active_feature = ids[0] if ids else None
|
self.c.active_feature = ids[0] if ids else None
|
||||||
for f in feats:
|
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}"
|
label = f"{f.id}: {f.kind} · {f.face}{mark}"
|
||||||
item = QListWidgetItem(label)
|
item = QListWidgetItem(label)
|
||||||
item.setData(Qt.UserRole, f.id)
|
item.setData(Qt.UserRole, f.id)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue