diff --git a/information.json b/information.json index 621b86c..63f9bbe 100755 --- a/information.json +++ b/information.json @@ -4,7 +4,7 @@ "https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner" ], - "Version": "2.1.2", + "Version": "2.2.0", "System": "Linux(deepin/UOS/Ubuntu/Debian)", "Tips": [ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis 或程序的更多帮助", @@ -22,6 +22,12 @@ "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V2.2.0:", + "※1、支持 deepin 23,不需要强制依赖 aapt", + "※2、修复 deepin 23 安装的 APK 无法正常在启动器显示图标的问题", + "3、优化安装量统计机制", + "4、关于窗口新增赞助页", + "", "V2.1.2:", "※1、修复 https://gitee.com/gfdgd-xi/uengine-runner/issues/I6ZRZX", "※2、修复添加应用图标时activity名称错误的问题", diff --git a/mainwindow.py b/mainwindow.py index 59fa6d1..1d930b9 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -89,8 +89,8 @@ class UninstallProgram(QtCore.QThread): self.error.emit("疑似卸载失败,请检查 UEngine 是否正常安装、运行以及 APK 文件或包名是否正确、完整") DisabledAndEnbled(False) return - if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), package)): - os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), package)) + if os.path.exists("{}/{}.desktop".format(desktopFilePath, package)): + os.remove("{}/{}.desktop".format(desktopFilePath, package)) if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)): os.remove("{}/{}.desktop".format(get_desktop_path(), package)) findApkHistory.append(ComboInstallPath.currentText()) @@ -174,9 +174,9 @@ class InstallApk(QtCore.QThread): try: if not os.path.exists("/tmp/uengine-runner"): os.makedirs("/tmp/uengine-runner") - if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())): + if not os.path.exists(desktopFilePath): print("Mkdir") - os.makedirs("{}/.local/share/applications/uengine/".format(get_home())) + os.makedirs(desktopFilePath) # 读取设置 setting = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) # 安装应用 @@ -246,7 +246,7 @@ logicalHeight {verticalHeighe} "{}/{}.desktop".format(get_desktop_path(), GetApkPackageName(path))) print("start install apk3") BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, - "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path))) + "{}/{}.desktop".format(desktopFilePath, GetApkPackageName(path))) print("\nprint install complete") if quit: return @@ -266,7 +266,7 @@ def InstallBuildDesktop(iconSavePath): "{}/{}.desktop".format(get_desktop_path(), GetApkPackageName(path)), choose) print("start install apk3") BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, - "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path)), choose) + "{}/{}.desktop".format(desktopFilePath, GetApkPackageName(path)), choose) print("\nprint install complete") def UpdateCombobox(tmp): @@ -587,8 +587,8 @@ def BackUengineClean()->"清空 uengine 数据": if QtWidgets.QMessageBox.warning(widget, "警告", "清空后数据将会完全丢失,确定要继续吗?", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Ok: DisabledAndEnbled(True) try: - if os.path.exists("{}/.local/share/applications/uengine/".format(get_home())): - shutil.rmtree("{}/.local/share/applications/uengine/".format(get_home())) + if os.path.exists(desktopFilePath): + shutil.rmtree(desktopFilePath) except: traceback.print_exc() QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) @@ -1462,7 +1462,7 @@ class AddNewUengineDesktopLink(): # 添加快捷方式 def SaveDesktopLink(): try: - if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.text())): + if os.path.exists("{}/{}.desktop".format(desktopFilePath, packageName.text())): if QtWidgets.QMessageBox.question(widget, "提示", "文件已存在,是否要覆盖?") == QtWidgets.QMessageBox.No: return if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())): @@ -1471,7 +1471,7 @@ class AddNewUengineDesktopLink(): iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.text()) shutil.copy(programPath + "/defult.png", iconSavePath) BuildUengineDesktop(packageName.text(), activityName.text(), packageName.text(), iconSavePath, - "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.text())) + "{}/{}.desktop".format(desktopFilePath, packageName.text())) BuildUengineDesktop(packageName.text(), activityName.text(), packageName.text(), iconSavePath, "{}/{}.desktop".format(get_desktop_path(), packageName.text())) AddNewUengineDesktopLink.SaveHistory() @@ -1485,13 +1485,13 @@ class AddNewUengineDesktopLink(): def DelDesktopLink(): try: global packageName - if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.text())): - QtWidgets.QMessageBox.critical(widget, "错误", "此包名对应的 UEngine 桌面快捷方式不存在!") + if not os.path.exists("{}/{}.desktop".format(desktopFilePath, packageName.text())): + QtWidgets.QMessageBox.critical(widget, "错误", "此包名对应的 UEngine 快捷方式不存在!") return if QtWidgets.QMessageBox.warning(widget, "警告", "你确定要删除吗?删除后将无法恢复!", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Cancel: return try: - os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.text())) + os.remove("{}/{}.desktop".format(desktopFilePath, packageName.text())) AddNewUengineDesktopLink.SaveHistory() QtWidgets.QMessageBox.information(widget, "提示", "已删除") except: @@ -1611,13 +1611,25 @@ desktop = programPath + "/UengineAndroidProgramList.desktop" desktopName = "UengineAndroidProgramList.desktop" useProgram = "" threading.Thread(target=UseProgram).start() +isDeepin23=False +# 判断是不是 Deepin23 +if os.path.exists("/etc/deepin_version"): + try: + with open(f"/etc/deepin_version") as file: + isDeepin23 = "23" in file.read() + except: + traceback.print_exc() +desktopFilePath = f"{get_home()}/.local/share/applications/uengine/" +if isDeepin23: + desktopFilePath = f"{get_home()}/.local/share/applications/" + ########################### # 加载配置 ########################### app = QtWidgets.QApplication(sys.argv) -if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())): - os.makedirs("{}/.local/share/applications/uengine/".format(get_home())) +if not os.path.exists(desktopFilePath): + os.makedirs(desktopFilePath) if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹 os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹 if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkHistory.json"): # 如果没有配置文件 diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/aapt b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/aapt new file mode 100755 index 0000000..ac79931 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/aapt differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/aapt2 b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/aapt2 new file mode 100755 index 0000000..118d523 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/aapt2 differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libaapt.so b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libaapt.so new file mode 120000 index 0000000..aaf190d --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libaapt.so @@ -0,0 +1 @@ +libaapt.so.0 \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libaapt.so.0 b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libaapt.so.0 new file mode 100644 index 0000000..d0e8896 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libaapt.so.0 differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libandroidfw.so.0 b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libandroidfw.so.0 new file mode 100644 index 0000000..f1077ec Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/libandroidfw.so.0 differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/run-aapt.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/run-aapt.sh new file mode 100755 index 0000000..4b9c12e --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/aapt/run-aapt.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# 判断是不是 Deepin23 +cat /etc/deepin_version | grep 23 +if [[ $? != 0 ]]; then + # 如果不是 + aapt "$@" + exit $? +fi +# 如果是 +programPath=$(cd $(dirname $0); pwd) +echo $programPath +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$programPath" +$programPath/aapt "$@" +exit $? diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py index abd242c..d8c2708 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py @@ -6,6 +6,12 @@ import traceback import subprocess from getxmlimg import getsavexml +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string + +# 获取用户主目录 +def get_home()->"获取用户主目录": + return os.path.expanduser('~') + class ProgramInformation: programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string version = "1.6.0Alpha2" @@ -49,7 +55,7 @@ class APK: def uninstall(self): return os.system("uengine uninstall --pkg='{}'".format(self.packageName())) def information(self): - return subprocess.getoutput("aapt dump badging '{}'".format(self.apkPath)) + return subprocess.getoutput("'{}/aapt/run-aapt.sh' dump badging '{}'".format(programPath, self.apkPath)) def activityName(self): info = self.information() for line in info.split('\n'): diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/getxmlimg.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/getxmlimg.py index 2bda884..cbefdef 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/getxmlimg.py +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/getxmlimg.py @@ -10,10 +10,12 @@ import zipfile import subprocess import re +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string + class getsavexml(): def savexml(self,apkFilePath,xmlpath,iconSavePath): - cmddumpid = "aapt dump xmltree "+ apkFilePath + " " + xmlpath + cmddumpid = f"'{programPath}/aapt/run-aapt.sh' dump xmltree "+ apkFilePath + " " + xmlpath print(cmddumpid) xmltree = subprocess.getoutput(cmddumpid) xmls = xmltree.splitlines() @@ -35,7 +37,7 @@ class getsavexml(): print(foreimgid) # 直接从apk resource文件获取前后两层图片路径及ID字符串 - resource = subprocess.getoutput("aapt dump --values resources " + apkFilePath + "| grep -iE -A1 " + "\"" + backimgid + "|" + foreimgid + "\"") + resource = subprocess.getoutput(f"'{programPath}/aapt/run-aapt.sh' dump --values resources " + apkFilePath + "| grep -iE -A1 " + "\"" + backimgid + "|" + foreimgid + "\"") resourcelines = resource.splitlines() print(resourcelines) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json index 2126054..42c4433 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json @@ -263,7 +263,7 @@ "11、deepin 终端", "……" ], - "Time": "2024-01-29 18:34:06 Linux-6.1.32-amd64-desktop-hwe-x86_64-with-glibc2.35", + "Time": "2024-01-29 19:04:32 Linux-6.1.32-amd64-desktop-hwe-x86_64-with-glibc2.35", "Contribute": [ "感谢以下用户提供的问题、建议、图标、代码等,如果有遗漏,请及时与开发者联系添加,以及如果侵犯到您的合法权益,也及时与开发者联系:

", "
", diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder index 1490450..48bc4d2 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder @@ -289,7 +289,7 @@ def write_txt(path, things): file.close() # 关闭文本对象 def GetApkInformation(apkFilePath): - return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath)) + return GetCommandReturn("'{}/aapt/run-aapt.sh' dump badging '{}'".format(programPath, apkFilePath)) def GetApkActivityName(apkFilePath): info = GetApkInformation(apkFilePath) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder-more b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder-more index c1035b7..cefb42d 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder-more +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder-more @@ -313,7 +313,7 @@ def write_txt(path, things): file.close() # 关闭文本对象 def GetApkInformation(apkFilePath): - return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath)) + return GetCommandReturn("'{}/aapt/run-aapt.sh' dump badging '{}'".format(programPath, apkFilePath)) def GetApkActivityName(apkFilePath): info = GetApkInformation(apkFilePath) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner index 202943e..59fa6d1 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner @@ -418,7 +418,7 @@ def write_txt(path: "路径", things: "内容")->"写入文本文档": # 获取 aapt 的所有信息 def GetApkInformation(apkFilePath: "apk 所在路径")->"获取 aapt 的所有信息": - return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath)) + return GetCommandReturn("'{}/aapt/run-aapt.sh' dump badging '{}'".format(programPath, apkFilePath)) # 获取 apk Activity def GetApkActivityName(apkFilePath: "apk 所在路径")->"获取 apk Activity": @@ -1559,7 +1559,7 @@ def UseProgram():

10、deepin 终端:{}

'''.format(subprocess.getoutput("uengine version"), subprocess.getoutput("python3 --version"), QtCore.qVersion, - subprocess.getoutput("aapt version"), + subprocess.getoutput(f"'{programPath}/aapt/run-aapt.sh' version"), subprocess.getoutput("dpkg --version"), subprocess.getoutput("mkdir --version"), subprocess.getoutput("chmod --version"), @@ -1582,7 +1582,7 @@ if not lang in langFile.keys(): programUrl = information["Url"][0] version = information["Version"] goodRunSystem = information["System"] -aaptVersion = GetCommandReturn("aapt version") +aaptVersion = GetCommandReturn(f"'{programPath}/aapt/run-aapt.sh' version") SystemVersion = GetSystemVersion() iconPath = "{}/runner.svg".format(os.path.split(os.path.realpath(__file__))[0]) about = f'''

diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about index 70208f7..36c7d0c 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about @@ -35,7 +35,7 @@ information = json.loads(readtxt(programPath + "/information.json")) programUrl = information["Url"][0] version = information["Version"] goodRunSystem = information["System"] -aaptVersion = subprocess.getoutput("aapt version") +aaptVersion = subprocess.getoutput(f"'{programPath}/aapt/run-aapt.sh' version") about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。 版本 :{} @@ -75,7 +75,7 @@ def UseProgram(): 10、deepin 终端:{}'''.format(subprocess.getoutput("uengine version"), subprocess.getoutput("python3 --version"), tk.TkVersion, - subprocess.getoutput("aapt version"), + subprocess.getoutput(f"'{programPath}/aapt/run-aapt.sh' version"), subprocess.getoutput("dpkg --version"), subprocess.getoutput("mkdir --version"), subprocess.getoutput("chmod --version"),