From 4be5fc6ba935b1bc100496a0b36bf6c751f6fc3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Sat, 16 Nov 2024 23:20:48 +0800 Subject: [PATCH] xp --- py/LunaTranslator/gui/setting_about.py | 22 ++++++++++++++-------- py/files/LunaTranslator_qss | 2 +- py/generate_xp_code.py | 3 ++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/py/LunaTranslator/gui/setting_about.py b/py/LunaTranslator/gui/setting_about.py index af882a62..3d0a8a12 100644 --- a/py/LunaTranslator/gui/setting_about.py +++ b/py/LunaTranslator/gui/setting_about.py @@ -69,12 +69,16 @@ def trygetupdate(): def doupdate(): if not gobject.baseobject.update_avalable: return - if platform.architecture()[0] == "64bit": - bit = "" - _6432 = "64" - elif platform.architecture()[0] == "32bit": - bit = "_x86" + plat = get_platform() + if plat == "xp": _6432 = "32" + bit = "_x86_winxp" + elif plat == "32": + bit = "_x86" + _6432 = plat + elif plat == "64": + bit = "" + _6432 = plat shutil.copy( r".\files\plugins\shareddllproxy{}.exe".format(_6432), gobject.getcachedir("Updater.exe"), @@ -89,9 +93,11 @@ def doupdate(): def updatemethod_checkalready(size, savep, sha256): if not os.path.exists(savep): return False - stats = os.stat(savep) - if stats.st_size != size: - return False + if get_platform() != "xp": + # requests旧版本重定向的resp.headers不正确 + stats = os.stat(savep) + if stats.st_size != size: + return False if not sha256: return True with open(savep, "rb") as ff: diff --git a/py/files/LunaTranslator_qss b/py/files/LunaTranslator_qss index 7793456f..6695d90c 160000 --- a/py/files/LunaTranslator_qss +++ b/py/files/LunaTranslator_qss @@ -1 +1 @@ -Subproject commit 7793456f3844866866612c07e5edc09128d6c99a +Subproject commit 6695d90cbff787f0614eae5db49e9d9b97ed802b diff --git a/py/generate_xp_code.py b/py/generate_xp_code.py index 711f057c..1de2033a 100644 --- a/py/generate_xp_code.py +++ b/py/generate_xp_code.py @@ -28,7 +28,8 @@ def parsecode(code: str): ) # 移除类型注解 code = re.sub(r": [a-zA-Z0-9_]+\)", ")", code) - code = re.sub(r": [a-zA-Z0-9_]+ = ", " = ", code) + code = re.sub(r": [a-zA-Z0-9_]+,", ",", code) + code = re.sub(r": [a-zA-Z0-9_]+ =", " =", code) return code