加注释
This commit is contained in:
671
AUTO_MAA.py
671
AUTO_MAA.py
File diff suppressed because it is too large
Load Diff
25
Updater.py
25
Updater.py
@@ -56,8 +56,8 @@ class UpdateProcess(QThread):
|
||||
self.name = name
|
||||
self.download_url = download_url
|
||||
self.version = version
|
||||
self.download_path = app_path + "/AUTO_MAA_Update.zip" # 临时下载文件的路径
|
||||
self.version_path = app_path + "/res/version.json"
|
||||
self.download_path = f"{app_path}/AUTO_MAA_Update.zip" # 临时下载文件的路径
|
||||
self.version_path = f"{app_path}/res/version.json"
|
||||
|
||||
def run(self):
|
||||
|
||||
@@ -66,6 +66,7 @@ class UpdateProcess(QThread):
|
||||
os.remove(self.download_path)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
# 下载
|
||||
try:
|
||||
response = requests.get(self.download_url, stream=True)
|
||||
@@ -88,6 +89,7 @@ class UpdateProcess(QThread):
|
||||
e = "\n".join([e[_ : _ + 75] for _ in range(0, len(e), 75)])
|
||||
self.info.emit(f"下载{self.name}时出错:\n{e}")
|
||||
return None
|
||||
|
||||
# 解压
|
||||
try:
|
||||
self.info.emit("正在解压更新文件")
|
||||
@@ -101,7 +103,6 @@ class UpdateProcess(QThread):
|
||||
|
||||
self.info.emit(f"{self.name}更新成功!")
|
||||
self.progress.emit(0, 100, 100)
|
||||
|
||||
except Exception as e:
|
||||
e = str(e)
|
||||
e = "\n".join([e[_ : _ + 75] for _ in range(0, len(e), 75)])
|
||||
@@ -125,9 +126,9 @@ class Updater(QObject):
|
||||
def __init__(self, app_path, name, download_url, version):
|
||||
super().__init__()
|
||||
|
||||
self.ui = uiLoader.load(app_path + "/gui/ui/updater.ui")
|
||||
self.ui = uiLoader.load(f"{app_path}/gui/ui/updater.ui")
|
||||
self.ui.setWindowTitle("AUTO_MAA更新器")
|
||||
self.ui.setWindowIcon(QIcon(app_path + "/gui/ico/AUTO_MAA_Updater.ico"))
|
||||
self.ui.setWindowIcon(QIcon(f"{app_path}/gui/ico/AUTO_MAA_Updater.ico"))
|
||||
|
||||
self.info = self.ui.findChild(QLabel, "label")
|
||||
self.info.setText("正在初始化")
|
||||
@@ -159,12 +160,20 @@ class AUTO_MAA_Updater(QApplication):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# 获取软件自身的路径
|
||||
app_path = os.path.dirname(os.path.realpath(sys.argv[0])).replace("\\", "/")
|
||||
|
||||
# 从本地版本信息文件获取当前版本信息
|
||||
with open(app_path + "/res/version.json", "r", encoding="utf-8") as f:
|
||||
version_current = json.load(f)
|
||||
main_version_current = list(map(int, version_current["main_version"].split(".")))
|
||||
if os.path.exists(f"{app_path}/res/version.json"):
|
||||
with open(f"{app_path}/res/version.json", "r", encoding="utf-8") as f:
|
||||
version_current = json.load(f)
|
||||
main_version_current = list(
|
||||
map(int, version_current["main_version"].split("."))
|
||||
)
|
||||
else:
|
||||
main_version_current = [0, 0, 0, 0]
|
||||
|
||||
# 从远程服务器获取最新版本信息
|
||||
response = requests.get(
|
||||
"https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/blob/main/res/version.json"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"main_version": "4.1.2.1",
|
||||
"main_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.2_beta/AUTO_MAA_v4.1.2_beta.zip",
|
||||
"updater_version": "1.0.3.0",
|
||||
"updater_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.2_beta/Updater_v1.0.3.zip",
|
||||
"announcement": "\n# 公测版,若出现问题请及时反馈给项目组!\n## 新增功能\n- 添加`启动AUTO_MAA后直接代理`功能\n- 添加无限代理天数模式\n## 修复BUG\n- 通过限制日志长度解决卡日志情况\n- 修复tips链接无法打开问题 #9\n- 修复正常退出窗口显示停止工作问题 #9\n- 修复解压失败时本地版本号异常变动问题\n## 程序优化\n- Updater.exe图标更换\n- 更新逻辑优化\n- GUI窗口逻辑优化"
|
||||
"updater_version": "1.0.4.0",
|
||||
"updater_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.2_beta/Updater_v1.0.4.zip",
|
||||
"announcement": "\n# 公测版,若出现问题请及时反馈给项目组!\n## 新增功能\n- 添加`启动AUTO_MAA后直接代理`功能\n- 添加无限代理天数模式\n## 修复BUG\n- 通过限制日志长度解决卡日志情况 #8\n- 修复tips链接无法打开问题 #9\n- 修复正常退出窗口显示停止工作问题 #9\n- 修复解压失败时本地版本号异常变动问题\n- 修复无`version.json`时更新器无法更新的问题\n- 修复未设置管理密钥时添加用户报错\n## 程序优化\n- Updater.exe图标更换\n- 更新逻辑优化\n- GUI窗口逻辑优化\n- 添加更多注释"
|
||||
}
|
||||
Reference in New Issue
Block a user