添加信号格式修改

This commit is contained in:
xinzhu.yin
2026-05-22 11:31:36 +08:00
parent c42287b7d7
commit 9b2bc44e17
14 changed files with 434 additions and 356 deletions

View File

@@ -3,6 +3,7 @@
from __future__ import annotations
import os
import sys
import threading
import tkinter as tk
from tkinter import filedialog, messagebox, simpledialog
@@ -193,6 +194,15 @@ def toggle_ai_image_panel(self):
self.show_panel("ai_image")
def _get_app_base_dir(self) -> str:
"""返回应用根目录settings 的上一级)。"""
if getattr(self, "config_file", None):
return os.path.dirname(os.path.dirname(self.config_file))
if getattr(sys, "frozen", False):
return os.path.dirname(sys.executable)
return os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
# ---------------- 列表 / 选中 ----------------
@@ -203,7 +213,7 @@ def reload_ai_image_list(self, auto_select_first=True):
其下列出该轮生成的所有图片。会话按"最近使用"倒序,组内按时间倒序。
auto_select_first: 是否自动选中第一张图片(默认 True
"""
self.ai_image_records = _svc.list_records()
self.ai_image_records = _svc.list_records(base_dir=_get_app_base_dir(self))
self.ai_image_listbox.delete(0, tk.END)
# 维护行号 → 记录索引的映射;分隔头处为 None
self._ai_image_row_map = []
@@ -414,6 +424,7 @@ def _send_prompt(self):
prompt,
on_success=_success,
on_error=_error,
base_dir=_get_app_base_dir(self),
cancel_event=self._ai_image_cancel_event,
)
return
@@ -422,6 +433,7 @@ def _send_prompt(self):
prompt,
on_success=_success,
on_error=_error,
base_dir=_get_app_base_dir(self),
cancel_event=self._ai_image_cancel_event,
)