feat(export): 批量导出生成 Excel 后弹窗提示用户 (§17.24)
Excel 成功写入后弹出 QMessageBox,显示文件路径并引导切换 到「AI 穿搭」页直接使用;无有效印花子目录时不弹框。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -395,13 +395,25 @@ class QueuePanel(QWidget):
|
||||
|
||||
self._running = False
|
||||
self._batch_btn.setText("开始批量导出")
|
||||
self._write_outfit_excel(run_dir)
|
||||
excel_path = self._write_outfit_excel(run_dir)
|
||||
if excel_path:
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
QMessageBox.information(
|
||||
self,
|
||||
"AI 穿搭 Excel 已生成",
|
||||
"已生成 AI 穿搭 Excel 文件:\n{}\n\n可切换到「AI 穿搭」页,选择该文件直接开始生成穿搭图。".format(
|
||||
excel_path
|
||||
),
|
||||
)
|
||||
|
||||
def _write_outfit_excel(self, run_dir):
|
||||
"""Generate an AI-outfit source Excel alongside *run_dir* (docs/02 §6.12)."""
|
||||
"""Generate an AI-outfit source Excel alongside *run_dir* (docs/02 §6.12).
|
||||
|
||||
Returns the excel path string on success, None if skipped or failed.
|
||||
"""
|
||||
run_path = Path(run_dir)
|
||||
if not run_path.is_dir():
|
||||
return
|
||||
return None
|
||||
_img_exts = {".png", ".jpg", ".jpeg", ".webp", ".gif"}
|
||||
rows = []
|
||||
for subdir in sorted(run_path.iterdir(), key=lambda p: p.name.lower()):
|
||||
@@ -410,12 +422,14 @@ class QueuePanel(QWidget):
|
||||
if any(f.suffix.lower() in _img_exts for f in subdir.iterdir() if f.is_file()):
|
||||
rows.append((subdir.name, str(subdir) + os.sep))
|
||||
if not rows:
|
||||
return
|
||||
return None
|
||||
excel_path = run_path.with_suffix(".xlsx")
|
||||
try:
|
||||
write_outfit_source_excel(excel_path, rows)
|
||||
return str(excel_path)
|
||||
except Exception as exc:
|
||||
logger.error("Failed to write outfit source Excel: %s", exc)
|
||||
return None
|
||||
|
||||
def _image_size(self, path):
|
||||
"""Return (w, h) for path, caching within a run. None if unreadable."""
|
||||
|
||||
Reference in New Issue
Block a user