fix:优化一些命名规范
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -11,4 +11,6 @@ wheels/
|
||||
output/*.pptx
|
||||
output/*.pdf
|
||||
data/images/*
|
||||
data/*.xlsx
|
||||
data/*.xlsx
|
||||
|
||||
.idea/
|
||||
86
.idea/workspace.xml
generated
86
.idea/workspace.xml
generated
@@ -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">{
|
||||
"customColor": "",
|
||||
"associatedIndex": 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">{
|
||||
"keyToString": {
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"Python.main_nicegui.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.typescript.service.memoryLimit.init": "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": "preferences.lookFeel",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></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>
|
||||
18
IFLOW.md
18
IFLOW.md
@@ -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模板文件
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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):
|
||||
"""
|
||||
@@ -47,42 +48,46 @@ def calculate_window_size():
|
||||
m = monitors[0]
|
||||
screen_width = m.width
|
||||
screen_height = m.height
|
||||
|
||||
|
||||
# 设置窗口宽度为屏幕宽度的 30%
|
||||
target_width = int(screen_width * 0.30)
|
||||
# 设置窗口高度为屏幕高度的 60%
|
||||
target_height = int(screen_height * 0.60)
|
||||
|
||||
|
||||
# 确保窗口有一个合理的最小值 (例如 800x600)
|
||||
min_width = 800
|
||||
min_height = 700
|
||||
|
||||
|
||||
target_width = max(target_width, min_width)
|
||||
target_height = max(target_height, min_height)
|
||||
|
||||
|
||||
logger.info(f"屏幕分辨率: {screen_width}x{screen_height}")
|
||||
logger.info(f"设置窗口大小为: {target_width}x{target_height}")
|
||||
|
||||
|
||||
return target_width, target_height
|
||||
|
||||
|
||||
except Exception as e:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user