fix:优化一些命名规范

This commit is contained in:
2025-12-21 23:17:35 +08:00
parent ba7dd09037
commit 3c60b3e7ca
6 changed files with 96 additions and 51 deletions

2
.gitignore vendored
View File

@@ -12,3 +12,5 @@ output/*.pptx
output/*.pdf
data/images/*
data/*.xlsx
.idea/

86
.idea/workspace.xml generated
View File

@@ -4,10 +4,13 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="41690157-d51b-4dae-98de-6b96990d681a" name="更改" comment="fix修复一些BUG">
<list default="true" id="41690157-d51b-4dae-98de-6b96990d681a" name="更改" comment="fix优化一些命名规范">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/IFLOW.md" beforeDir="false" afterPath="$PROJECT_DIR$/IFLOW.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config.toml" beforeDir="false" afterPath="$PROJECT_DIR$/config.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main_nicegui.py" beforeDir="false" afterPath="$PROJECT_DIR$/main_nicegui.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ui/views/home_page.py" beforeDir="false" afterPath="$PROJECT_DIR$/ui/views/home_page.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -17,33 +20,34 @@
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"customColor": "",
"associatedIndex": 0
}]]></component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 0
}</component>
<component name="ProjectId" id="3744WiSuPrq64wZVLisMf4zKTFq" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ModuleVcsDetector.initialDetectionPerformed": "true",
"Python.main_nicegui.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
"RunOnceActivity.git.unshallow": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"git-widget-placeholder": "master",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
&quot;Python.main_nicegui.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.lookFeel&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}]]></component>
}</component>
<component name="RunManager">
<configuration name="main_nicegui" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="growth_report" />
@@ -59,6 +63,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="RUN_TOOL" value="" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main_nicegui.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
@@ -74,6 +79,14 @@
</list>
</recent_temporary>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-js-predefined-d6986cc7102b-9b0f141eb926-JavaScript-PY-253.29346.142" />
<option value="bundled-python-sdk-f2b7a9f6281b-6e1f45a539f7-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-253.29346.142" />
</set>
</attachedChunks>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="默认任务">
<changelist id="41690157-d51b-4dae-98de-6b96990d681a" name="更改" comment="" />
@@ -81,7 +94,14 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1766149044347</updated>
<workItem from="1766149046808" duration="3556000" />
<workItem from="1766149046808" duration="4371000" />
<workItem from="1766155304645" duration="34000" />
<workItem from="1766155493490" duration="387000" />
<workItem from="1766155896565" duration="429000" />
<workItem from="1766160535280" duration="21000" />
<workItem from="1766256207534" duration="960000" />
<workItem from="1766287241685" duration="2135000" />
<workItem from="1766329711762" duration="536000" />
</task>
<task id="LOCAL-00001" summary="fix修复一些BUG">
<option name="closed" value="true" />
@@ -99,7 +119,15 @@
<option name="project" value="LOCAL" />
<updated>1766151466883</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="fix优化一些命名规范">
<option name="closed" value="true" />
<created>1766152994686</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1766152994686</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -118,9 +146,13 @@
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="fix修复一些BUG" />
<option name="LAST_COMMIT_MESSAGE" value="fix修复一些BUG" />
<MESSAGE value="fix优化一些命名规范" />
<option name="LAST_COMMIT_MESSAGE" value="fix优化一些命名规范" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REARRANGE_BEFORE_PROJECT_COMMIT" value="true" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/growth_report$main_nicegui.coverage" NAME="main_nicegui 覆盖结果" MODIFIED="1766150538951" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/growth_report$main_nicegui.coverage" NAME="main_nicegui 覆盖结果" MODIFIED="1766329725535" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
</project>

View File

@@ -2,7 +2,7 @@
## 项目概述
这是一个基于Python的自动化幼儿园成长报告生成系统。该系统可以从Excel数据文件中读取幼儿信息结合AI生成个性化评语并将所有信息批量填充到PPT模板中最终生成每个学生的个性化成长报告。系统支持双界面运行命令行界面、图形界面和NiceGUI界面具备字体安装、图片替换、批量PDF转换、生肖计算功能。
基于Python的自动化幼儿园学期成长报告生成系统。该系统可以从Excel数据文件中读取幼儿信息结合AI生成个性化评语并将所有信息批量填充到PPT模板中最终生成每个学生的个性化成长报告。系统支持UI界面操作具备字体安装、图片替换、批量PDF转换、生肖计算、模板导出等完整功能。
## 技术栈
@@ -47,17 +47,23 @@
- 批量更新Excel中的生肖信息
- 支持日期格式自动识别
### 6. 导出数据模板 (📦 导出数据模板)
### 6. 园长一键签名 (💴 园长一键签名)
- 一键为所有生成的报告添加园长签名
- 自动识别输出文件夹中的PPT文件
- 批量替换签名占位符为实际签名图片
### 7. 导出数据模板 (📦 导出数据模板)
- 生成标准化的数据模板ZIP包
- 包含示例Excel文件和图片文件夹结构
- 方便新用户快速上手
### 7. 初始化系统 (📤 初始化系统)
### 8. 初始化系统 (📤 初始化系统)
- 自动创建必要的目录结构
- 安装所需字体文件
- 配置系统环境
### 8. 字体安装 (🔤 字体安装)
### 9. 字体安装 (🔤 字体安装)
- 自动检测系统是否安装了指定字体
- 自动安装项目所需的字体文件
- 支持方正兰亭黑简体和方正少儿简体字体
@@ -70,7 +76,7 @@ growth_report/
├── UI.py # 图形用户界面入口tkinter
├── main_nicegui.py # NiceGUI界面入口
├── main.pyw # Windows图形界面启动文件
├── config.env.toml # 项目配置文件
├── config.toml # 项目配置文件
├── pyproject.toml # 项目依赖配置
├── start_app.bat # Windows启动批处理文件
├── README.md # 项目说明文档
@@ -199,7 +205,7 @@ pip install -r requirements.txt
### 初始化设置
1. 编辑`config.env.toml`配置文件设置API密钥和其他参数
1. 编辑`config.toml`配置文件设置API密钥和其他参数
2. 准备Excel数据文件按指定格式
3. 准备图片资源文件夹(按指定结构)
4. 准备PPT模板文件

View File

@@ -60,7 +60,7 @@ pip install -r requirements.txt
### 3. 配置系统
编辑 `config.env.toml` 文件,设置以下信息:
编辑 `config.toml` 文件,设置以下信息:
- AI API密钥和配置
- 班级信息和教师名单
@@ -140,7 +140,7 @@ growth_report/
├── UI.py # 图形用户界面入口tkinter
├── main_nicegui.py # NiceGUI界面入口
├── main.pyw # Windows图形界面启动文件
├── config.env.toml # 项目配置文件
├── config.toml # 项目配置文件
├── pyproject.toml # 项目依赖配置
├── start_app.bat # 启动脚本
├── README.md # 项目说明文档
@@ -204,7 +204,7 @@ growth_report/
### AI配置
`config.env.toml` 中配置AI模型
`config.toml` 中配置AI模型
```toml
[ai]

View File

@@ -4,7 +4,7 @@ output_folder = "output"
excel_file = "names.xlsx"
image_folder = "images"
fonts_dir = "fonts"
signature_image = "C:\\Users\\Administrator\\Desktop\\文档资料\\code\\growth_report\\data\\"
signature_image = "D:\\working\\tools\\growth_report\\data\\"
[class_info]
class_name = "K3A"

View File

@@ -1,17 +1,17 @@
import os
import sys
from nicegui import ui, app, run, native
from loguru import logger
from screeninfo import get_monitors
import traceback
from loguru import logger
from nicegui import ui, app, run, native
from screeninfo import get_monitors
from config.config import load_config
# 导入我们的模块
from ui.core.logger import setup_logger
from utils.font_utils import install_fonts_from_directory
from ui.views.home_page import create_home_page
from ui.views.config_page import create_config_page
from ui.views.home_page import create_home_page
from utils.font_utils import install_fonts_from_directory
sys.stdout.reconfigure(encoding='utf-8')
sys.stderr.reconfigure(encoding='utf-8')
@@ -20,6 +20,7 @@ config = load_config("config.toml")
setup_logger()
# === 关键修改:定义一个获取路径的通用函数 ===
def get_path(relative_path):
"""
@@ -69,20 +70,24 @@ def calculate_window_size():
logger.warning(f"无法获取屏幕分辨率 ({e}),使用默认大小 (900, 900)")
return 900, 900 # 失败时的默认值
# 1. 挂载静态资源 (CSS/图片)
# 注意:这里使用 get_path 确保打包后能找到
static_dir = get_path(os.path.join("ui", "assets"))
app.add_static_files('/assets', static_dir)
# 3. 页面路由
@ui.page('/')
def index_page():
create_home_page()
@ui.page('/config')
def config_page():
create_config_page()
# 4. 启动时钩子
async def startup_check():
try: