mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-23 03:22:17 +08:00
新增自动更新exe
This commit is contained in:
parent
884a953207
commit
964f4b0b54
@ -457,15 +457,14 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif):
|
|||||||
# 添加自定义按钮
|
# 添加自定义按钮
|
||||||
custom_button = error_box.addButton('更新', QMessageBox.ActionRole)
|
custom_button = error_box.addButton('更新', QMessageBox.ActionRole)
|
||||||
is_update_online = update_info.get('is_update_online')
|
is_update_online = update_info.get('is_update_online')
|
||||||
custom_button.clicked.connect(lambda x:self.update_(update_info.get('download_url'),is_update_online))
|
custom_button.clicked.connect(lambda x: self.update_(update_info.get('download_url'), is_update_online))
|
||||||
error_box.addButton(QMessageBox.Cancel)
|
error_box.addButton(QMessageBox.Cancel)
|
||||||
# 显示对话框
|
# 显示对话框
|
||||||
error_box.exec_()
|
error_box.exec_()
|
||||||
|
|
||||||
def update_(self, url,is_update_online):
|
def update_(self, url, is_update_online):
|
||||||
QDesktopServices.openUrl(QUrl("https://memotrace.cn/"))
|
QDesktopServices.openUrl(QUrl("https://memotrace.cn/"))
|
||||||
|
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
"""
|
"""
|
||||||
关于
|
关于
|
||||||
@ -485,6 +484,8 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif):
|
|||||||
|
|
||||||
super().close()
|
super().close()
|
||||||
self.exitSignal.emit(True)
|
self.exitSignal.emit(True)
|
||||||
|
|
||||||
|
|
||||||
class UpdateThread(QThread):
|
class UpdateThread(QThread):
|
||||||
updateSignal = pyqtSignal(dict)
|
updateSignal = pyqtSignal(dict)
|
||||||
|
|
||||||
@ -510,7 +511,7 @@ class UpdateThread(QThread):
|
|||||||
|
|
||||||
with open(INFO_FILE_PATH, "w", encoding="utf-8") as f:
|
with open(INFO_FILE_PATH, "w", encoding="utf-8") as f:
|
||||||
json.dump(data, f, ensure_ascii=False, indent=4)
|
json.dump(data, f, ensure_ascii=False, indent=4)
|
||||||
server_url = urljoin(SERVER_API_URL,'update')
|
server_url = urljoin(SERVER_API_URL, 'update')
|
||||||
data = {'version': version}
|
data = {'version': version}
|
||||||
try:
|
try:
|
||||||
response = requests.post(server_url, json=data)
|
response = requests.post(server_url, json=data)
|
||||||
@ -521,4 +522,4 @@ class UpdateThread(QThread):
|
|||||||
print("检查更新失败")
|
print("检查更新失败")
|
||||||
except:
|
except:
|
||||||
update_info = {'update_available': False}
|
update_info = {'update_available': False}
|
||||||
self.updateSignal.emit(update_info)
|
self.updateSignal.emit(update_info)
|
||||||
|
Loading…
Reference in New Issue
Block a user