fix(utils): 修复 version_text 引起的打包问题

This commit is contained in:
DLmaster
2025-01-27 12:20:07 +08:00
parent 126799d2a2
commit 8bbfdcbc04
7 changed files with 40 additions and 47 deletions

View File

@@ -33,7 +33,7 @@ from .core import AppConfig, QueueConfig, MaaConfig, Task, Task_manager, Main_ti
from .models import MaaManager
from .services import Notify, Crypto, System
from .ui import AUTO_MAA
from .utils import Updater, version_text
from .utils import Updater
__all__ = [
"AppConfig",
@@ -48,5 +48,4 @@ __all__ = [
"System",
"AUTO_MAA",
"Updater",
"version_text",
]

View File

@@ -50,7 +50,7 @@ import requests
from app.core import Config, MainInfoBar
from app.services import Crypto, System
from app.utils import Updater, version_text
from app.utils import Updater
from .Widget import InputMessageBox, LineEditSettingCard
@@ -717,3 +717,15 @@ class OtherSettingCard(HeaderCardWidget):
self.viewLayout.setContentsMargins(0, 0, 0, 0)
self.viewLayout.setSpacing(0)
self.addGroupWidget(widget)
def version_text(version_numb: list) -> str:
"""将版本号列表转为可读的文本信息"""
if version_numb[3] == 0:
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
else:
version = (
f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}"
)
return version

View File

@@ -42,7 +42,17 @@ from qfluentwidgets import ProgressBar, IndeterminateProgressBar, BodyLabel
from PySide6.QtGui import QIcon
from PySide6.QtCore import QObject, QThread, Signal
from .version import version_text
def version_text(version_numb: list) -> str:
"""将版本号列表转为可读的文本信息"""
if version_numb[3] == 0:
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
else:
version = (
f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}"
)
return version
class UpdateProcess(QThread):

View File

@@ -30,6 +30,5 @@ __author__ = "DLmaster361 <DLmaster_361@163.com>"
__license__ = "GPL-3.0 license"
from .Updater import Updater
from .version import version_text
__all__ = ["Updater", "version_text"]
__all__ = ["Updater"]

View File

@@ -26,16 +26,27 @@ v4.2
"""
import os
import sys
import json
import shutil
from pathlib import Path
from app import version_text
def version_text(version_numb: list) -> str:
"""将版本号列表转为可读的文本信息"""
if version_numb[3] == 0:
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
else:
version = (
f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}"
)
return version
if __name__ == "__main__":
root_path = Path.cwd()
root_path = Path(sys.argv[0]).resolve().parent
with (root_path / "resources/version.json").open(mode="r", encoding="utf-8") as f:
version = json.load(f)

View File

@@ -1,38 +0,0 @@
# <AUTO_MAA:A MAA Multi Account Management and Automation Tool>
# Copyright © <2024> <DLmaster361>
# This file is part of AUTO_MAA.
# AUTO_MAA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
# AUTO_MAA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with AUTO_MAA. If not, see <https://www.gnu.org/licenses/>.
# DLmaster_361@163.com
"""
AUTO_MAA
AUTO_MAA版本号工具
v4.2
作者DLmaster_361
"""
def version_text(version_numb: list) -> str:
"""将版本号列表转为可读的文本信息"""
if version_numb[3] == 0:
version = f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
else:
version = (
f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}"
)
return version

View File

@@ -32,7 +32,7 @@ from qfluentwidgets import FluentTranslator
import sys
# @logger.catch
@logger.catch
def main():
application = QApplication(sys.argv)