26 lines
668 B
Python
26 lines
668 B
Python
"""
|
|
运行时配置 — 端口、路径、账号由自动探测设置,无需配置文件。
|
|
"""
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# ---- 自动探测的配置项(默认值仅占位,启动时自动修正) ----
|
|
miniQMTPath: str = ''
|
|
account_no: str = ''
|
|
log_level: str = 'INFO'
|
|
console_log: bool = True
|
|
use_simulated_qmt: bool = False
|
|
|
|
|
|
def app_dir() -> Path:
|
|
"""应用根目录(兼容开发环境与打包后的 exe)"""
|
|
if getattr(sys, 'frozen', False):
|
|
return Path(sys.executable).parent
|
|
return Path(__file__).resolve().parent
|
|
|
|
|
|
def log_file_path() -> Path:
|
|
"""日志文件路径"""
|
|
return app_dir() / 'sfgrid.log'
|