MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / paint

Method paint

SLiCAP/schematic/wire_item.py:226–250  ·  view source on GitHub ↗
(self, painter: QPainter, option, widget=None)

Source from the content-addressed store, hash-verified

224 # ── visuals ───────────────────────────────────────────────────────────────
225
226 def paint(self, painter: QPainter, option, widget=None):
227 super().paint(painter, option, widget)
228
229 # Anchor dot + leader line — when wire or its label is active
230 if ((option.state & QStyle.State_Selected or self._label_active)
231 and self.display_name and self.net_name
232 and self._net_label is not None
233 and self._net_label.isVisible()
234 and self.points):
235 painter.save()
236 painter.setPen(QPen(NET_LABEL_COLOR, 0.6))
237 painter.setBrush(NET_LABEL_COLOR)
238 anchor = self.points[0]
239 painter.drawLine(anchor, self._net_label.pos())
240 painter.drawEllipse(anchor, 2.0, 2.0)
241 painter.restore()
242
243 if option.state & QStyle.State_Selected:
244 painter.save()
245 s = HANDLE_SIZE / 2
246 painter.setPen(QPen(HANDLE_COLOR, 0.8))
247 painter.setBrush(HANDLE_COLOR)
248 for pt in self.points:
249 painter.drawRect(QRectF(pt.x() - s, pt.y() - s, HANDLE_SIZE, HANDLE_SIZE))
250 painter.restore()
251
252 def _rebuild(self):
253 if len(self.points) < 2:

Callers 1

paintMethod · 0.45

Calls 1

saveMethod · 0.45

Tested by

no test coverage detected