MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / _open_net_label

Method _open_net_label

SLiCAP/schematic/canvas.py:2102–2125  ·  view source on GitHub ↗
(self, wire: WireItem)

Source from the content-addressed store, hash-verified

2100 return [w for w in wires if w.points and uf.find(_rpt(w.points[0])) == target_root]
2101
2102 def _open_net_label(self, wire: WireItem) -> None:
2103 from .net_label_dialog import NetLabelDialog
2104 net_wires = self._wires_on_same_net(wire)
2105 # Use the canonical name from any segment on the net that already has one.
2106 canon_name = wire.net_name or ""
2107 canon_display = wire.display_name
2108 for w in net_wires:
2109 if w.net_name and not w.net_locked:
2110 canon_name = w.net_name
2111 canon_display = w.display_name
2112 break
2113 dlg = NetLabelDialog(canon_name, canon_display, locked=wire.net_locked)
2114 if dlg.exec():
2115 self._push_undo()
2116 new_name = dlg.net_name() if not wire.net_locked else wire.net_name
2117 # Propagate the name to every segment on the same net.
2118 for w in net_wires:
2119 if not w.net_locked:
2120 w.net_name = new_name
2121 w._user_net_name = new_name
2122 # Display flag: only show the label on the right-clicked segment.
2123 wire.display_name = dlg.display()
2124 for w in net_wires:
2125 w.update_label()
2126
2127 def mouseMoveEvent(self, event):
2128 pos = snap(event.scenePos())

Callers 2

mouseDoubleClickEventMethod · 0.95
_on_place_labelMethod · 0.80

Calls 6

_wires_on_same_netMethod · 0.95
_push_undoMethod · 0.95
net_nameMethod · 0.95
displayMethod · 0.95
NetLabelDialogClass · 0.85
update_labelMethod · 0.80

Tested by

no test coverage detected