fix:修复一些BUG

This commit is contained in:
2025-12-19 21:37:44 +08:00
parent 14b8c19dfe
commit 842a7cce64
13 changed files with 88 additions and 203 deletions

View File

@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="uv (growth_report)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
@@ -7,7 +12,7 @@
<component name="TemplatesService">
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/templates" />
<option value="$MODULE_DIR$/script/dist/尚城幼儿园幼儿学期发展报告/templates" />
</list>
</option>
</component>

View File

@@ -1,56 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<list>
<option value="loguru" />
<option value="APScheduler" />
<option value="watchdog" />
<option value="aiohttp" />
<option value="aiofiles" />
<option value="pydantic" />
<option value="SQLAlchemy" />
<option value="aiosqlite" />
<option value="fastapi" />
<option value="uvicorn" />
<option value="python-multipart" />
<option value="jinja2" />
<option value="itsdangerous" />
<option value="pillow" />
<option value="filetype" />
<option value="pydub" />
<option value="pysilk-mod" />
<option value="pymediainfo" />
<option value="py7zr" />
<option value="requests" />
<option value="httpx" />
<option value="tabulate" />
<option value="qrcode" />
<option value="psutil" />
<option value="tomli_w" />
<option value="websockets" />
<option value="redis" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N806" />
<option value="N802" />
<option value="N803" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="type.*" />
</list>
</option>
</inspection_tool>
<inspection_tool class="SqlNoDataSourceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

2
.idea/misc.xml generated
View File

@@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="uv (growth_report)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="uvgrowth_report" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="uv (growth_report)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/growth_report.iml" filepath="$PROJECT_DIR$/.idea/growth_report.iml" />
</modules>
</component>
</project>

2
.idea/vcs.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>

175
.idea/workspace.xml generated
View File

