继续优化深色模式显示
This commit is contained in:
@@ -16,6 +16,45 @@ if TYPE_CHECKING:
|
||||
from pqAutomationApp import PQAutomationApp
|
||||
|
||||
|
||||
def _result_bg_color() -> str:
|
||||
"""根据当前主题返回结果图背景色。"""
|
||||
try:
|
||||
from app.views.theme_manager import is_dark
|
||||
return "#1B1F24" if is_dark() else "#FFFFFF"
|
||||
except Exception:
|
||||
return "#FFFFFF"
|
||||
|
||||
|
||||
def apply_result_chart_theme(self: "PQAutomationApp"):
|
||||
"""统一刷新结果图画布背景,使其跟随浅/深色主题。"""
|
||||
bg = _result_bg_color()
|
||||
|
||||
chart_pairs = [
|
||||
("gamut_fig", "gamut_canvas"),
|
||||
("gamma_fig", "gamma_canvas"),
|
||||
("eotf_fig", "eotf_canvas"),
|
||||
("cct_fig", "cct_canvas"),
|
||||
("contrast_fig", "contrast_canvas"),
|
||||
("accuracy_fig", "accuracy_canvas"),
|
||||
]
|
||||
|
||||
for fig_attr, canvas_attr in chart_pairs:
|
||||
fig = getattr(self, fig_attr, None)
|
||||
canvas = getattr(self, canvas_attr, None)
|
||||
if fig is not None:
|
||||
fig.patch.set_facecolor(bg)
|
||||
if canvas is not None:
|
||||
try:
|
||||
widget = canvas.get_tk_widget()
|
||||
widget.configure(bg=bg, highlightthickness=0)
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
canvas.draw_idle()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def init_gamut_chart(self: "PQAutomationApp"):
|
||||
"""初始化色域图表 - 手动设置subplot位置,完全避免重叠"""
|
||||
container = ttk.Frame(self.gamut_chart_frame)
|
||||
@@ -988,6 +1027,7 @@ def create_result_chart_frame(self: "PQAutomationApp"):
|
||||
self.init_cct_chart()
|
||||
self.init_contrast_chart()
|
||||
self.init_accuracy_chart()
|
||||
self.apply_result_chart_theme()
|
||||
|
||||
# 绑定Tab切换事件
|
||||
self.chart_notebook.bind("<<NotebookTabChanged>>", self.on_chart_tab_changed)
|
||||
@@ -1026,6 +1066,7 @@ class ChartFrameMixin:
|
||||
init_cct_chart = init_cct_chart
|
||||
init_contrast_chart = init_contrast_chart
|
||||
init_accuracy_chart = init_accuracy_chart
|
||||
apply_result_chart_theme = apply_result_chart_theme
|
||||
_init_accuracy_result_table = _init_accuracy_result_table
|
||||
clear_accuracy_result_table = clear_accuracy_result_table
|
||||
update_accuracy_result_table = update_accuracy_result_table
|
||||
|
||||
Reference in New Issue
Block a user