修复色准结果图偏移

This commit is contained in:
xinzhu.yin
2026-06-09 17:15:54 +08:00
parent 25be4b7f4a
commit 3206079c63
4 changed files with 13 additions and 18 deletions

View File

@@ -335,10 +335,14 @@ def plot_accuracy(self: "PQAutomationApp", accuracy_data, test_type):
fig.patch.set_facecolor(palette["bg"])
# 根据当前画布像素尺寸动态缩放字体,避免窗口缩小时文字挤压重叠
# 先确保色准页签已激活,再读取真实画布尺寸进行动态缩放
font_scale = 1.0
try:
self.chart_notebook.select(self.accuracy_chart_frame)
self.chart_notebook.update_idletasks()
canvas_widget = self.accuracy_canvas.get_tk_widget()
canvas_widget.update_idletasks()
canvas_widget.update()
cw = max(1, int(canvas_widget.winfo_width()))
ch = max(1, int(canvas_widget.winfo_height()))
font_scale = min(cw / 1000.0, ch / 600.0)
@@ -423,11 +427,13 @@ def plot_accuracy(self: "PQAutomationApp", accuracy_data, test_type):
except Exception:
pass
# Select the tab first so the canvas is visible and winfo_width/height
# return real pixel dimensions before the figure is rendered.
# 重新刷新布局并绘制,确保画布尺寸与 notebook tab 对齐。
self.chart_notebook.select(self.accuracy_chart_frame)
self.accuracy_canvas.get_tk_widget().update_idletasks()
canvas_widget = self.accuracy_canvas.get_tk_widget()
canvas_widget.update_idletasks()
canvas_widget.update()
self.accuracy_canvas.draw()
canvas_widget.update_idletasks()
class PlotAccuracyMixin: