-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4935b3
commit 9a970b1
Showing
26 changed files
with
621 additions
and
129 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import sys | ||
from PyQt5.QtWidgets import QApplication, QMessageBox | ||
from utils.browser_utils import open_website | ||
from utils.config_handler import ConfigHandler | ||
from ui.base_window import BaseWindow | ||
from ui.components.progress_handler import ProgressHandler | ||
from utils.style_handler import StyleManager | ||
import ctypes | ||
|
||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("myappid") | ||
|
||
from utils.version_checker import VersionChecker | ||
from utils.updater import Updater | ||
|
||
|
||
class XDUScript(BaseWindow): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
# 初始化配置处理器 | ||
self.config_handler = ConfigHandler(self) | ||
|
||
# 初始化进度处理器 | ||
self.progress_handler = ProgressHandler(self) | ||
|
||
# 连接开始按钮的点击事件,获取用户配置数据,并执行vbs脚本 | ||
self.start_button.clicked.connect(self.config_handler.get_config) | ||
|
||
# 样式处理器属性 | ||
self.style_handler = None | ||
|
||
# 初始化版本检查器 | ||
self.version_checker = VersionChecker(self) | ||
|
||
def check_updates(self): | ||
self.console_output.append("正在检查更新...") | ||
has_new_version, latest_version = self.version_checker.check_for_updates() | ||
|
||
if has_new_version: | ||
self.console_output.append(f"发现新版本: {self.version_checker.current_version} -> {latest_version}") | ||
|
||
# 更新确认对话框 | ||
reply = QMessageBox.question( | ||
self, | ||
'发现新版本', | ||
f'检测到新版本 {latest_version},是否现在更新?', | ||
QMessageBox.Yes | QMessageBox.No, | ||
QMessageBox.Yes | ||
) | ||
|
||
if reply == QMessageBox.Yes: | ||
self.console_output.append("正在启动更新程序...") | ||
self.close() | ||
error = Updater.run_update("updater.exe") | ||
if error: | ||
self.console_output.append(f"更新失败: {error}") | ||
else: | ||
self.console_output.append("用户取消更新") | ||
else: | ||
self.console_output.append(f"当前已是最新版本: {latest_version}") | ||
|
||
|
||
if __name__ == "__main__": | ||
app = QApplication(sys.argv) | ||
ex = XDUScript() | ||
|
||
# 加载样式 | ||
ex.style_handler = StyleManager(ex, app) | ||
ex.style_handler.apply_styles() | ||
|
||
ex.console_output.append("XDU 启动!") | ||
|
||
ex.show() | ||
|
||
# 检查更新 | ||
ex.check_updates() | ||
|
||
# 检测完成后打开网页 | ||
open_website( | ||
"https://ehall.xidian.edu.cn/jwapp/sys/wspjyyapp/*default/index.do", | ||
ex.console_output, | ||
) | ||
|
||
sys.exit(app.exec_()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
block_cipher = None | ||
|
||
a = Analysis( | ||
[ | ||
'main.py', | ||
'D:/dev/XDU_WallNut/src/main/ui/__init__.py', | ||
'D:/dev/XDU_WallNut/src/main/ui/base_window.py', | ||
'D:/dev/XDU_WallNut/src/main/ui/components/console_section.py', | ||
'D:/dev/XDU_WallNut/src/main/ui/components/input_section.py', | ||
'D:/dev/XDU_WallNut/src/main/ui/components/console_section.py', | ||
'D:/dev/XDU_WallNut/src/main/utils/__init__.py', | ||
'D:/dev/XDU_WallNut/src/main/utils/browser_utils.py', | ||
'D:/dev/XDU_WallNut/src/main/utils/config_handler.py', | ||
'D:/dev/XDU_WallNut/src/main/utils/style_handler.py', | ||
'D:/dev/XDU_WallNut/src/main/utils/version_checker.py', | ||
'D:/dev/XDU_WallNut/src/main/utils/updater.py', | ||
], # 此项目中所有的 python 脚本 | ||
pathex=['D:\\dev\\XDU_WallNut\\src\\main'], # 项目绝对路径 | ||
binaries=[], | ||
datas=[ | ||
('styles/base.qss', 'styles'), | ||
('favicon.ico', '.'), | ||
('version.json', '.') | ||
], | ||
hiddenimports=[], | ||
hookspath=[], | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False | ||
) | ||
|
||
pyz = PYZ( | ||
a.pure, a.zipped_data, | ||
cipher=block_cipher | ||
) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
[], | ||
name='XDU_WallNut', # 打包程序的名字 | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
runtime_tmpdir=None, | ||
icon='D:/dev/XDU_WallNut/src/main/favicon.ico', # 图标路径 | ||
console=False , | ||
distpath='D:/dev/XDU_WallNut/dist', # 打包输出路径 | ||
) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
该模块用于处理控制台输出组件初始化 | ||
""" | ||
|
||
from PyQt5.QtWidgets import QTextEdit | ||
|
||
|
||
class ConsoleSection(QTextEdit): | ||
def __init__(self, window): | ||
super().__init__() | ||
|
||
# 初始化窗口 | ||
self.window = window | ||
|
||
def init_console_output(self): | ||
""" | ||
控制台输出 | ||
""" | ||
self.window.console_output = QTextEdit(self.window) | ||
|
||
# 设置只读 | ||
self.window.console_output.setReadOnly(True) | ||
|
||
self.window.console_output.setPlaceholderText("控制台输出将显示在这里...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
ui/components/progress_handler.py → src/main/ui/components/progress_handler.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
""" | ||
该模块用于处理进度相关操作 | ||
""" | ||
|
||
from PyQt5.QtCore import QTimer | ||
from PyQt5.QtGui import QTextCursor | ||
import random | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
""" | ||
该模块用于浏览器相关操作 | ||
""" | ||
|
||
import os | ||
import webbrowser | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
""" | ||
该模块用于处理配置相关操作 | ||
""" | ||
|
||
from PyQt5.QtCore import QTimer | ||
from PyQt5.QtWidgets import QApplication | ||
|
||
|
Oops, something went wrong.