76 lines
2.0 KiB
Python
76 lines
2.0 KiB
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
"""
|
|||
|
|
图片处理功能测试脚本
|
|||
|
|
|
|||
|
|
测试 P0-7 实现的图片处理功能:
|
|||
|
|
1. 全局快捷键截图
|
|||
|
|
2. 剪贴板监听
|
|||
|
|
3. 图片文件选择
|
|||
|
|
4. 图片预览组件
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
import sys
|
|||
|
|
from pathlib import Path
|
|||
|
|
|
|||
|
|
# 添加项目根目录到路径
|
|||
|
|
project_root = Path(__file__).parent.parent
|
|||
|
|
sys.path.insert(0, str(project_root))
|
|||
|
|
|
|||
|
|
try:
|
|||
|
|
from PyQt6.QtWidgets import QApplication
|
|||
|
|
from PyQt6.QtCore import Qt
|
|||
|
|
from src.gui.main_window import MainWindow
|
|||
|
|
from src.gui.widgets import (
|
|||
|
|
ScreenshotWidget,
|
|||
|
|
ClipboardMonitor,
|
|||
|
|
ImagePicker,
|
|||
|
|
ImagePreviewWidget
|
|||
|
|
)
|
|||
|
|
print("✓ 所有组件导入成功")
|
|||
|
|
|
|||
|
|
# 创建应用程序
|
|||
|
|
app = QApplication(sys.argv)
|
|||
|
|
app.setApplicationName("CutThenThink")
|
|||
|
|
|
|||
|
|
# 创建并显示主窗口
|
|||
|
|
window = MainWindow()
|
|||
|
|
window.show()
|
|||
|
|
|
|||
|
|
print("✓ 主窗口已启动")
|
|||
|
|
print("\n功能测试说明:")
|
|||
|
|
print("=" * 50)
|
|||
|
|
print("1. 全局快捷键截图:")
|
|||
|
|
print(" - 点击「新建截图」按钮")
|
|||
|
|
print(" - 或使用快捷键 Ctrl+Shift+A")
|
|||
|
|
print(" - 拖动鼠标选择截图区域")
|
|||
|
|
print("")
|
|||
|
|
print("2. 剪贴板监听:")
|
|||
|
|
print(" - 复制任意图片到剪贴板")
|
|||
|
|
print(" - 点击「粘贴剪贴板图片」按钮")
|
|||
|
|
print(" - 或使用快捷键 Ctrl+Shift+V")
|
|||
|
|
print("")
|
|||
|
|
print("3. 图片文件选择:")
|
|||
|
|
print(" - 点击「导入图片」按钮")
|
|||
|
|
print(" - 或使用快捷键 Ctrl+Shift+O")
|
|||
|
|
print(" - 选择本地图片文件")
|
|||
|
|
print("")
|
|||
|
|
print("4. 图片预览:")
|
|||
|
|
print(" - 加载图片后可进行缩放操作")
|
|||
|
|
print(" - 支持鼠标滚轮缩放")
|
|||
|
|
print(" - 支持拖动平移")
|
|||
|
|
print(" - 支持旋转和全屏")
|
|||
|
|
print("=" * 50)
|
|||
|
|
|
|||
|
|
sys.exit(app.exec())
|
|||
|
|
|
|||
|
|
except ImportError as e:
|
|||
|
|
print(f"✗ 导入失败: {e}")
|
|||
|
|
print("\n请确保已安装所有依赖:")
|
|||
|
|
print(" pip install -r requirements.txt")
|
|||
|
|
sys.exit(1)
|
|||
|
|
except Exception as e:
|
|||
|
|
print(f"✗ 启动失败: {e}")
|
|||
|
|
import traceback
|
|||
|
|
traceback.print_exc()
|
|||
|
|
sys.exit(1)
|