打包目录结构优化
This commit is contained in:
6
.github/workflows/python-app.yml
vendored
6
.github/workflows/python-app.yml
vendored
@@ -83,7 +83,13 @@ jobs:
|
||||
- name: Create Zip
|
||||
id: create_zip
|
||||
run: |
|
||||
move gui\ui\updater.ui .\
|
||||
move gui\ico\AUTO_MAA_Updater.ico .\
|
||||
Compress-Archive -Path gui,res,AUTO_MAA.py,Updater.py,package.py,dist/AUTO_MAA.exe,requirements.txt,README.md,LICENSE -DestinationPath AUTO_MAA_${{ env.AUTO_MAA_version }}.zip
|
||||
del gui\ui\main.ui
|
||||
del gui\ico\AUTO_MAA.ico
|
||||
move updater.ui gui\ui
|
||||
move AUTO_MAA_Updater.ico gui\ico
|
||||
Compress-Archive -Path gui,dist/Updater.exe -DestinationPath Updater_${{ env.updater_version }}.zip
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -1084,7 +1084,7 @@ class Main(QWidget):
|
||||
]
|
||||
|
||||
self.ui = uiLoader.load(self.app_path + "/gui/ui/main.ui")
|
||||
self.ui.setWindowIcon(QIcon(self.app_path + "/res/AUTO_MAA.ico"))
|
||||
self.ui.setWindowIcon(QIcon(self.app_path + "/gui/ico/AUTO_MAA.ico"))
|
||||
# 检查文件完整性
|
||||
self.initialize()
|
||||
self.check_config()
|
||||
@@ -2414,6 +2414,7 @@ class Main(QWidget):
|
||||
self.app_path,
|
||||
"AUTO_MAA更新器",
|
||||
version_remote["updater_download_url"],
|
||||
version_remote["updater_version"],
|
||||
)
|
||||
if main_version_remote > main_version_current:
|
||||
self.updater.update_process.accomplish.connect(self.update_main)
|
||||
@@ -2435,7 +2436,7 @@ class Main(QWidget):
|
||||
"""将版本号列表转为可读的文本信息"""
|
||||
if version_numb[3] == 0:
|
||||
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
|
||||
elif version_numb[3] == 1:
|
||||
else:
|
||||
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}_beta"
|
||||
return version
|
||||
|
||||
@@ -2445,7 +2446,7 @@ class Main(QWidget):
|
||||
title=title,
|
||||
message=message,
|
||||
app_name="AUTO_MAA",
|
||||
app_icon=self.app_path + "/res/AUTO_MAA.ico",
|
||||
app_icon=self.app_path + "/gui/ico/AUTO_MAA.ico",
|
||||
timeout=t,
|
||||
ticker=ticker,
|
||||
toast=True,
|
||||
|
||||
28
Updater.py
28
Updater.py
@@ -49,12 +49,13 @@ class UpdateProcess(QThread):
|
||||
progress = Signal(int, int, int)
|
||||
accomplish = Signal()
|
||||
|
||||
def __init__(self, app_path, name, download_url):
|
||||
def __init__(self, app_path, name, download_url, version):
|
||||
super(UpdateProcess, self).__init__()
|
||||
|
||||
self.app_path = app_path
|
||||
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"
|
||||
|
||||
@@ -100,17 +101,27 @@ class UpdateProcess(QThread):
|
||||
e = str(e)
|
||||
e = "\n".join([e[_ : _ + 75] for _ in range(0, len(e), 75)])
|
||||
self.info.emit(f"解压更新时出错:\n{e}")
|
||||
|
||||
with open(self.version_path, "r", encoding="utf-8") as f:
|
||||
version_info = json.load(f)
|
||||
if self.name == "AUTO_MAA更新器":
|
||||
version_info["updater_version"] = self.version
|
||||
elif self.name == "AUTO_MAA主程序":
|
||||
version_info["main_version"] = self.version
|
||||
with open(self.version_path, "w", encoding="utf-8") as f:
|
||||
json.dump(version_info, f, indent=4)
|
||||
|
||||
self.accomplish.emit()
|
||||
|
||||
|
||||
class Updater(QObject):
|
||||
|
||||
def __init__(self, app_path, name, download_url):
|
||||
def __init__(self, app_path, name, download_url, version):
|
||||
super().__init__()
|
||||
|
||||
self.ui = uiLoader.load(app_path + "/gui/ui/updater.ui")
|
||||
self.ui.setWindowTitle("AUTO_MAA更新器")
|
||||
self.ui.setWindowIcon(QIcon(app_path + "/res/AUTO_MAA_Updater.ico"))
|
||||
self.ui.setWindowIcon(QIcon(app_path + "/gui/ico/AUTO_MAA_Updater.ico"))
|
||||
|
||||
self.info = self.ui.findChild(QLabel, "label")
|
||||
self.info.setText("正在初始化")
|
||||
@@ -118,7 +129,7 @@ class Updater(QObject):
|
||||
self.progress = self.ui.findChild(QProgressBar, "progressBar")
|
||||
self.progress.setRange(0, 0)
|
||||
|
||||
self.update_process = UpdateProcess(app_path, name, download_url)
|
||||
self.update_process = UpdateProcess(app_path, name, download_url, version)
|
||||
|
||||
self.update_process.info.connect(self.update_info)
|
||||
self.update_process.progress.connect(self.update_progress)
|
||||
@@ -134,10 +145,10 @@ class Updater(QObject):
|
||||
|
||||
|
||||
class AUTO_MAA_Updater(QApplication):
|
||||
def __init__(self, app_path, name, download_url):
|
||||
def __init__(self, app_path, name, download_url, version):
|
||||
super().__init__()
|
||||
|
||||
self.main = Updater(app_path, name, download_url)
|
||||
self.main = Updater(app_path, name, download_url, version)
|
||||
self.main.ui.show()
|
||||
|
||||
|
||||
@@ -157,6 +168,9 @@ if __name__ == "__main__":
|
||||
|
||||
if main_version_remote > main_version_current:
|
||||
app = AUTO_MAA_Updater(
|
||||
app_path, "AUTO_MAA主程序", version_remote["main_download_url"]
|
||||
app_path,
|
||||
"AUTO_MAA主程序",
|
||||
version_remote["main_download_url"],
|
||||
version_remote["main_version"],
|
||||
)
|
||||
sys.exit(app.exec())
|
||||
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@@ -33,7 +33,7 @@ def version_text(version_numb):
|
||||
"""将版本号列表转为可读的文本信息"""
|
||||
if version_numb[3] == 0:
|
||||
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
|
||||
elif version_numb[3] == 1:
|
||||
else:
|
||||
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}_beta"
|
||||
return version
|
||||
|
||||
@@ -53,10 +53,10 @@ with open("Updater_info.txt", "w", encoding="utf-8") as f:
|
||||
print(updater_info, end="", file=f)
|
||||
|
||||
os.system(
|
||||
"pyinstaller -F --version-file AUTO_MAA_info.txt -w --icon=res/AUTO_MAA.ico AUTO_MAA.py --hidden-import plyer.platforms.win.notification"
|
||||
"pyinstaller -F --version-file AUTO_MAA_info.txt -w --icon=gui/ico/AUTO_MAA.ico AUTO_MAA.py --hidden-import plyer.platforms.win.notification"
|
||||
)
|
||||
os.system(
|
||||
"pyinstaller -F --version-file Updater_info.txt -w --icon=res/AUTO_MAA_Updater.ico Updater.py"
|
||||
"pyinstaller -F --version-file Updater_info.txt -w --icon=gui/ico/AUTO_MAA_Updater.ico Updater.py"
|
||||
)
|
||||
|
||||
with open("update_info.txt", "w", encoding="utf-8") as f:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"main_version": "4.1.1.1",
|
||||
"main_version": "4.1.1.2",
|
||||
"main_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.1_beta/AUTO_MAA_v4.1.1_beta.zip",
|
||||
"updater_version": "1.0.1.0",
|
||||
"updater_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.1_beta/Updater_v1.0.1.zip",
|
||||
"announcement": "\n# 公测版,若出现问题请及时反馈给项目组!\n## 新增功能\n- 添加`启动AUTO_MAA后直接代理`功能\n- 添加无限代理天数模式\n## 修复BUG\n- 尝试解决卡日志情况\n## 程序优化\n- Updater.exe图标更换"
|
||||
"updater_version": "1.0.1.1",
|
||||
"updater_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.1_beta/Updater_v1.0.1_beta.zip",
|
||||
"announcement": "\n# 公测版,若出现问题请及时反馈给项目组!\n## 新增功能\n- 添加`启动AUTO_MAA后直接代理`功能\n- 添加无限代理天数模式\n## 修复BUG\n- 尝试解决卡日志情况\n## 程序优化\n- Updater.exe图标更换\n- 更新包目录结构优化"
|
||||
}
|
||||
Reference in New Issue
Block a user