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

Function _render_icon

SLiCAP/schematic/palette.py:48–58  ·  view source on GitHub ↗
(svg_bytes: bytes, size: int)

Source from the content-addressed store, hash-verified

46
47
48def _render_icon(svg_bytes: bytes, size: int) -> QIcon:
49 from PySide6.QtCore import QRectF
50 from .component_item import paint_symbol
51 pixmap = QPixmap(size, size)
52 pixmap.fill(Qt.transparent)
53 painter = QPainter(pixmap)
54 # Render through the canvas' symbol path so embedded text is centred and
55 # matches a placed component (KeepAspectRatio is handled inside paint_symbol).
56 paint_symbol(painter, svg_bytes, QRectF(0, 0, size, size))
57 painter.end()
58 return QIcon(pixmap)

Callers 1

_populateMethod · 0.85

Calls 1

paint_symbolFunction · 0.85

Tested by

no test coverage detected