重构pq_config、修改切换面板清空旧逻辑

This commit is contained in:
xinzhu.yin
2026-05-19 11:50:53 +08:00
parent 405b6047b9
commit c42287b7d7
6 changed files with 324 additions and 687 deletions

View File

@@ -659,9 +659,12 @@ def clear_chart(self):
self.eotf_canvas.draw()
# ========== 4. 清空色度图表 ==========
if hasattr(self, "cct_ax1") and hasattr(self, "cct_ax2"):
# 上图x coordinates
self.cct_ax1.clear()
# 注意plot_cct 会调用 cct_fig.clear() 并重建 subplots导致 self.cct_ax1/ax2 变成
# 过期引用。因此清空时必须同样重建,并更新引用,否则清不干净。
if hasattr(self, "cct_fig") and hasattr(self, "cct_canvas"):
self.cct_fig.clear()
self.cct_ax1 = self.cct_fig.add_subplot(211)
self.cct_ax1.set_xlabel("灰阶 (%)", fontsize=9)
self.cct_ax1.set_ylabel("CIE x", fontsize=9)
self.cct_ax1.set_xlim(0, 105)
@@ -669,8 +672,7 @@ def clear_chart(self):
self.cct_ax1.grid(True, linestyle="--", alpha=0.3)
self.cct_ax1.tick_params(labelsize=8)
# 下图y coordinates
self.cct_ax2.clear()
self.cct_ax2 = self.cct_fig.add_subplot(212)
self.cct_ax2.set_xlabel("灰阶 (%)", fontsize=9)
self.cct_ax2.set_ylabel("CIE y", fontsize=9)
self.cct_ax2.set_xlim(0, 105)
@@ -679,8 +681,6 @@ def clear_chart(self):
self.cct_ax2.tick_params(labelsize=8)
self.cct_fig.suptitle("色度一致性测试", fontsize=12, y=0.985)
# 重置布局
self.cct_fig.subplots_adjust(
left=0.12,
right=0.88,
@@ -688,7 +688,6 @@ def clear_chart(self):
bottom=0.08,
hspace=0.25,
)
self.cct_canvas.draw()
# ========== 5. 清空对比度图表 ==========