fix:优化配置存储

This commit is contained in:
2026-01-30 00:19:09 +08:00
parent 6a0c826a06
commit 02cbd256d8
18 changed files with 228 additions and 420 deletions

View File

@@ -4,14 +4,13 @@
import os
import platform
import shutil
import time
from pathlib import Path
from loguru import logger
from config.config import load_config
config = load_config("config.toml")
config = load_config()
def get_system_fonts():

View File

@@ -1,20 +1,17 @@
import os
import threading
import time
import pythoncom
import pandas as pd
from loguru import logger
from pptx import Presentation
from rich.console import Console
import traceback
import comtypes.client
import pandas as pd
import pythoncom
from loguru import logger
from pptx import Presentation
from config.config import load_config
from utils.agent_utils import generate_comment
from utils.file_utils import check_file_exists, get_output_pptx_files
from utils.image_utils import find_image_path
from utils.zodiac_utils import calculate_zodiac
from utils.growt_utils import (
replace_one_page,
replace_two_page,
@@ -22,6 +19,8 @@ from utils.growt_utils import (
replace_four_page,
replace_five_page,
)
from utils.image_utils import find_image_path
from utils.zodiac_utils import calculate_zodiac
# ==========================================
@@ -35,7 +34,7 @@ def generate_template(stop_event: threading.Event = None, progress_callback=None
"""
# 1. 加载配置文件
try:
config = load_config("config.toml")
config = load_config()
except Exception as e:
logger.error(f"配置文件获取失败: {str(e)}")
# 打印详细报错位置,方便调试
@@ -89,7 +88,7 @@ def generate_comment_all(stop_event: threading.Event = None, progress_callback=N
"""
# 1. 加载配置文件
try:
config = load_config("config.toml")
config = load_config()
except Exception as e:
logger.error(f"配置文件获取失败: {str(e)}")
# 打印详细报错位置,方便调试
@@ -184,7 +183,7 @@ def generate_report(stop_event: threading.Event = None, progress_callback=None):
:params progress_callback 进度回调函数
""" # 1. 加载配置文件
try:
config = load_config("config.toml")
config = load_config()
except Exception as e:
logger.error(f"配置文件获取失败: {str(e)}")
# 打印详细报错位置,方便调试
@@ -316,6 +315,7 @@ def generate_report(stop_event: threading.Event = None, progress_callback=None):
class_image_path = find_image_path(
config["image_folder"], config["class_name"]
)
print(config["image_folder"], config["class_name"])
# 添加检查班级图片是否存在,若不存在则跳过
if check_file_exists(class_image_path):
@@ -378,7 +378,7 @@ def generate_convert_pdf(stop_event: threading.Event = None, progress_callback=N
"""
# 1. 加载配置文件
try:
config = load_config("config.toml")
config = load_config()
except Exception as e:
logger.error(f"配置文件获取失败: {str(e)}")
# 打印详细报错位置,方便调试
@@ -470,7 +470,7 @@ def generate_zodiac(stop_event: threading.Event = None, progress_callback=None):
"""
# 1. 加载配置文件
try:
config = load_config("config.toml")
config = load_config()
except Exception as e:
logger.error(f"配置文件获取失败: {str(e)}")
# 打印详细报错位置,方便调试
@@ -559,7 +559,7 @@ def generate_signature(progress_callback=None) -> str:
"""
# 1. 加载配置文件
try:
config = load_config("config.toml")
config = load_config()
except Exception as e:
logger.error(f"配置文件获取失败: {str(e)}")
# 打印详细报错位置,方便调试

View File

@@ -1,5 +1,5 @@
from rich.console import Console
from loguru import logger
from rich.console import Console
from config.config import load_config
from utils.pptx_utils import replace_text_in_slide, replace_picture
@@ -10,7 +10,7 @@ console = Console()
# ==========================================
# 1. 配置区域 (Configuration)
# ==========================================
config = load_config("config.toml")
config = load_config()
def replace_one_page(prs, name, class_name):