refactor(phase-3-2): split UI large files (theme_optimizer + home_page)#61
Merged
Conversation
4 tasks
拆分方案: - _presets.py (236): ThemePresets 类 (DARK/LIGHT 主题配色) - _selector.py (89): ThemePresetSelector UI (主题选择器) - _preview.py (51): ThemeColorPreview UI (颜色预览) - _styles.py (143): generate_theme_stylesheet (样式表生成) - __init__.py (21): 重导出 4 个公共符号 兼容: - from scenefab.ui.theme.theme_optimizer import X 仍工作 (通过 __init__.py) - 现有 1 个引用点 (theme_toggle.py) 不需修改 验证: - ruff check all green - pytest 351 passed, 20 skipped - F821 修复: _selector.py 添加 ThemePresets import
拆分 home_page.py (548 行) 为: - home_page.py (273): HomePage 主类 - _cards.py (279): 4 个卡片类 (GlassCard/QuickCard/ProjectCard/StatChip) - _empty_state.py (71): EmptyStateCard 验证: - 6 个 class 完美分布 (1+4+1) - ruff check all green - pytest 351 passed, 20 skipped - 兼容: from .home_page import HomePage 仍工作
…ilders step_group.py (612) → 2 文件: - step_group.py (313): StepGroup 主类 - _group_card.py (362): GroupCard 卡片 export_panel.py (675) → 减少 191 行: - 提取 4 个 _create_*_tab 方法到 _tab_builders.py - 现在 export_panel.py = 484 行 (从 675) export_monitor.py (519) → 4 文件: - export_monitor.py (45): 重导出 - _progress_widget.py (206): ExportProgressWidget - _monitor_widget.py (237): ExportMonitorWidget - _progress_dialog.py (165): ExportProgressDialog 修复: - _monitor_widget.py 引用 ExportProgressWidget → 加 import - _progress_dialog.py 引用 ExportMonitorWidget → 加 import - ruff --fix 自动修 isort 验证: - ruff check all green - pytest 351 passed, 20 skipped - 5/7 大文件拆分完成 (theme_optimizer/home_page/step_group/export_panel/export_monitor) - 剩余: main_window.py(662) + monitor_panel.py(643) 需 PySide6 验证
a4803da to
ecc4786
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 3 余项 UI 大文件拆分 (2/7 完成):
theme_optimizer.py(503) → 4 文件包home_page.py(548) → 3 文件拆分详情
ui/theme/theme_optimizer.py(503) → 4 文件包ui/main/pages/home_page.py(548) → 3 文件兼容性
__init__.py重导出保持工作from .theme_optimizer import ThemePresets仍可用from .home_page import HomePage仍可用Verification
ruff check .All checks passedpytest tests/351 passed, 20 skipped剩余 Phase 3
未拆分 5 个 UI 大文件(需 PySide6 环境验证,建议后续 PR):
main_window.py(662) — 8 类紧密耦合export_panel.py(674)monitor_panel.py(643)step_group.py(612)export_monitor.py(519)