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

Method mouseMoveEvent

SLiCAP/schematic/canvas.py:2127–2243  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

2125 w.update_label()
2126
2127 def mouseMoveEvent(self, event):
2128 pos = snap(event.scenePos())
2129
2130 if (self._mode in (_Mode.PLACING, _Mode.PLACING_JUNCTION,
2131 _Mode.PLACING_TEXT, _Mode.PLACING_COMMAND,
2132 _Mode.PLACING_BORDER, _Mode.PLACING_LIBRARY,
2133 _Mode.PLACING_IMAGE, _Mode.PLACING_LATEX,
2134 _Mode.PLACING_PARAMETER, _Mode.PLACING_ANALYSIS,
2135 _Mode.PLACING_HYPERLINK, _Mode.PLACING_MODEL)
2136 and self._ghost is not None):
2137 self._ghost.setPos(pos)
2138
2139 elif self._mode == _Mode.WIRING:
2140 self._refresh_preview(pos)
2141
2142 elif self._mode in (_Mode.DRAWING_LINE, _Mode.DRAWING_RECT,
2143 _Mode.DRAWING_CIRCLE):
2144 self._update_draw_ghost(snap(event.scenePos()))
2145
2146 elif self._mode == _Mode.PASTING:
2147 if self._paste_ghost_items and self._paste_ref is not None:
2148 delta = pos - self._paste_ref
2149 for kind, item, base in self._paste_ghost_items:
2150 if kind == 'point':
2151 item.setPos(base + delta)
2152 else:
2153 item.setPath(_build_path([p + delta for p in base]))
2154
2155 elif self._wire_move_start is not None:
2156 delta = pos - self._wire_move_start
2157 if delta.x() != 0 or delta.y() != 0:
2158 self._wire_move_moved = True
2159 for wire, origins in zip(self._wire_move_wires, self._wire_move_origins):
2160 wire.points = [p + delta for p in origins]
2161 wire._rebuild()
2162 for rb_wire, rb_ep_origins in self._wire_move_rb:
2163 for idx, orig_pt in rb_ep_origins.items():
2164 rb_wire.points[idx] = orig_pt + delta
2165 rb_wire._rebuild()
2166 for junc, orig_pos in self._wire_move_junctions:
2167 if junc.scene() is not None:
2168 junc.setPos(orig_pos + delta)
2169 for other_item, ox, oy in self._wire_move_others:
2170 other_item.setPos(snap(QPointF(ox + delta.x(), oy + delta.y())))
2171 for (comp, local, wire, idx), pw in zip(self._wire_pin_anchors,
2172 self._wire_pin_preview_wires):
2173 if pw.scene() is None:
2174 continue
2175 cur_pin = comp.mapToScene(QPointF(*local))
2176 new_pt = wire.points[idx]
2177 pw.points = _elbow(QPointF(cur_pin), QPointF(new_pt), True)
2178 pw._rebuild()
2179
2180 elif self._vdrag_wire is not None:
2181 self._vdrag_moved = True
2182 self._vdrag_wire.move_vertex(self._vdrag_idx, pos)
2183 for rb_wire, rb_ep_idx, _ in self._vdrag_rb:
2184 rb_wire.points[rb_ep_idx] = QPointF(pos)

Callers

nothing calls this directly

Calls 10

_refresh_previewMethod · 0.95
_update_draw_ghostMethod · 0.95
snapFunction · 0.85
_build_pathFunction · 0.85
_elbowFunction · 0.85
_rebuildMethod · 0.80
move_vertexMethod · 0.80
pin_scene_posMethod · 0.80
_pt_keyFunction · 0.70
mouseMoveEventMethod · 0.45

Tested by

no test coverage detected