@@ -4,90 +4,56 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="e258c58a-2a5f-4fad-9d39-8dc186b6b5a7" name="更改" comment="fix:更新项目说明文档">
<list default="true" id="41690157-d51b-4dae-98de-6b96990d681a" name="更改" comment="">
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/growth_report.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/growth_report.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/config.py" beforeDir="false" afterPath="$PROJECT_DIR$/config/config.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/names.xlsx" beforeDir="false" afterPath="$PROJECT_DIR$/data/names.xlsx" 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/config_page.py" beforeDir="false" afterPath="$PROJECT_DIR$/ui/views/config_page.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 0
}</component>
<component name="ProjectId" id="36mY8RowM4y8kcGPt6V9WQiPGN9" />
<component name="ProjectColorInfo"><![CDATA[{
"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">{
&quot;keyToString&quot;: {
&quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
&quot;Python.flet_ui_main.pyw.executor&quot;: &quot;Run&quot;,
&quot;Python.main.pyw.executor&quot;: &quot;Run&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;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/working/tools/growth_report&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;com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<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>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\working\tools\growth_report" />
<recent name="D:\working\tools\growth_report\data" />
<recent name="D:\working\tools\growth_report\script\dist" />
<recent name="D:\working\tools\growth_report\ui\assets" />
<recent name="D:\working\tools\growth_report\public" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\working\tools\growth_report\script\dist\data" />
</key>
</component>
<component name="RunManager" selected="Python.main_nicegui">
<configuration name="flet_ui_main.pyw" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="growth_report" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/flet_ui_main.pyw.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
}]]></component>
<component name="RunManager">
<configuration name="main_nicegui" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="growth_report" />
<option name="ENV_FILES" value="" />
@@ -111,90 +77,27 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="main.pyw" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="growth_report" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.pyw" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.main_nicegui" />
<item itemvalue="Python.flet_ui_main.pyw" />
<item itemvalue="Python.main.pyw" />
</list>
</recent_temporary>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="默认任务">
<changelist id="e258c58a-2a5f-4fad-9d39-8dc186b6b5a7" name="更改" comment="" />
<created>1765613055475</created>
<changelist id="41690157-d51b-4dae-98de-6b96990d681a" name="更改" comment="" />
<created>1766149044347</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1765613055475</updated>
<workItem from="1765613057798" duration="372000" />
<workItem from="1765613448098" duration="48000" />
<workItem from="1765613503892" duration="19160000" />
<workItem from="1765638479255" duration="12000" />
<workItem from="1765638935533" duration="5136000" />
<workItem from="1765704332562" duration="272000" />
<updated>1766149044347</updated>
<workItem from="1766149046808" duration="2127000" />
</task>
<task id="LOCAL-00001" summary="fix:修复一些BUG">
<option name="closed" value="true" />
<created>1765626269402</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1765626269402</updated>
</task>
<task id="LOCAL-00002" summary="fix:添加niceGui库美化页面">
<option name="closed" value="true" />
<created>1765631607389</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1765631607389</updated>
</task>
<task id="LOCAL-00003" summary="fix:更新项目说明文档">
<option name="closed" value="true" />
<created>1765637863352</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1765637863352</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="fix:修复一些BUG" />
<MESSAGE value="fix:添加niceGui库美化页面" />
<MESSAGE value="fix:更新项目说明文档" />
<option name="LAST_COMMIT_MESSAGE" value="fix:更新项目说明文档" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/growth_report$main_pyw.coverage" NAME="main.pyw 覆盖结果" MODIFIED="1765626787983" 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$flet_ui_main_pyw.coverage" NAME="flet_ui_main.pyw 覆盖结果" MODIFIED="1765627407579" 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="1765631173809" 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="1766150538951" 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

@@ -5,7 +5,7 @@
## 项目概述
基于Python的自动化幼儿园学期成长报告生成系统。该系统可以从Excel数据文件中读取幼儿信息结合AI生成个性化评语并将所有信息批量填充到PPT模板中最终生成每个学生的个性化成长报告。系统支持界面操作命令行界面、图形界面和NiceGUI界面具备字体安装、图片替换、批量PDF转换、生肖计算、模板导出等完整功能。
基于Python的自动化幼儿园学期成长报告生成系统。该系统可以从Excel数据文件中读取幼儿信息结合AI生成个性化评语并将所有信息批量填充到PPT模板中最终生成每个学生的个性化成长报告。系统支持UI界面操作具备字体安装、图片替换、批量PDF转换、生肖计算、模板导出等完整功能。
## ✨ 主要特性

25
config.toml Normal file
View File

@@ -0,0 +1,25 @@
[paths]
source_file = "(横板)中班 幼儿学期发展报告.pptx"
output_folder = "output"
excel_file = "names.xlsx"
image_folder = "images"
fonts_dir = "fonts"
signature_image = "C:\\Users\\Administrator\\Desktop\\文档资料\\code\\growth_report\\data\\"
[class_info]
class_name = "K3A"
teachers = [
"丁文敏",
"麦芷晴",
"徐焕奎",
]
[defaults]
default_comment = ""
age_group = "中班上学期"
[ai]
api_key = "sk-8b0c9522df8843b4d0e7e91ecb628957"
api_url = "https://apis.iflow.cn/v1/chat/completions"
model = "deepseek-v3.2"
prompt = "# Role\n你是一位拥有20年经验的资深幼儿园主班老师。你的文笔温暖、细腻、充满爱意擅长发现每个孩子身上独特的闪光点。你的评语风格是“治愈系”的能让家长读完后感到欣慰并对未来充满希望。\n\n# Goal\n请根据用户提供的【幼儿姓名】、【年龄段/班级】以及【日常表现关键词/评分数据】,撰写一份高质量的学期末成长评语。\n\n# Constraints & Rules\n1. **严格的格式排版 (Strict Formatting)**:\n - **换行**:正文中间不要随意换行,保持为一段完整的段落。\n\n2. **称呼处理**:\n - 自动识别用户输入的姓名,去掉姓氏。\n - 例如:“王小明” -> 第一行输出“小明宝贝:”。\n\n3. **分龄侧重 (根据 Age_Group 调整侧重点)**:\n - **小班 (3-4岁)**:侧重于适应集体生活、情绪稳定性、基本生活自理能力、愿意与老师互动。\n - **中班 (4-5岁)**:侧重于社交互动、分享与合作、动手能力、好奇心、规则意识。\n - **大班 (5-6岁)**:侧重于学习习惯、逻辑思维、领导力、任务意识、幼小衔接准备。\n\n4. **写作结构 (固定内容)**:\n - **开头**:固定文本必须包含:“本学期开展了柏克莱主题课程(语言、社会、科学、艺术、健康);英语及特色课程(体能、舞蹈、美工、魔力猴、足球、国学)。”\n - **正文**:结合【表现关键词】和【性别】,具体描述进步和优点。\n - **结尾**:委婉地提出期望(“如果你能...老师会更为你骄傲”),并送上祝福。\n\n5. **语气风格**:\n - 积极正面,多用肯定句。\n - 字数控制在 150-250 字之间。\n\n# Input Format\n- Name {{name}}\n- Age_Group {{class_name}}\n- Traits {{traits}}\n- Sex {{sex}}\n\n# Output Example\n(假设输入:Name=张图图, Age_Group=小班, Traits=适应能力强, 爱笑, 挑食,Sex=女)\n图图宝贝你好本学期开展了柏克莱主题课程语言、社会、科学、艺术、健康英语及特色课程体能、舞蹈、美工、魔力猴、足球、国学。你是一个爱笑的小天使每天早上都能看到你甜甜的笑脸。从一开始的哭鼻子到现在能开心地参与游戏你的适应能力让老师感到惊喜。不过老师发现你在吃饭时偶尔会把不喜欢的青菜挑出来哦。如果你能和青菜宝宝做好朋友把身体练得棒棒的那就更完美啦祝可爱的图图宝贝新年快乐健康成长\n"

View File

@@ -98,7 +98,7 @@ def save_config(config_data, config_filename="config.toml"):
"excel_file": os.path.basename(config_data.get("excel_file", "")),
"image_folder": os.path.basename(config_data.get("image_folder", "")),
"fonts_dir": os.path.basename(config_data.get("fonts_dir", "fonts")),
"signature_image": get_resource_path(os.path.join("data", paths.get("signature_image", ""))),
"signature_image": get_resource_path(os.path.join("data", config_data.get("signature_image", ""))),
},
"class_info": {
"class_name": config_data.get("class_name", ""),

Binary file not shown.

View File

@@ -48,10 +48,10 @@ def calculate_window_size():
screen_width = m.width
screen_height = m.height
# 设置窗口宽度为屏幕宽度的 70%
target_width = int(screen_width * 0.70)
# 设置窗口高度为屏幕高度的 80%
target_height = int(screen_height * 0.80)
# 设置窗口宽度为屏幕宽度的 30%
target_width = int(screen_width * 0.30)
# 设置窗口高度为屏幕高度的 60%
target_height = int(screen_height * 0.60)
# 确保窗口有一个合理的最小值 (例如 800x600)
min_width = 800

View File

@@ -27,12 +27,12 @@ def create_config_page():
with ui.header().classes('app-header items-center justify-between shadow-md'):
# 左侧:图标和标题
with ui.row().classes('items-center gap-2'):
ui.button(icon='arrow_back', on_click=lambda: ui.navigate.to('/')).props('flat round color=white')
ui.image('/assets/icon.ico').classes('w-8 h-8').props('fit=contain')
ui.label('尚城幼儿园成长报告助手').classes('text-xl font-bold')
# 右侧:署名 + 配置按钮
with ui.row().classes('items-center gap-4'):
ui.label('By 寒寒 | 这里的每一份评语都充满爱意').classes('text-xs opacity-90')
ui.button(icon='home', on_click=lambda: ui.navigate.to('/')).props('flat round color=white')
# 修改点 3使用 flex 布局撑满
with ui.card().classes('w-full max-w-5xl mx-auto shadow-lg main-card p-0'):