Skip to content

Commit 637ef92

Browse files
committed
refactor(project): 重构项目目录和代码
- 更新了项目技术栈信息 - 调整了开发准备和依赖项安装说明 - 重构了源代码目录结构,将 util 改为 utils,theme 改为 themes - 更新了相关模块的导入路径 - 删除了配置指南文档
1 parent eb18982 commit 637ef92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+115
-204
lines changed

docs/dev/README.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,27 @@
22

33
## 技术栈
44

5-
- **开发语言**: Python 3.12+
6-
- **GUI 框架**: Tkinter
7-
- **包管理**: PDM
8-
- **打包工具**: PyInstaller、ZipApp、InnoSetup 6.4+
5+
- **IDE**: [Visual Studio Code](https://code.visualstudio.com/) 或者 [PyCharm](https://www.jetbrains.com/zh-cn/pycharm/)
6+
- **开发语言**: [Python 3.12+][PythonHomepage]
7+
- **UI 框架**: [Tkinter](https://docs.python.org/zh-cn/3/library/tk.html)
8+
- **包管理**: [PDM][PDMHomepage]
9+
- **测试工具**: [pytest](https://docs.pytest.org/en/7.4.x/)
10+
- **检查工具**: [Black](https://black.readthedocs.io/)
11+
- **构建工具**: [PyInstaller](https://pyinstaller.org/en/stable/)[ZipApp](https://docs.python.org/zh-cn/3/library/zipapp.html)[InnoSetup 6.4+](https://jrsoftware.org/isinfo.php)[UPX](https://upx.github.io/)
912

1013
## 🛠️ 开发准备
1114

1215
### 环境配置
1316

1417
1. **安装基础工具**
15-
- [Python 3.13+](https://www.python.org/)(勾选 `Add to PATH`
16-
- [PDM](https://pdm-project.org/zh-cn/latest/)(包管理工具)
18+
- 下载并安装 Python 3.13+(勾选 `Add to PATH`
19+
- [安装 PDM](https://pdm-project.org/zh-cn/latest/#_3)(包管理工具)
1720
```bash
1821
pip install --user pdm
1922
```
20-
- [UPX](https://upx.github.io/)(可选)
21-
- [InnoSetup](https://jrsoftware.org/isinfo.php)(仅 Windows)
22-
2. **初始化项目**
23+
- 安装 UPX(可选)
24+
- 安装 InnoSetup(仅 Windows)
25+
2. **安装依赖项**
2326
```bash
2427
pdm install -G:all # 安装项目依赖
2528
pdm install --plugins # 安装 PDM 插件
@@ -40,18 +43,21 @@
4043
VCFGeneratorLiteForTkinter/
4144
├── src/ # 源代码
4245
│ └── vcf_generator_lite/
43-
│ ├── ui/ # 界面模块(窗口、对话框)
44-
│ ├── util/ # 工具类(文件操作、VCF生成等)
45-
│ ├── widget/ # 自定义组件(增强型输入框等)
46-
│ ├── assets/ # 静态资源(图标、数据等)
46+
│ ├── windows/ # 窗口
47+
│ ├── utils/ # 工具类
48+
│ ├── widgets/ # 自定义组件(增强型输入框等)
49+
│ ├── themes/ # 应用主题
50+
│ ├── resources/ # 静态资源(图标、数据等)
51+
│ ├── services/ # 业务逻辑
4752
│ ├── __main__.py # 程序入口
4853
│ └── constants.py # 全局常量(名称、链接等)
4954
├── scripts/ # 构建脚本
50-
├── pyproject.toml # 依赖配置
55+
├── pyproject.toml # 项目配置
5156
├── vcf_generator_lite.spec # PyInstaller 配置
5257
├── setup.iss # InnoSetup 安装脚本
5358
├── metadata.yml # 元数据(作者、描述等)
54-
└── versionfile.txt # 版本信息(自动生成)
59+
├── versionfile.txt # 版本信息(自动生成)
60+
└── os_notices.toml # 开源声明信息
5561
```
5662

5763
## 常用命令
@@ -69,13 +75,15 @@ VCFGeneratorLiteForTkinter/
6975

7076
### 单位系统
7177

72-
- **设计单位**:使用字体单位点(
73-
`p`),是[有效像素(epx)](https://learn.microsoft.com/zh-cn/windows/apps/design/layout/screen-sizes-and-breakpoints-for-responsive-design#effective-pixels-and-scale-factor)的
74-
**0.75** 倍;
78+
- **设计单位**:使用字体单位点 (`p`),是[有效像素 (epx)](https://learn.microsoft.com/zh-cn/windows/apps/design/layout/screen-sizes-and-breakpoints-for-responsive-design#effective-pixels-and-scale-factor) 的 **0.75** 倍;
7579
```python
7680
# 转换示例:9p 在 100% 缩放中表示为 12px
7781
Label(root, text="示例", font=("微软雅黑", 9)) # 默认9p字体
7882
```
7983
- **布局原则**
8084
- 尽量使用 `pack` 布局管理器,创建响应式 UI;
8185
- 组件间距统一使用 `padx=7p, pady=7p`
86+
87+
[PythonHomepage]: https://www.python.org/
88+
[PDMHomepage]: https://pdm-project.org/
89+
[TkinterHomepage]: https://docs.python.org/zh-cn/3/library/tk.html

docs/profile.md

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/vcf_generator_lite/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import sys
44

55
from vcf_generator_lite import constants
6-
from vcf_generator_lite.util.display import enable_dpi_aware
7-
from vcf_generator_lite.window.main import create_main_window
6+
from vcf_generator_lite.utils.display import enable_dpi_aware
7+
from vcf_generator_lite.windows.main import create_main_window
88

99

1010
def fix_home_env():

src/vcf_generator_lite/layout/vertical_dialog_layout.py renamed to src/vcf_generator_lite/layouts/vertical_dialog_layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from tkinter.constants import X, BOTH, BOTTOM
44
from typing import Optional
55

6-
from vcf_generator_lite.util.tkinter.window import WindowExtension
6+
from vcf_generator_lite.utils.tkinter.window import WindowExtension
77

88

99
class VerticalDialogLayout(WindowExtension, ABC):

src/vcf_generator_lite/theme/__init__.py

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from vcf_generator_lite.utils.environment import is_windows
2+
from vcf_generator_lite.utils.tkinter.theme import EnhancedTheme
3+
4+
__all__ = ["create_platform_theme"]
5+
6+
7+
def create_platform_theme() -> EnhancedTheme:
8+
if is_windows:
9+
from vcf_generator_lite.themes.widows_theme import WindowsTheme
10+
return WindowsTheme()
11+
12+
from vcf_generator_lite.themes.clam_theme import ClamTheme
13+
return ClamTheme()

src/vcf_generator_lite/theme/base.py renamed to src/vcf_generator_lite/themes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from tkinter.ttk import Style
44
from typing import override
55

6-
from vcf_generator_lite.util.tkinter.theme import EnhancedTheme
6+
from vcf_generator_lite.utils.tkinter.theme import EnhancedTheme
77

88

99
class BaseTheme(EnhancedTheme, ABC):

src/vcf_generator_lite/theme/clam_theme.py renamed to src/vcf_generator_lite/themes/clam_theme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from tkinter.ttk import Style
44
from typing import override
55

6-
from vcf_generator_lite.theme.base import BaseTheme
6+
from vcf_generator_lite.themes.base import BaseTheme
77

88

99
class ClamTheme(BaseTheme):

src/vcf_generator_lite/theme/widows_theme.py renamed to src/vcf_generator_lite/themes/widows_theme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from tkinter.ttk import Style
44
from typing import override
55

6-
from vcf_generator_lite.theme.base import BaseTheme
6+
from vcf_generator_lite.themes.base import BaseTheme
77

88

99
class WindowsTheme(BaseTheme):

src/vcf_generator_lite/util/display/__init__.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)