feat: 添加轻量打包和OCR自动安装功能

- 添加Windows打包脚本 build.bat
- 更新打包文档 BUILD.md(轻量版方案)
- OCR模块:添加首次运行时自动安装PaddleOCR的功能
- 主窗口:添加OCR安装检测和提示逻辑
- 创建应用入口 src/main.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
congsh
2026-02-12 10:14:10 +08:00
parent c4a77f8aa4
commit 154d53dbfd
8 changed files with 301 additions and 5 deletions

74
docs/BUILD.md Normal file
View File

@@ -0,0 +1,74 @@
# CutThenThink 打包指南
## 方式一:使用 build.sh 脚本(推荐)
在您的本地环境(有管理员权限)中运行:
```bash
cd /path/to/CutThenThink
bash build.sh
```
---
## 方式二:手动打包
### 1. 安装 PyInstaller
```bash
# 使用 pipx推荐
pipx install pyinstaller
# 或使用系统包管理器
sudo apt install python3-pyinstaller
```
### 2. 安装项目依赖
```bash
pip install -r requirements.txt
```
### 3. 执行打包
```bash
python3 -m PyInstaller \
--name "CutThenThink" \
--windowed \
--onefile \
--add-data "src:src" \
--hidden-import=PyQt6.QtCore \
--hidden-import=PyQt6.QtGui \
--hidden-import=PyQt6.QtWidgets \
--hidden-import=sqlalchemy \
src/main.py
```
### 4. 测试运行
```bash
./dist/CutThenThink
```
---
## 打包参数说明
| 参数 | 说明 |
|------|------|
| `--name` | 应用名称 |
| `--windowed` | 无控制台窗口 |
| `--onefile` | 单文件打包 |
| `--add-data` | 添加数据文件(源代码) |
| `--hidden-import` | 隐式导入模块 |
---
## 打包后
可执行文件位置:`dist/CutThenThink`
分发时建议:
1.`dist/CutThenThink` 打包为 tar.gz
2. 创建安装脚本
3. 包含 README 说明