feat: implement DTW comparison, add data segmentation and persistence, and update QML UI for file imports and graphing.
This commit is contained in:
@@ -47,6 +47,9 @@ class WaferMapItem(QQuickPaintedItem):
|
||||
colorsChanged = Signal()
|
||||
shapeChanged = Signal()
|
||||
sizeChanged = Signal()
|
||||
thicknessChanged = Signal()
|
||||
showThicknessChanged = Signal()
|
||||
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -59,6 +62,9 @@ class WaferMapItem(QQuickPaintedItem):
|
||||
self._show_labels: bool = True
|
||||
self._shape: str = "round"
|
||||
self._size: float = 300.0
|
||||
self._thickness_data: list[float] = []
|
||||
self._show_thickness: bool = False
|
||||
self._thickness_heatmap:QImage | None = None
|
||||
|
||||
# Dark-theme color defaults (match Theme.qml tokens)
|
||||
self._ring_color = QColor("#2A3441") # waferRingColor (toneBorder)
|
||||
@@ -183,6 +189,27 @@ class WaferMapItem(QQuickPaintedItem):
|
||||
self._rebuild()
|
||||
self.sizeChanged.emit()
|
||||
|
||||
@Property("QVariantList", notify=thicknessChanged)
|
||||
def thicknessData(self) -> list:
|
||||
return self._thickness_data
|
||||
|
||||
@thicknessData.setter
|
||||
def thicknessData(self, val:list) -> None:
|
||||
self._thickness_data = list(val or [])
|
||||
self._rebuild_thickness()
|
||||
self._thicknessChanged.emit()
|
||||
self.update
|
||||
|
||||
@property(bool, notify=showThicknessChanged)
|
||||
def showThickness(self) -> bool:
|
||||
return self._show_thickness
|
||||
|
||||
@showThickness.setter
|
||||
def showThickness(self, val: bool) -> None:
|
||||
self._show_thickness = bool(val)
|
||||
self.showThicknessChanged.emit()
|
||||
self.update()
|
||||
|
||||
# Colour properties — QML can bind these to Theme tokens
|
||||
@Property(QColor, notify=colorsChanged)
|
||||
def ringColor(self) -> QColor: return self._ring_color
|
||||
@@ -225,6 +252,25 @@ class WaferMapItem(QQuickPaintedItem):
|
||||
return idx
|
||||
return -1
|
||||
|
||||
@Slot(str, result=bool)
|
||||
def export_image(self, file_path: str) -> bool:
|
||||
"""Export the current wafer map rendering to a PNG file
|
||||
|
||||
Args:
|
||||
file_pat: Absolute path for the output PNG.
|
||||
|
||||
Returns:
|
||||
True on success, False on failure
|
||||
"""
|
||||
if not file_path:
|
||||
return False
|
||||
try:
|
||||
image = self.grabToImage()
|
||||
image.save(file_path, "PNG")
|
||||
return True
|
||||
except Exception as e:
|
||||
log.error("Export failed: %s", e)
|
||||
return False
|
||||
# ── internal ─────────────────────────────────────────────────────────
|
||||
|
||||
def _on_resize(self) -> None:
|
||||
@@ -360,6 +406,12 @@ class WaferMapItem(QQuickPaintedItem):
|
||||
cy - self._heatmap.height() // 2, self._heatmap)
|
||||
painter.setOpacity(1.0)
|
||||
|
||||
if self._show_thickness and self._thickness_heatmap:
|
||||
painter.setOpacity(0.4)
|
||||
painter.drawImage(cx - self._thickness_heatmap.width() // 2,
|
||||
cy - self._thickness_heatmap.height()//2, self._thickness_heatmap)
|
||||
painter.setOpacity(1.0)
|
||||
|
||||
self._paint_markers(painter)
|
||||
|
||||
def _paint_template(self, painter: QPainter, cx: int, cy: int, r_px: int) -> None:
|
||||
|
||||
Reference in New Issue
Block a user