fix:优化一些命名规范

This commit is contained in:
2025-12-19 22:03:13 +08:00
parent f64f005292
commit ba7dd09037
3 changed files with 40 additions and 17 deletions

47
.idea/workspace.xml generated
View File

@@ -4,19 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="41690157-d51b-4dae-98de-6b96990d681a" name="更改" comment=""> <list default="true" id="41690157-d51b-4dae-98de-6b96990d681a" name="更改" comment="fix修复一些BUG">
<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$/.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$/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" /> <change beforePath="$PROJECT_DIR$/ui/views/home_page.py" beforeDir="false" afterPath="$PROJECT_DIR$/ui/views/home_page.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -90,13 +81,45 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1766149044347</updated> <updated>1766149044347</updated>
<workItem from="1766149046808" duration="2127000" /> <workItem from="1766149046808" duration="3556000" />
</task> </task>
<task id="LOCAL-00001" summary="fix修复一些BUG">
<option name="closed" value="true" />
<created>1766151464355</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1766151464355</updated>
</task>
<task id="LOCAL-00002" summary="fix修复一些BUG">
<option name="closed" value="true" />
<created>1766151466883</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1766151466883</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="fix修复一些BUG" />
<option name="LAST_COMMIT_MESSAGE" value="fix修复一些BUG" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <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="1766150538951" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component> </component>

View File

@@ -10,7 +10,7 @@ from config.config import load_config
# 导入我们的模块 # 导入我们的模块
from ui.core.logger import setup_logger from ui.core.logger import setup_logger
from utils.font_utils import install_fonts_from_directory from utils.font_utils import install_fonts_from_directory
from ui.views.home_page import create_page from ui.views.home_page import create_home_page
from ui.views.config_page import create_config_page from ui.views.config_page import create_config_page
sys.stdout.reconfigure(encoding='utf-8') sys.stdout.reconfigure(encoding='utf-8')
@@ -63,11 +63,11 @@ def calculate_window_size():
logger.info(f"屏幕分辨率: {screen_width}x{screen_height}") logger.info(f"屏幕分辨率: {screen_width}x{screen_height}")
logger.info(f"设置窗口大小为: {target_width}x{target_height}") logger.info(f"设置窗口大小为: {target_width}x{target_height}")
return (target_width, target_height) return target_width, target_height
except Exception as e: except Exception as e:
logger.warning(f"无法获取屏幕分辨率 ({e}),使用默认大小 (900, 900)") logger.warning(f"无法获取屏幕分辨率 ({e}),使用默认大小 (900, 900)")
return (900, 900) # 失败时的默认值 return 900, 900 # 失败时的默认值
# 1. 挂载静态资源 (CSS/图片) # 1. 挂载静态资源 (CSS/图片)
# 注意:这里使用 get_path 确保打包后能找到 # 注意:这里使用 get_path 确保打包后能找到
@@ -77,7 +77,7 @@ app.add_static_files('/assets', static_dir)
# 3. 页面路由 # 3. 页面路由
@ui.page('/') @ui.page('/')
def index_page(): def index_page():
create_page() create_home_page()
@ui.page('/config') @ui.page('/config')
def config_page(): def config_page():

View File

@@ -25,7 +25,7 @@ def create_header():
# 添加配置按钮 # 添加配置按钮
ui.button(icon='settings', on_click=lambda: ui.navigate.to('/config')).props('flat round color=white').tooltip('系统配置') ui.button(icon='settings', on_click=lambda: ui.navigate.to('/config')).props('flat round color=white').tooltip('系统配置')
def create_page(): def create_home_page():
# 1. 引入外部 CSS # 1. 引入外部 CSS
ui.add_head_html('<link href="/assets/style.css" rel="stylesheet" />') ui.add_head_html('<link href="/assets/style.css" rel="stylesheet" />')