(self, params: list, preamble_path: str,
width: int, height: int)
| 714 | self.placing_started.emit() |
| 715 | |
| 716 | def start_parameter_placement(self, params: list, preamble_path: str, |
| 717 | width: int, height: int): |
| 718 | from PySide6.QtWidgets import QGraphicsPixmapItem |
| 719 | from PySide6.QtGui import QPixmap, QPainter as _QPainter |
| 720 | self._end_wire(commit=False) |
| 721 | self._cancel_placement() |
| 722 | from .latex_label import render_latex_raw |
| 723 | from .parameter_item import ParameterItem as _PI |
| 724 | svg_bytes, _ = render_latex_raw(_PI.build_latex(params), preamble_path) |
| 725 | from PySide6.QtSvg import QSvgRenderer |
| 726 | from PySide6.QtCore import QByteArray |
| 727 | renderer = QSvgRenderer(QByteArray(svg_bytes)) if svg_bytes else None |
| 728 | w, h = max(1, width), max(1, height) |
| 729 | if renderer and renderer.isValid(): |
| 730 | px = QPixmap(w, h) |
| 731 | px.fill(Qt.transparent) |
| 732 | p = _QPainter(px) |
| 733 | renderer.render(p) |
| 734 | p.end() |
| 735 | else: |
| 736 | px = QPixmap(w, h) |
| 737 | px.fill(QColor(200, 225, 255)) |
| 738 | ghost = QGraphicsPixmapItem(px) |
| 739 | ghost.setOpacity(0.5) |
| 740 | ghost.setAcceptedMouseButtons(Qt.NoButton) |
| 741 | self._ghost = ghost |
| 742 | self._ghost.setPos(QPointF(-9999, -9999)) |
| 743 | self.addItem(self._ghost) |
| 744 | self._param_pending = (params, preamble_path, width, height) |
| 745 | self._mode = _Mode.PLACING_PARAMETER |
| 746 | self.placing_started.emit() |
| 747 | |
| 748 | def start_analysis_placement(self, source: list, detector: list, lgref: list): |
| 749 | from PySide6.QtWidgets import QGraphicsSimpleTextItem |
no test coverage detected