Files
zsglpt-pc/main.py
237899745 83fef6dff2 feat: 知识管理平台精简版 - PyQt6桌面应用
主要功能:
- 账号管理:添加/编辑/删除账号,测试登录
- 浏览任务:批量浏览应读/选读内容并标记已读
- 截图管理:wkhtmltoimage截图,查看历史
- 金山文档:扫码登录/微信快捷登录,自动上传截图

技术栈:
- PyQt6 GUI框架
- Playwright 浏览器自动化
- SQLite 本地数据存储
- wkhtmltoimage 网页截图

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 22:16:36 +08:00

90 lines
2.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
知识管理平台助手 - 精简版
PyQt6桌面应用入口
功能:
- 知识管理平台浏览(登录、标记已读)
- wkhtmltoimage截图
- 金山文档表格上传
作者: 老王
"""
import sys
import os
# 确保在正确的目录
os.chdir(os.path.dirname(os.path.abspath(__file__)))
from PyQt6.QtWidgets import QApplication
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QFont
from config import get_config
from ui.main_window import MainWindow
from ui.styles import get_stylesheet, LIGHT_THEME, DARK_THEME
def main():
"""应用入口"""
# 高DPI支持
if hasattr(Qt, 'AA_EnableHighDpiScaling'):
QApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling, True)
if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
QApplication.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps, True)
app = QApplication(sys.argv)
# 设置应用信息
app.setApplicationName("知识管理平台助手")
app.setApplicationVersion("1.0.0")
app.setOrganizationName("zsglpt-lite")
# 设置默认字体
font = QFont("Microsoft YaHei", 10)
app.setFont(font)
# 加载配置并应用主题
config = get_config()
theme = LIGHT_THEME if config.theme == "light" else DARK_THEME
app.setStyleSheet(get_stylesheet(theme))
# 创建主窗口
window = MainWindow()
window.show()
# Check for JSON to SQLite migration
from config import CONFIG_FILE
if CONFIG_FILE.exists():
from utils.storage import migrate_from_json
window.log("检测到旧JSON配置正在迁移到SQLite...")
if migrate_from_json():
window.log("✅ 配置迁移成功")
else:
window.log("⚠️ 配置迁移失败,将使用默认配置")
# 启动日志
window.log("应用启动成功")
window.log(f"数据目录: {os.path.abspath('data')}")
# Show database info
from utils.storage import _get_db_path
db_path = _get_db_path()
window.log(f"数据库: {db_path}")
# 检查wkhtmltoimage
from core.screenshot import _resolve_wkhtmltoimage_path
wkhtml = _resolve_wkhtmltoimage_path()
if wkhtml:
window.log(f"wkhtmltoimage: {wkhtml}")
else:
window.log("⚠️ 警告: 未找到 wkhtmltoimage截图功能可能不可用")
sys.exit(app.exec())
if __name__ == "__main__":
main()