feat: add outfit output directory
This commit is contained in:
@@ -245,7 +245,7 @@ class AiOutfitPanel(QWidget):
|
||||
self._excel_edit.setPlaceholderText("选择商品表 .xlsx")
|
||||
col.addLayout(self._inline_path_row("Excel", self._excel_edit, self._browse_excel))
|
||||
self._output_edit = QLineEdit()
|
||||
self._output_edit.setPlaceholderText("默认:程序旁的「合并后的图片」")
|
||||
self._output_edit.setPlaceholderText("默认:程序旁的「穿搭图片」")
|
||||
col.addLayout(self._inline_path_row("输出", self._output_edit, self._browse_output))
|
||||
|
||||
# 穿搭生成话术(多套模板;加大,随窗口高度拉伸)
|
||||
@@ -467,7 +467,11 @@ class AiOutfitPanel(QWidget):
|
||||
def apply_config(self, config):
|
||||
"""Populate widgets from the merged app config + load models/prompt."""
|
||||
self._excel_edit.setText(config.get("outfit_excel", ""))
|
||||
self._output_edit.setText(config.get("outfit_output_dir", ""))
|
||||
outfit_output_dir = str(config.get("outfit_output_dir", "") or "").strip()
|
||||
if not outfit_output_dir:
|
||||
from services.file_service import get_outfit_output_dir
|
||||
outfit_output_dir = str(get_outfit_output_dir())
|
||||
self._output_edit.setText(outfit_output_dir)
|
||||
self._concurrency.setValue(int(config.get("outfit_concurrency", 1) or 1))
|
||||
self._interval.setValue(float(config.get("outfit_request_interval", 2.0) or 0.0))
|
||||
self._cooldown.setValue(float(config.get("outfit_task_cooldown", 1.0) or 0.0))
|
||||
@@ -787,8 +791,8 @@ class AiOutfitPanel(QWidget):
|
||||
|
||||
output_dir = self._output_edit.text().strip()
|
||||
if not output_dir:
|
||||
from services.file_service import get_output_dir
|
||||
output_dir = str(get_output_dir())
|
||||
from services.file_service import get_outfit_output_dir
|
||||
output_dir = str(get_outfit_output_dir())
|
||||
|
||||
from core.outfit_batch import OutfitBatchOptions
|
||||
options = OutfitBatchOptions(
|
||||
@@ -965,8 +969,8 @@ class AiOutfitPanel(QWidget):
|
||||
def _open_output_dir(self):
|
||||
path = self._output_edit.text().strip()
|
||||
if not path:
|
||||
from services.file_service import get_output_dir
|
||||
path = str(get_output_dir())
|
||||
from services.file_service import get_outfit_output_dir
|
||||
path = str(get_outfit_output_dir())
|
||||
QDesktopServices.openUrl(QUrl.fromLocalFile(path))
|
||||
|
||||
def _export_failures(self):
|
||||
|
||||
@@ -91,8 +91,9 @@ def _is_dir_writable(path):
|
||||
return False
|
||||
|
||||
|
||||
# Default export folder name, placed next to Launcher.exe in the packaged layout.
|
||||
# Default export folder names, placed next to Launcher.exe in the packaged layout.
|
||||
_OUTPUT_DIR_NAME = "合并后的图片"
|
||||
_OUTFIT_OUTPUT_DIR_NAME = "穿搭图片"
|
||||
|
||||
|
||||
def get_output_dir():
|
||||
@@ -114,6 +115,28 @@ def get_output_dir():
|
||||
return d
|
||||
|
||||
|
||||
def get_outfit_output_dir():
|
||||
"""Return the default AI outfit output directory as a Path.
|
||||
|
||||
Packaged: <install root>\\穿搭图片 (next to Launcher.exe, not inside app\\).
|
||||
Falls back to <data_dir>/output/穿搭图片 if the preferred location is not
|
||||
writable. Development: <project root>/穿搭图片.
|
||||
|
||||
User-selected outfit_output_dir still takes precedence in the UI.
|
||||
"""
|
||||
if getattr(sys, "frozen", False):
|
||||
candidate = get_app_dir().parent / _OUTFIT_OUTPUT_DIR_NAME
|
||||
else:
|
||||
candidate = get_app_dir() / _OUTFIT_OUTPUT_DIR_NAME
|
||||
|
||||
if _is_dir_writable(candidate):
|
||||
return candidate
|
||||
|
||||
d = get_data_dir() / "output" / _OUTFIT_OUTPUT_DIR_NAME
|
||||
d.mkdir(parents=True, exist_ok=True)
|
||||
return d
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 文件夹扫描
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user