修改Calman灰阶中结果图显示、修改UI主题样式应用

This commit is contained in:
xinzhu.yin
2026-06-04 10:36:15 +08:00
parent 3aa975c4d3
commit 49d82da8b9
16 changed files with 597 additions and 210 deletions

View File

@@ -15,6 +15,7 @@ import ttkbootstrap as ttk
from PIL import Image, ImageTk
from app.services import ai_image as _svc
from app.views.modern_styles import apply_tooltip_theme, get_theme_palette
from typing import TYPE_CHECKING
@@ -26,17 +27,19 @@ logger = logging.getLogger(__name__)
def _theme_colors():
style = ttk.Style()
colors = style.colors
palette = get_theme_palette()
return {
"bg": colors.bg,
"fg": colors.fg,
"muted": colors.secondary,
"input_bg": colors.inputbg,
"input_fg": colors.inputfg,
"select_bg": colors.selectbg,
"select_fg": colors.selectfg,
"border": colors.border,
"bg": palette["bg"],
"fg": palette["fg"],
"muted": palette["muted_fg"],
"input_bg": palette["input_bg"],
"input_fg": palette["input_fg"],
"select_bg": palette["select_bg"],
"select_fg": palette["select_fg"],
"border": palette["border"],
"tooltip_bg": palette["tooltip_bg"],
"tooltip_fg": palette["tooltip_fg"],
"tooltip_border": palette["tooltip_border"],
}
@@ -95,8 +98,6 @@ def _show_tree_tooltip(self: "PQAutomationApp", text: str, x_root: int, y_root:
text="",
justify=tk.LEFT,
anchor=tk.W,
bg="#ffffff",
fg="#1f2937",
relief=tk.SOLID,
bd=1,
padx=8,
@@ -104,6 +105,7 @@ def _show_tree_tooltip(self: "PQAutomationApp", text: str, x_root: int, y_root:
font=("微软雅黑", 9),
wraplength=520,
)
apply_tooltip_theme(tip, label)
label.pack(fill=tk.BOTH, expand=True)
self._ai_image_tooltip = tip
self._ai_image_tooltip_label = label
@@ -114,6 +116,7 @@ def _show_tree_tooltip(self: "PQAutomationApp", text: str, x_root: int, y_root:
self._ai_image_tooltip_item = item_id
label.configure(text=text)
apply_tooltip_theme(tip, label)
tip.geometry(f"+{x_root + 14}+{y_root + 18}")
tip.deiconify()
tip.lift()
@@ -1225,6 +1228,16 @@ def _build_ucd_resized_image(image_path: str, target_w: int, target_h: int) -> s
return out_path
def refresh_ai_image_theme(self: "PQAutomationApp"):
"""刷新 AI 图片面板中的主题相关控件。"""
if hasattr(self, "_apply_ai_image_list_style"):
self._apply_ai_image_list_style()
tip = getattr(self, "_ai_image_tooltip", None)
label = getattr(self, "_ai_image_tooltip_label", None)
if tip is not None and label is not None:
apply_tooltip_theme(tip, label)
class AIImagePanelMixin:
"""由 tools/refactor_to_mixins.py 自动生成。
把本模块的自由函数挂到 PQAutomationApp 上,便于 F12 跳转与类型推断。
@@ -1249,3 +1262,5 @@ class AIImagePanelMixin:
_rename_current = _rename_current
_show_list_context_menu = _show_list_context_menu
_send_to_ucd = _send_to_ucd
_apply_ai_image_list_style = _apply_ai_image_list_style
refresh_ai_image_theme = refresh_ai_image_theme