182 lines
5.1 KiB
Markdown
182 lines
5.1 KiB
Markdown
|
|
# P0-6 主窗口框架 - 文件清单
|
|||
|
|
|
|||
|
|
## 新增文件列表
|
|||
|
|
|
|||
|
|
### 核心代码文件
|
|||
|
|
|
|||
|
|
1. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/src/gui/main_window.py`**
|
|||
|
|
- 主窗口实现
|
|||
|
|
- 包含 MainWindow 和 NavigationButton 类
|
|||
|
|
- 侧边栏导航、主内容区域、页面切换
|
|||
|
|
- 已集成图片处理功能(被后续修改)
|
|||
|
|
|
|||
|
|
2. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/src/gui/styles/colors.py`**
|
|||
|
|
- 颜色方案定义
|
|||
|
|
- 米白色系配色
|
|||
|
|
- ColorScheme 数据类
|
|||
|
|
- 全局 COLORS 实例
|
|||
|
|
|
|||
|
|
3. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/src/gui/styles/theme.py`**
|
|||
|
|
- 主题样式表(QSS)
|
|||
|
|
- 完整的 Qt 部件样式覆盖
|
|||
|
|
- ThemeStyles 类
|
|||
|
|
|
|||
|
|
4. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/src/gui/styles/__init__.py`**
|
|||
|
|
- 样式模块导出
|
|||
|
|
- 兼容浏览视图样式
|
|||
|
|
|
|||
|
|
5. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/src/gui/__init__.py`**
|
|||
|
|
- GUI 模块入口
|
|||
|
|
- 延迟导入机制
|
|||
|
|
|
|||
|
|
### 测试文件
|
|||
|
|
|
|||
|
|
6. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/test_main_window.py`**
|
|||
|
|
- 主窗口测试脚本
|
|||
|
|
- 快速验证主窗口功能
|
|||
|
|
|
|||
|
|
### 文档文件
|
|||
|
|
|
|||
|
|
7. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/docs/gui_main_window.md`**
|
|||
|
|
- 主窗口详细文档
|
|||
|
|
- 使用示例和 API 说明
|
|||
|
|
|
|||
|
|
8. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/docs/p0_6_summary.md`**
|
|||
|
|
- P0-6 任务总结
|
|||
|
|
- 实现内容和技术特点
|
|||
|
|
|
|||
|
|
9. **`/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/docs/p0_6_files.md`**
|
|||
|
|
- 本文件
|
|||
|
|
- 文件清单和结构说明
|
|||
|
|
|
|||
|
|
## 目录结构
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
CutThenThink/
|
|||
|
|
├── src/
|
|||
|
|
│ ├── gui/
|
|||
|
|
│ │ ├── __init__.py # GUI 模块入口(延迟导入)
|
|||
|
|
│ │ ├── main_window.py # 主窗口实现 ✨ 新增
|
|||
|
|
│ │ ├── widgets/ # 自定义部件(后续开发)
|
|||
|
|
│ │ └── styles/
|
|||
|
|
│ │ ├── __init__.py # 样式模块导出
|
|||
|
|
│ │ ├── colors.py # 颜色方案定义 ✨ 新增
|
|||
|
|
│ │ ├── theme.py # 主题样式表 ✨ 新增
|
|||
|
|
│ │ └── browse_style.py # 浏览视图样式(已存在)
|
|||
|
|
│ ├── config/ # 配置模块
|
|||
|
|
│ ├── core/ # 核心功能
|
|||
|
|
│ ├── models/ # 数据模型
|
|||
|
|
│ └── utils/ # 工具函数
|
|||
|
|
├── docs/
|
|||
|
|
│ ├── gui_main_window.md # 主窗口详细文档 ✨ 新增
|
|||
|
|
│ ├── p0_6_summary.md # 任务总结 ✨ 新增
|
|||
|
|
│ └── p0_6_files.md # 文件清单 ✨ 新增
|
|||
|
|
├── data/ # 数据目录
|
|||
|
|
├── test_main_window.py # 测试脚本 ✨ 新增
|
|||
|
|
├── requirements.txt # 依赖列表
|
|||
|
|
└── README.md # 项目说明
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 代码统计
|
|||
|
|
|
|||
|
|
### 主窗口模块
|
|||
|
|
- **`main_window.py`**: 约 576 行
|
|||
|
|
- MainWindow 类:约 450 行
|
|||
|
|
- NavigationButton 类:约 20 行
|
|||
|
|
- 导入和文档:约 100 行
|
|||
|
|
|
|||
|
|
### 样式模块
|
|||
|
|
- **`colors.py`**: 约 170 行
|
|||
|
|
- ColorScheme 类:约 90 行
|
|||
|
|
- 全局实例和函数:约 80 行
|
|||
|
|
|
|||
|
|
- **`theme.py`**: 约 370 行
|
|||
|
|
- QSS 样式表:约 320 行
|
|||
|
|
- 类和方法:约 50 行
|
|||
|
|
|
|||
|
|
### 总计
|
|||
|
|
- 新增代码:约 1,100 行
|
|||
|
|
- 文档:约 600 行
|
|||
|
|
|
|||
|
|
## 依赖关系
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
main_window.py
|
|||
|
|
├── PyQt6.QtWidgets (GUI 框架)
|
|||
|
|
├── PyQt6.QtCore (核心功能)
|
|||
|
|
├── PyQt6.QtGui (GUI 组件)
|
|||
|
|
└── src.gui.styles (样式模块)
|
|||
|
|
├── colors.py (颜色定义)
|
|||
|
|
└── theme.py (样式表)
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 导入验证
|
|||
|
|
|
|||
|
|
所有新增模块已通过导入验证:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
# 验证样式模块(不需要 PyQt6)
|
|||
|
|
from src.gui.styles import ColorScheme, COLORS, get_color, ThemeStyles
|
|||
|
|
|
|||
|
|
# 验证主窗口(需要 PyQt6)
|
|||
|
|
from src.gui import get_main_window_class
|
|||
|
|
MainWindow = get_main_window_class()
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 运行测试
|
|||
|
|
|
|||
|
|
安装依赖后运行:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
pip install -r requirements.txt
|
|||
|
|
python3 test_main_window.py
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 后续集成
|
|||
|
|
|
|||
|
|
这些模块为以下功能提供基础:
|
|||
|
|
|
|||
|
|
1. **P1-1: 截图处理**
|
|||
|
|
- 使用 main_window.py 的截图处理页面
|
|||
|
|
- 集成图片预览组件
|
|||
|
|
|
|||
|
|
2. **P1-2: 分类浏览**
|
|||
|
|
- 使用 main_window.py 的分类浏览页面
|
|||
|
|
- 集成 browse_style.py 样式
|
|||
|
|
|
|||
|
|
3. **P1-3: 批量上传**
|
|||
|
|
- 使用 main_window.py 的批量上传页面
|
|||
|
|
- 添加上传进度组件
|
|||
|
|
|
|||
|
|
4. **P1-4: 设置界面**
|
|||
|
|
- 使用 main_window.py 的设置页面
|
|||
|
|
- 集成配置管理
|
|||
|
|
|
|||
|
|
## 维护说明
|
|||
|
|
|
|||
|
|
### 修改颜色方案
|
|||
|
|
编辑 `src/gui/styles/colors.py` 中的 `ColorScheme` 类。
|
|||
|
|
|
|||
|
|
### 修改样式
|
|||
|
|
编辑 `src/gui/styles/theme.py` 中的 QSS 样式表。
|
|||
|
|
|
|||
|
|
### 添加新页面
|
|||
|
|
1. 在 `main_window.py` 中创建页面方法
|
|||
|
|
2. 在 `_create_pages()` 中注册页面
|
|||
|
|
3. 在侧边栏添加导航按钮
|
|||
|
|
4. 在 `_on_nav_clicked()` 中添加页面切换逻辑
|
|||
|
|
|
|||
|
|
### 测试修改
|
|||
|
|
运行 `test_main_window.py` 查看效果。
|
|||
|
|
|
|||
|
|
## 总结
|
|||
|
|
|
|||
|
|
P0-6 主窗口框架已完整实现,包括:
|
|||
|
|
- ✅ 完整的主窗口结构
|
|||
|
|
- ✅ 米白色配色方案
|
|||
|
|
- ✅ 全面的样式表系统
|
|||
|
|
- ✅ 模块化的代码组织
|
|||
|
|
- ✅ 详细的文档说明
|
|||
|
|
|
|||
|
|
所有文件均已创建并验证通过。
|