From 1d7bd94908097a27c743df08a1942feca0ec19ef Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Wed, 14 Dec 2022 22:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=AD=A3=E7=A1=AE=E8=8E=B7=E5=8F=96=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=90=8D=E5=92=8C=20Activity=20=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- information.json | 4 ++++ mainwindow.py | 9 ++++++++- new-deb-build/DEBIAN/control | 2 +- uengine-apk-builder | 16 ++++++++++++---- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/information.json b/information.json index 2ae4043..d8075e9 100755 --- a/information.json +++ b/information.json @@ -23,6 +23,10 @@ "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V1.8.3:", + "※1、修复安装/打包程序时出现找不到图标的问题;", + "※2、修复部分无法正确获取程序中文名和 Activity 的问题", + "", "V1.8.2:", "※1、重新恢复 uengine-installer For Ubuntu", "※2、修复 postrm 的问题", diff --git a/mainwindow.py b/mainwindow.py index 0fe2796..2b88b6e 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -411,6 +411,7 @@ def GetApkActivityName(apkFilePath: "apk 所在路径")->"获取 apk Activity": line = line.replace("label=", "") line = line.replace("icon=", "") return line + return f"{GetApkPackageName(apkFilePath)}.Main" # 获取 apk 包名 def GetApkPackageName(apkFilePath: "apk 所在路径")->"获取 apk 包名": @@ -483,11 +484,17 @@ Type=Application # 获取软件的中文名称 def GetApkChineseLabel(apkFilePath)->"获取软件的中文名称": info = GetApkInformation(apkFilePath) + name = None for line in info.split('\n'): + if "application-label-zh:" in line: + line = line.replace("application-label-zh:", "") + line = line.replace("'", "") + return line if "application-label:" in line: line = line.replace("application-label:", "") line = line.replace("'", "") - return line + name = line + return name # 保存apk图标 def SaveApkIcon(apkFilePath, iconSavePath)->"保存 apk 文件的图标": diff --git a/new-deb-build/DEBIAN/control b/new-deb-build/DEBIAN/control index 543032d..ef6b1e6 100755 --- a/new-deb-build/DEBIAN/control +++ b/new-deb-build/DEBIAN/control @@ -1,7 +1,7 @@ Package: com.gitee.uengine.runner.spark Source: com.gitee.uengine.runner.spark Replaces: spark-uengine-runner, com.gitee.uengine.runner.spark.ubuntu -Version: 1.8.2-spark +Version: 1.8.3-spark Architecture: all Section: utils Installed-Size: 1600 diff --git a/uengine-apk-builder b/uengine-apk-builder index 7f1d5a0..501244a 100755 --- a/uengine-apk-builder +++ b/uengine-apk-builder @@ -293,6 +293,7 @@ def GetApkActivityName(apkFilePath): line = line.replace("label=", "") line = line.replace("icon=", "") return line + return f"{GetApkPackageName(apkFilePath)}.Main" def GetApkPackageName(apkFilePath, setting): # 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数 @@ -341,13 +342,20 @@ Type=Application '''.format(packageName, activityName, showName, iconPath, showName, showName) write_txt(savePath, things) -def GetApkChineseLabel(apkFilePath): +# 获取软件的中文名称 +def GetApkChineseLabel(apkFilePath)->"获取软件的中文名称": info = GetApkInformation(apkFilePath) + name = None for line in info.split('\n'): + if "application-label-zh:" in line: + line = line.replace("application-label-zh:", "") + line = line.replace("'", "") + return line if "application-label:" in line: line = line.replace("application-label:", "") line = line.replace("'", "") - return line + name = line + return name #合并两个函数到一起 def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": @@ -367,11 +375,11 @@ def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": saveIconFile.write(iconData) return print("Show defult icon") - shutil.copy(programPath + "/defult.png", iconSavePath) + shutil.copy(programPath + "/defult.svg", iconSavePath) except: traceback.print_exc() print("Error, show defult icon") - shutil.copy(programPath + "/defult.png", iconSavePath) + shutil.copy(programPath + "/defult.svg", iconSavePath) def TextboxAddText1(message): global textbox1