打包目录结构优化
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
|
- name: Create Zip
|
||||||
id: create_zip
|
id: create_zip
|
||||||
run: |
|
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
|
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
|
Compress-Archive -Path gui,dist/Updater.exe -DestinationPath Updater_${{ env.updater_version }}.zip
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
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 = 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.initialize()
|
||||||
self.check_config()
|
self.check_config()
|
||||||
@@ -2414,6 +2414,7 @@ class Main(QWidget):
|
|||||||
self.app_path,
|
self.app_path,
|
||||||
"AUTO_MAA更新器",
|
"AUTO_MAA更新器",
|
||||||
version_remote["updater_download_url"],
|
version_remote["updater_download_url"],
|
||||||
|
version_remote["updater_version"],
|
||||||
)
|
)
|
||||||
if main_version_remote > main_version_current:
|
if main_version_remote > main_version_current:
|
||||||
self.updater.update_process.accomplish.connect(self.update_main)
|
self.updater.update_process.accomplish.connect(self.update_main)
|
||||||
@@ -2435,7 +2436,7 @@ class Main(QWidget):
|
|||||||
"""将版本号列表转为可读的文本信息"""
|
"""将版本号列表转为可读的文本信息"""
|
||||||
if version_numb[3] == 0:
|
if version_numb[3] == 0:
|
||||||
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
|
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"
|
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}_beta"
|
||||||
return version
|
return version
|
||||||
|
|
||||||
@@ -2445,7 +2446,7 @@ class Main(QWidget):
|
|||||||
title=title,
|
title=title,
|
||||||
message=message,
|
message=message,
|
||||||
app_name="AUTO_MAA",
|
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,
|
timeout=t,
|
||||||
ticker=ticker,
|
ticker=ticker,
|
||||||
toast=True,
|
toast=True,
|
||||||
|
|||||||
28
Updater.py
28
Updater.py
@@ -49,12 +49,13 @@ class UpdateProcess(QThread):
|
|||||||
progress = Signal(int, int, int)
|
progress = Signal(int, int, int)
|
||||||
accomplish = Signal()
|
accomplish = Signal()
|
||||||
|
|
||||||
def __init__(self, app_path, name, download_url):
|
def __init__(self, app_path, name, download_url, version):
|
||||||
super(UpdateProcess, self).__init__()
|
super(UpdateProcess, self).__init__()
|
||||||
|
|
||||||
self.app_path = app_path
|
self.app_path = app_path
|
||||||
self.name = name
|
self.name = name
|
||||||
self.download_url = download_url
|
self.download_url = download_url
|
||||||
|
self.version = version
|
||||||
self.download_path = app_path + "/AUTO_MAA_Update.zip" # 临时下载文件的路径
|
self.download_path = app_path + "/AUTO_MAA_Update.zip" # 临时下载文件的路径
|
||||||
self.version_path = app_path + "/res/version.json"
|
self.version_path = app_path + "/res/version.json"
|
||||||
|
|
||||||
@@ -100,17 +101,27 @@ class UpdateProcess(QThread):
|
|||||||
e = str(e)
|
e = str(e)
|
||||||
e = "\n".join([e[_ : _ + 75] for _ in range(0, len(e), 75)])
|
e = "\n".join([e[_ : _ + 75] for _ in range(0, len(e), 75)])
|
||||||
self.info.emit(f"解压更新时出错:\n{e}")
|
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()
|
self.accomplish.emit()
|
||||||
|
|
||||||
|
|
||||||
class Updater(QObject):
|
class Updater(QObject):
|
||||||
|
|
||||||
def __init__(self, app_path, name, download_url):
|
def __init__(self, app_path, name, download_url, version):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.ui = uiLoader.load(app_path + "/gui/ui/updater.ui")
|
self.ui = uiLoader.load(app_path + "/gui/ui/updater.ui")
|
||||||
self.ui.setWindowTitle("AUTO_MAA更新器")
|
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 = self.ui.findChild(QLabel, "label")
|
||||||
self.info.setText("正在初始化")
|
self.info.setText("正在初始化")
|
||||||
@@ -118,7 +129,7 @@ class Updater(QObject):
|
|||||||
self.progress = self.ui.findChild(QProgressBar, "progressBar")
|
self.progress = self.ui.findChild(QProgressBar, "progressBar")
|
||||||
self.progress.setRange(0, 0)
|
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.info.connect(self.update_info)
|
||||||
self.update_process.progress.connect(self.update_progress)
|
self.update_process.progress.connect(self.update_progress)
|
||||||
@@ -134,10 +145,10 @@ class Updater(QObject):
|
|||||||
|
|
||||||
|
|
||||||
class AUTO_MAA_Updater(QApplication):
|
class AUTO_MAA_Updater(QApplication):
|
||||||
def __init__(self, app_path, name, download_url):
|
def __init__(self, app_path, name, download_url, version):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.main = Updater(app_path, name, download_url)
|
self.main = Updater(app_path, name, download_url, version)
|
||||||
self.main.ui.show()
|
self.main.ui.show()
|
||||||
|
|
||||||
|
|
||||||
@@ -157,6 +168,9 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if main_version_remote > main_version_current:
|
if main_version_remote > main_version_current:
|
||||||
app = AUTO_MAA_Updater(
|
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())
|
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:
|
if version_numb[3] == 0:
|
||||||
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
|
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"
|
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}_beta"
|
||||||
return version
|
return version
|
||||||
|
|
||||||
@@ -53,10 +53,10 @@ with open("Updater_info.txt", "w", encoding="utf-8") as f:
|
|||||||
print(updater_info, end="", file=f)
|
print(updater_info, end="", file=f)
|
||||||
|
|
||||||
os.system(
|
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(
|
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:
|
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",
|
"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_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.zip",
|
"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图标更换"
|
"announcement": "\n# 公测版,若出现问题请及时反馈给项目组!\n## 新增功能\n- 添加`启动AUTO_MAA后直接代理`功能\n- 添加无限代理天数模式\n## 修复BUG\n- 尝试解决卡日志情况\n## 程序优化\n- Updater.exe图标更换\n- 更新包目录结构优化"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user