diff --git a/Language.json b/Language.json index 1653bc7..b10077e 100644 --- a/Language.json +++ b/Language.json @@ -136,7 +136,8 @@ "在 Ubuntu 上安装 UEngine", "启动/禁用UEngine安装的安卓程序程序更新(需要安装 adb 补丁)", "在 Ubuntu 上安装 UEngine", - "设置 UEngine 代理(需要安装 adb 补丁)" + "设置 UEngine 代理(需要安装 adb 补丁)", + "设置 UEngine 指定应用窗口大小" ] }, { @@ -146,7 +147,8 @@ "关于", "反馈程序问题和建议", "检查更新", - "更多帮助" + "更多帮助", + "关于 Qt" ] } ] @@ -304,7 +306,8 @@ "Install UEngine On Ubuntu", "Allow/Disallow UEngine To Install Or Update Other Android Program (Need Install Adb Patch)", "Install UEngine On Ubuntu", - "Set UEngine Http Proxy (Need Install Adb Patch)" + "Set UEngine Http Proxy (Need Install Adb Patch)", + "Set UEngine Some Android Windows Size" ] }, { @@ -314,7 +317,8 @@ "About This Program", "Upload Problem And Advice", "Update This Program", - "More Help" + "More Help", + "About Qt" ] } ] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6f2a3a8 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +build: + echo "Build DEB..." + cp -rv information.json new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv mainwindow.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner + cp -rv Language.json new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-window-size-setting.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-keyboard new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-apk-builder new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-useadb new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-runner-update-bug new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-runner-applist-launch.sh new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv launch.sh new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-installer new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv LICENSE new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-runner-launch.sh new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-runner-about new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-clean new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-app-uninstall new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-app-setting.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine-app-install new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv uengine_logo.svg new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv runner.svg new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv root-uengine.sh new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv menu.svg new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv icon.png new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv getxmlimg.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv defult.svg new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv builer.svg new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv api new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv Help new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv pkexec/* new-deb-build/usr/share/polkit-1/actions + dpkg -b new-deb-build com.gitee.uengine.runner.spark.deb + +install: + make build + echo "Install..." + sudo apt update + sudo dpkg -i com.gitee.uengine.runner.spark.deb + sudo apt install -f + +depend: + sudo apt install python3 python3-tk python3-pip aapt \ + python3-setuptools deepin-terminal curl python3-pil\ + python3-requests adb fonts-noto-cjk python3-numpy\ + python3-matplotlib wget inotify-tools aria2 python3-pyqt5 + python3 -m pip install --upgrade pip --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple + python3 -m pip install --upgrade ttkthemes --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple + python3 -m pip install --upgrade pyautogui --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple + python3 -m pip install --upgrade keyboard --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple + +run: + python3 mainwindow.py \ No newline at end of file diff --git a/README.md b/README.md index 3581f7e..350e64a 100755 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# UEngine 运行器 1.7.0 +# UEngine 运行器 1.8.0 ### 介绍         新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。 -![image.png](https://storage.deepin.org/thread/202207081157256904_image.png) +![image.png](https://storage.deepin.org/thread/202207271700065629_image.png) -(测试平台:UOS 家庭版 21.1,deepin 20.6,UOS 专业版 1040) +(测试平台:UOS 家庭版 21.3,deepin 20.6,UOS 专业版 1040) ## 安装前必读 + **UEngine 安装时会自动把要安装的 apk 删除**,如果这个 apk 文件非常重要请**拷贝一个备份版并安装这个备份版或者在程序设置里面选择“备份APK包然后在安装后自动拷贝原先目录”选项** -![image.png](https://storage.deepin.org/thread/202205211808393526_image.png) +![image.png](https://storage.deepin.org/thread/202207271700517092_image.png) ## 如何升级至最新版本 ### 一、使用星火应用商店更新到最新版本 @@ -35,6 +35,17 @@ sudo apt upgrade ### 更新内容 +#### V1.8.0(2022年07月27日) +**※1、程序界面大部分由 Tkinter 转 PyQt5** +**※2、添加了自动/手动配置 UEngine 窗口大小文件(自动需要在设置里手动开启,配置窗口的配置文件需要 Root)** +**※3、增加了安装/卸载失败后的提示** +**※4、补回谢明名单** +**※5、支持免密安装/卸载 APK** +6、pip 更换华为源,提升下载速度 +7、新增主题功能 +8、支持在安装 APK 后手动指定分类(手动指定需要在设置里手动开启) +![image.png](https://storage.deepin.org/thread/202207271700065629_image.png) + #### V1.7.0(2022年07月08日,暑假开始) **※1、新增暗黑主题** **※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题** @@ -220,16 +231,7 @@ FileNotFoundError: [Errno 2] No such file or directory: '/home/gfdgd_xi/.local/s 1. 安装所需依赖 ```bash -sudo apt install python3 python3-tk python3-pip aapt uengine -sudo apt install python3-setuptools deepin-terminal curl python3-pil -sudo apt install python3-pil.imagetk python3-requests adb -sudo apt install translate-shell python3-xlib fonts-noto-cjk -sudo apt install python3-numpy python3-matplotlib wget inotify-tools aria2 -python3 -m pip install --upgrade pip -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade ttkthemes -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade pyautogui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade keyboard -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade easygui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +sudo apt install make ``` 2. 下载本程序 @@ -241,10 +243,16 @@ git clone https://gitee.com/gfdgd-xi/uengine-runner.git 3. 运行本程序 ```bash -chmod 777 uengine-runner/main.py -./uengine-runner/main.py +cd uengine-runner +make run ``` +如果你想要安装到系统,只需要输入: +```bash +make install +``` +即可 + ### 使用说明 1、需要你有使用 root 权限的能力; 2、需要安装 UEngine 才能使用,UOS建议在商店安装一个安卓应用,让系统自动安装 UEngine 及相关的依赖包; diff --git a/com.gitee.uengine.runner.spark.deb b/com.gitee.uengine.runner.spark.deb index a068aa2..c455064 100755 Binary files a/com.gitee.uengine.runner.spark.deb and b/com.gitee.uengine.runner.spark.deb differ diff --git a/pkexec/icon/kbox.svg b/icon/kbox.svg similarity index 100% rename from pkexec/icon/kbox.svg rename to icon/kbox.svg diff --git a/pkexec/icon/preferences-system.svg b/icon/preferences-system.svg similarity index 100% rename from pkexec/icon/preferences-system.svg rename to icon/preferences-system.svg diff --git a/information.json b/information.json index 5c54707..52018b4 100755 --- a/information.json +++ b/information.json @@ -7,7 +7,7 @@ "Version": "1.8.0", "System": "Linux(deepin/UOS)", "Tips": [ - "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis", + "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis 或程序的更多帮助", "安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮", "卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。", "保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可", @@ -22,6 +22,16 @@ "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V1.8.0:", + "※1、程序界面大部分由 Tkinter 转 PyQt5", + "※2、添加了自动/手动配置 UEngine 窗口大小文件(自动需要在设置里手动开启,配置窗口的配置文件需要 Root)", + "※3、增加了安装/卸载失败后的提示", + "※4、补回谢明名单", + "※5、支持免密安装/卸载 APK", + "6、pip 更换华为源,提升下载速度", + "7、新增主题功能", + "8、支持在安装 APK 后手动指定分类(手动指定需要在设置里手动开启)", + "", "V1.7.0:", "※1、新增暗黑主题", "※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题", @@ -169,11 +179,22 @@ ], "Time": "2021年08月30日", "Contribute": [ - "gfdgd xi<3025613752@qq.com>", - "actionchen<917981399@qq.com>", - "柚子", - "为什么您不喜欢熊出没和阿布呢", - "星空露光", - "shenmo" + "感谢以下用户提供的问题、建议、图标、代码等,如果有遗漏,请及时与开发者联系添加,以及如果侵犯到您的合法权益,也及时与开发者联系:

", + "
", + "感谢 麻木法师(1312580754) 在星火应用商店QQ交流群展示的接口及其原理", + "感谢 actionchen(917981399@qq.com) 提供了新版页面布局(1.3.0 ~ 最新版本)以及布局代码(1.3.0 ~ 1.7.0)", + "感谢 柚子(https://gitee.com/Limexb) 提供了 UEngine 构建 Root 镜像脚本", + "感谢 星空露光(https://gitee.com/Cynorkyle) 制作了 UEngine 新版图标和安装应用时能选择应用分类的建议", + "感谢 shenmo(jifengshenmo@outlook.com) 反馈了许多程序的问题以及提供了 UEngine 在 Ubuntu 上的安装脚本", + "感谢 desert(https://gitee.com/desert741) 提供了给软件增加启动成功后自动调整分辨率的功能的建议", + "感谢 云思浮(https://gitee.com/foresee_io) 反馈的 1.3.0 依赖缺失问题", + "感谢 miaoys(https://bbs.deepin.org/user/271467)、zccrs(https://bbs.deepin.org/user/277780) 等用户反馈希望程序能和与系统 DTK 主题协调的建议", + "感谢 jiutian123(https://bbs.deepin.org/user/258825) 反馈的 1.5.2、1.5.3 存在问题", + "感谢 kero990(https://bbs.deepin.org/user/277932) 反馈的 README 表示不清的问题", + "感谢 wang(https://gitee.com/wang1279476881) 反馈的 1.6.0 左键打不开 “安装与卸载APK”和打包时 APK 版本号开头带 V 无法正常打包的问题", + "感谢 通天灵宝(https://bbs.deepin.org/user/137230)、wuhaiou123(https://bbs.chinauos.com/zh/user/309117) 反馈的 图标生成错误导致无法生成 .desktop 文件的问题", + "感谢 潜伏(https://bbs.chinauos.com/zh/user/303339) 反馈的右键支持安装/卸载的建议", + "感谢 z***g@gmx.de(https://bbs.chinauos.com/zh/user/312017) 反馈的 UEngine 更新后 uengine-launch.sh 的社区版检测问题", + "参考 忘记、过去(https://bbs.deepin.org/user/154730) 的帖子《如何更优雅地使用 pkexec》(https://bbs.deepin.org/post/202966)" ] } \ No newline at end of file diff --git a/mainwindow.py b/mainwindow.py index 990054b..bde5c2b 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -5,7 +5,7 @@ # 版本:1.8.0 # 更新时间:2022年07月25日 # 感谢:anbox、deepin 和 UOS -# 基于 Python3 的 tkinter 构建 +# 基于 Python3 的 PyQt5 构建 # 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>、为什么您不喜欢熊出没和阿布呢 ########################################################################################### ################# @@ -16,15 +16,15 @@ import api import sys import time import json +import numpy import shutil import zipfile +import requests import traceback import threading import webbrowser import subprocess import matplotlib -import requests -import numpy import matplotlib.figure import matplotlib.pylab import matplotlib.font_manager @@ -46,7 +46,7 @@ class UninstallProgram(QtCore.QThread): package = self.package try: global fineUninstallApkHistory - Return = os.system("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package)) + Return = os.system("uengine uninstall --pkg='{}'".format(package)) print(Return) if Return != 0: self.error.emit("疑似卸载失败,请检查 UEngine 是否正常安装、运行以及 APK 文件或包名是否正确、完整") @@ -63,7 +63,7 @@ class UninstallProgram(QtCore.QThread): DisabledAndEnbled(False) except: traceback.print_exc() - self.error.emit(title="错误", message=traceback.format_exc()) + self.error.emit(traceback.format_exc()) DisabledAndEnbled(False) # 卸载程序 #def UninstallProgram(package: "apk 包名")->"卸载程序": @@ -115,6 +115,7 @@ def Button3Install(): QT.installRun.infor.connect(InformationBox) QT.installRun.error.connect(ErrorBox) QT.installRun.combo.connect(UpdateCombobox) + QT.installRun.make.connect(InstallBuildDesktop) QT.installRun.start() # 安装应用 @@ -122,6 +123,7 @@ class InstallApk(QtCore.QThread): infor = QtCore.pyqtSignal(str) error = QtCore.pyqtSignal(str) combo = QtCore.pyqtSignal(int) + make = QtCore.pyqtSignal(str) def __init__(self, path, quit = False) -> None: self.path = path @@ -159,12 +161,7 @@ class InstallApk(QtCore.QThread): return setting["SaveApk"] = False print("start install apk2") - BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, - "{}/{}.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))) - commandReturn = os.system("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path)) + commandReturn = os.system("uengine install --apk='{}'".format(path)) try: if setting["SaveApk"]: shutil.copy("/tmp/uengine-runner/bak.apk", path) @@ -174,18 +171,67 @@ class InstallApk(QtCore.QThread): self.error.emit("疑似 APK 安装失败,请检查 UEngine 是否正常安装、运行以及 APK 文件是否正确、完整") DisabledAndEnbled(False) return - print("\nprint install complete") + if settingConf["AutoScreenConfig"]: + # 计算最合适的大小 + # 竖屏 + screen = QtGui.QGuiApplication.primaryScreen() + mm = screen.availableGeometry() + verticalHeighe = int(mm.height() * 0.9) # 竖屏高 + verticalWidth = int(verticalHeighe / 16 * 9) # 竖屏宽 + horizontaltWidth = int(mm.width() * 0.8) # 横屏宽 + horizontaltHeighe = int(horizontaltWidth / 16 * 9) # 横屏高 + + #verticalHeighe = + write_txt(f"/tmp/{GetApkPackageName(path)}.txt", f"""verticalWidth {verticalWidth} //竖屏宽 +verticalHeighe {verticalHeighe} //竖屏高 +horizontaltWidth {horizontaltWidth} //横屏宽,备选为1280 +horizontaltHeighe {horizontaltHeighe} //横屏高 ,备选为720 +verticalScreen 1 //设置默认横屏还是竖屏,1为竖屏,0为横屏 +allowFullScreen 1 //设置是否允许全屏,1为允许,0为不允许 +allowScreenSwitching 1 //设置是否允许横竖屏切换,1为允许,0为不允许 +defaultFullScreen 0 //设置是否默认显示最大化,1为默认最大化,0为不是 + +logicalDensityDpi 160 +physicalDpi 72 +appWidth {verticalWidth} +appHeight {verticalHeighe} +logicalWidth {verticalWidth} +logicalHeight {verticalHeighe} +""") + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -a {GetApkPackageName(path)}"): + self.error.emit("屏幕配置设置失败") + DisabledAndEnbled(False) + return + if settingConf["ChooseProgramType"]: + self.make.emit(iconSavePath) + else: + BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, + "{}/{}.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))) + print("\nprint install complete") if quit: return - self.infor.emit("操作完成!") findApkHistory.append(ComboInstallPath.currentText()) self.combo.emit(0) write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + self.infor.emit("操作完成!") except: traceback.print_exc() self.error.emit(traceback.format_exc()) DisabledAndEnbled(False) +def InstallBuildDesktop(iconSavePath): + choose = QtWidgets.QInputDialog.getItem(widget, "提示", "请选择分类,如果点击取消,将会设置为默认的分类", ["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility"])[0] + path = ComboInstallPath.currentText() + BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), 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) + print("\nprint install complete") + def UpdateCombobox(tmp): ComboInstallPath.clear() ComboInstallPath.addItems(findApkHistory) @@ -199,8 +245,6 @@ def InformationBox(info): # 禁用或启动所有控件 def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控件": - userChoose = {True: tk.DISABLED, False: tk.NORMAL} - a = userChoose[choose] ComboInstallPath.setDisabled(choose) #ComboUninstallPath.configure(state=a) BtnFindApk.setDisabled(choose) @@ -233,15 +277,6 @@ def Button5Click(): def OpenUengineProgramList()->"打开“uengine 所有程序列表”": os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") -# 显示“提示”窗口 -def helps()->"显示“提示”窗口": - global tips - messagebox.showinfo(title="提示", message=tips) - -# 显示更新内容窗口 -def UpdateThings()->"显示更新内容窗口": - messagebox.showinfo(title="更新内容", message=updateThings) - # 打开程序官网 def OpenProgramURL()->"打开程序官网": webbrowser.open_new_tab(programUrl) @@ -392,21 +427,35 @@ def ReinstallUengineImage(): threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e ''pkexec apt reinstall uengine-android-image -y"]).start() # 生成 uengine 启动文件到桌面 -def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径")->"生成 uengine 启动文件到桌面": +def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径", choose="")->"生成 uengine 启动文件到桌面": if showName == "" or showName == None: showName = "未知应用" - things = '''[Desktop Entry] -Categories=app; + if choose != "": + things = f'''[Desktop Entry] Encoding=UTF-8 -Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} -GenericName={} -Icon={} +Exec=uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName} +GenericName={showName} +Icon={iconPath} MimeType= -Name={} -StartupWMClass={} +Name={showName} +StartupWMClass={showName} +Categories={choose}; Terminal=false Type=Application -'''.format(packageName, activityName, showName, iconPath, showName, showName) +''' + else: + things = f'''[Desktop Entry] +Categories=app; +Encoding=UTF-8 +Exec=uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName} +GenericName={showName} +Icon={iconPath} +MimeType= +Name={showName} +StartupWMClass={showName} +Terminal=false +Type=Application +''' write_txt(savePath, things) # 获取软件的中文名称 @@ -542,7 +591,7 @@ def ScrcpyConnectUengine(): if os.path.exists("/snap/bin/scrcpy"): threading.Thread(target=os.system, args=["/snap/bin/scrcpy -s '192.168.250.2:5555'"]).start() return - if QtWidgets.QMessageBox.question(title="提示", message="你没有安装Scrcpy(指使用Snap安装),\n如果你使用了其他方法安装了Scrcpy,可以输入命令“scrcpy -s '192.168.250.2:5555'”,\n是否现在要使用Snap安装Scrcpy?") == QtWidgets.QMessageBox.Yes: + if QtWidgets.QMessageBox.question(widget, "提示", "你没有安装Scrcpy(指使用Snap安装),\n如果你使用了其他方法安装了Scrcpy,可以输入命令“scrcpy -s '192.168.250.2:5555'”,\n是否现在要使用Snap安装Scrcpy?") == QtWidgets.QMessageBox.Yes: if not os.path.exists("/tmp/uengine-runner"): os.makedirs("/tmp/uengine-runner") write_txt("/tmp/uengine-runner/InstallScrcpy.sh", '''#!/bin/bash @@ -571,7 +620,6 @@ def get_desktop_path()->"获取用户桌面目录": def SaveInstallUengineApp(): while True: result = QtWidgets.QInputDialog.getText(widget, "输入 APK 包名", "请输入要获取的apk包名以便进行下一步操作") - #result = simpledialog.askstring(title="输入apk包名", prompt="请输入要获取的apk包名以便进行下一步操作") if result[1] == False: return result = result[0] @@ -667,7 +715,7 @@ def UengineUseAdb(): # 因为需要 root,所以需要开二号程序 os.system("adb start-server") # 保证有生成文件 os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath, "{}/.android/adbkey.pub".format(get_home()))) # 写入配置 - if QtWidgets.QMessageBox.question(title="提示", message="是否要连接到 UEngine?") == QtWidgets.QMessageBox.Yes: + if QtWidgets.QMessageBox.question(widget, "提示", "是否要连接到 UEngine?") == QtWidgets.QMessageBox.Yes: UengineConnectAdb() def UengineDoNotUseAdb(): @@ -729,9 +777,9 @@ def SetHttpProxy(): adb = api.Adb("192.168.250.2:5555") adb.Service.Close() adb.connect() - if QtWidgets.QMessageBox.question(title="提示", message="此功能需要安装 adb 补丁,请保证已经安装然后按下“Yes”") == QtWidgets.QMessageBox.No: + if QtWidgets.QMessageBox.question(widget, "提示", "此功能需要安装 adb 补丁,请保证已经安装然后按下“Yes”") == QtWidgets.QMessageBox.No: return - proxy = QtWidgets.QInputDialog(title="输入代理", msg="请输入要设置的代理(为空代表不设置代理)") + proxy = QtWidgets.QInputDialog.getText(widget, "输入代理", "请输入要设置的代理(为空代表不设置代理)") if proxy[1] == False: return if proxy[0] == "": @@ -743,28 +791,229 @@ def SetHttpProxy(): os.system(f"adb -s 192.168.250.2:5555 shell settings put global http_proxy \"{proxy[0]}\"") QtWidgets.QMessageBox.information(widget, "提示", "设置成功!") - +class UengineWindowSizeSetting: + setting = None + package = "com.nuts.extremspeedup" + verticalWidth = None + verticalHeighe = None + horizontaltWidth = None + horizontaltHeighe = None + verticalScreen = None + allowFullScreen = None + allowScreenSwitching = None + defaultFullScreen = None + logicalDensityDpi = None + physicalDpi = None + appWidth = None + appHeight = None + logicalWidth = None + logicalHeight = None + lineEdit = { + "verticalWidth": verticalWidth, + "verticalHeighe": verticalHeighe, + "horizontaltWidth": horizontaltWidth, + "horizontaltHeighe": horizontaltHeighe, + "logicalDensityDpi": logicalDensityDpi, + "physicalDpi": physicalDpi, + "appWidth": appWidth, + "appHeight": appHeight, + "logicalWidth": logicalWidth, + "logicalHeight": logicalHeight + } + checkbox = { + "verticalScreen": verticalScreen, + "allowFullScreen": allowFullScreen, + "allowScreenSwitching": allowScreenSwitching, + "defaultFullScreen": defaultFullScreen + } + def ShowWindow(): + unfound = False + while True: + if ComboInstallPath.currentText() == "": + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名") + else: + if GetApkPackageName(ComboInstallPath.currentText()) == None: + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名", text=ComboInstallPath.currentText()) + else: + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名", text=GetApkPackageName(ComboInstallPath.currentText())) + if not choose[1]: + return + if choose[0] == "": + QtWidgets.QMessageBox.information(widget, "提示", "包名不能为空") + continue + if not os.path.exists(f"/usr/share/uengine/appetc/{choose[0]}.txt"): + if QtWidgets.QMessageBox.question(widget, "提示", "未找到这个包名对应的配置文件,是否要创建一个?") == QtWidgets.QMessageBox.No: + continue + unfound = True + UengineWindowSizeSetting.package = choose[0] + break + UengineWindowSizeSetting.setting = QtWidgets.QMainWindow() + settingWidget = QtWidgets.QWidget() + settingLayout = QtWidgets.QGridLayout() + + UengineWindowSizeSetting.verticalWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.verticalHeighe = QtWidgets.QLineEdit() + UengineWindowSizeSetting.horizontaltWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.horizontaltHeighe = QtWidgets.QLineEdit() + UengineWindowSizeSetting.verticalScreen = QtWidgets.QCheckBox("默认为竖屏") + UengineWindowSizeSetting.allowFullScreen = QtWidgets.QCheckBox("允许全屏") + UengineWindowSizeSetting.allowScreenSwitching = QtWidgets.QCheckBox("允许横竖屏切换") + UengineWindowSizeSetting.defaultFullScreen = QtWidgets.QCheckBox("默认显示最大化") + UengineWindowSizeSetting.logicalDensityDpi = QtWidgets.QLineEdit() + UengineWindowSizeSetting.physicalDpi = QtWidgets.QLineEdit() + UengineWindowSizeSetting.appWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.appHeight = QtWidgets.QLineEdit() + UengineWindowSizeSetting.logicalWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.logicalHeight = QtWidgets.QLineEdit() + saveButton = QtWidgets.QPushButton("保存设置") + deleButton = QtWidgets.QPushButton("删除设置") + saveButton.clicked.connect(UengineWindowSizeSetting.SaveSetting) + deleButton.clicked.connect(UengineWindowSizeSetting.DeleteSetting) + settingLayout.addWidget(QtWidgets.QLabel("竖屏宽:"), 0, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalWidth, 0, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("竖屏高:"), 1, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalHeighe, 1, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("横屏宽,备选为1280:"), 2, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.horizontaltWidth, 2, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("横屏高,备选为720:"), 3, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.horizontaltHeighe, 3, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置默认横屏还是竖屏:"), 4, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalScreen, 4, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否允许全屏:"), 5, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.allowFullScreen, 5, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否允许横竖屏切换:"), 6, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.allowScreenSwitching, 6, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否默认显示最大化:"), 7, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.defaultFullScreen, 7, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("
"), 8, 0, 1, 3) + settingLayout.addWidget(QtWidgets.QLabel("屏幕缩放,数值大则大:"), 9, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalDensityDpi, 9, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("physicalDpi:"), 10, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.physicalDpi, 10, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("appWidth:"), 11, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.appWidth, 11, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("appHeight:"), 12, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.appHeight, 12, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("logicalWidth:"), 13, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalWidth, 13, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("logicalHeight:"), 14, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalHeight, 14, 1, 1, 2) + settingLayout.addWidget(saveButton, 15, 1, 1, 1) + settingLayout.addWidget(deleButton, 15, 2, 1, 1) + UengineWindowSizeSetting.lineEdit = { + "verticalWidth": UengineWindowSizeSetting.verticalWidth, + "verticalHeighe": UengineWindowSizeSetting.verticalHeighe, + "horizontaltWidth": UengineWindowSizeSetting.horizontaltWidth, + "horizontaltHeighe": UengineWindowSizeSetting.horizontaltHeighe, + "logicalDensityDpi": UengineWindowSizeSetting.logicalDensityDpi, + "physicalDpi": UengineWindowSizeSetting.physicalDpi, + "appWidth": UengineWindowSizeSetting.appWidth, + "appHeight": UengineWindowSizeSetting.appHeight, + "logicalWidth": UengineWindowSizeSetting.logicalWidth, + "logicalHeight": UengineWindowSizeSetting.logicalHeight + } + UengineWindowSizeSetting.checkbox = { + "verticalScreen": UengineWindowSizeSetting.verticalScreen, + "allowFullScreen": UengineWindowSizeSetting.allowFullScreen, + "allowScreenSwitching": UengineWindowSizeSetting.allowScreenSwitching, + "defaultFullScreen": UengineWindowSizeSetting.defaultFullScreen + } + settingWidget.setLayout(settingLayout) + UengineWindowSizeSetting.setting.setCentralWidget(settingWidget) + if not unfound: + UengineWindowSizeSetting.ReadSetting() + else: + for i in UengineWindowSizeSetting.checkbox.values(): + i.setChecked(True) + UengineWindowSizeSetting.setting.setWindowTitle(f"设置 Android 应用的窗口大小缩放设置") + UengineWindowSizeSetting.setting.show() + UengineWindowSizeSetting.setting.resize(UengineWindowSizeSetting.setting.frameSize().width() * 1.3, UengineWindowSizeSetting.setting.frameSize().height()) + + def ReadSetting(): + file = open(f"/usr/share/uengine/appetc/{UengineWindowSizeSetting.package}.txt") + while True: + line = file.readline() + if not line: + break + line = line.strip() + print(line) + if "//" in line: + line = line[:line.index("//")] + try: + if line[:line.index(" ")].strip() in UengineWindowSizeSetting.lineEdit.keys(): + UengineWindowSizeSetting.lineEdit[line[:line.index(" ")].strip()].setText(line[line.index(" "):].strip()) + if line[:line.index(" ")].strip() in UengineWindowSizeSetting.checkbox.keys(): + UengineWindowSizeSetting.checkbox[line[:line.index(" ")].strip()].setChecked(bool(line[line.index(" "):].strip())) + except: # 错误行,忽略 + pass + file.close() + + def SaveSetting(): + file = open(f"/tmp/{UengineWindowSizeSetting.package}.txt", "w") + for i in UengineWindowSizeSetting.lineEdit.keys(): + if UengineWindowSizeSetting.lineEdit[i].text() == "": # 空选项,不写入 + continue + try: + file.write(f"{i} {int(UengineWindowSizeSetting.lineEdit[i].text())}\n") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", "格式输入错误") + return + for i in UengineWindowSizeSetting.checkbox.keys(): + try: + file.write(f"{i} {int(UengineWindowSizeSetting.checkbox[i].isChecked())}\n") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + return + file.close() + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -a {UengineWindowSizeSetting.package}"): + QtWidgets.QMessageBox.critical(widget, "错误", "保存失败") + return + QtWidgets.QMessageBox.information(widget, "提示", "保存完成!") + + def DeleteSetting(): + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -d {UengineWindowSizeSetting.package}"): + QtWidgets.QMessageBox.critical(widget, "错误", "删除失败") + return + QtWidgets.QMessageBox.information(widget, "提示", "删除完成!") + class SettingWindow(): saveApkOption = None settingWindow = None + autoScreenConfig = None + chooseProgramType = None + theme = None def ShowWindow(): SettingWindow.settingWindow = QtWidgets.QMainWindow() setting = QtWidgets.QWidget() settingLayout = QtWidgets.QGridLayout() SettingWindow.saveApkOption = QtWidgets.QComboBox() + SettingWindow.autoScreenConfig = QtWidgets.QCheckBox("安装APK时自动根据系统分辨率设置,卸载时自动移除") + SettingWindow.chooseProgramType = QtWidgets.QCheckBox("安装APK时手动选择程序分类") + SettingWindow.theme = QtWidgets.QComboBox() + themeTry = QtWidgets.QPushButton("测试(重启后变回设置的主题)") + SettingWindow.theme.addItems(QtWidgets.QStyleFactory.keys()) controlFrame = QtWidgets.QHBoxLayout() cancalButton = QtWidgets.QPushButton("取消") okButton = QtWidgets.QPushButton("保存") settingLayout.addWidget(QtWidgets.QLabel("APK 安装模式:"), 0, 0, 1, 1) settingLayout.addWidget(SettingWindow.saveApkOption, 0, 1, 1, 1) - settingLayout.addLayout(controlFrame, 1, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("窗口大小策略:"), 1, 0, 1, 1) + settingLayout.addWidget(SettingWindow.autoScreenConfig, 1, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("程序分类策略:"), 2, 0, 1, 1) + settingLayout.addWidget(SettingWindow.chooseProgramType, 2, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("程序分类策略:"), 2, 0, 1, 1) + settingLayout.addWidget(SettingWindow.theme, 2, 1, 1, 1) + settingLayout.addWidget(themeTry, 2, 2, 1, 1) + settingLayout.addLayout(controlFrame, 4, 1, 1, 2) controlFrame.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) controlFrame.addWidget(cancalButton) controlFrame.addWidget(okButton) - + SettingWindow.saveApkOption.addItems(["不备份Apk包直接安装", "备份Apk包然后在安装后自动拷贝原先目录"]) try: data = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) @@ -772,7 +1021,11 @@ class SettingWindow(): QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SettingReadError"]) SettingWindow.settingWindow.close() return + SettingWindow.autoScreenConfig.setChecked(settingConf["AutoScreenConfig"]) SettingWindow.saveApkOption.setCurrentIndex(int(data["SaveApk"])) + SettingWindow.chooseProgramType.setChecked(settingConf["ChooseProgramType"]) + SettingWindow.theme.setCurrentText(settingConf["Theme"]) + themeTry.clicked.connect(SettingWindow.Try) cancalButton.clicked.connect(SettingWindow.settingWindow.close) okButton.clicked.connect(SettingWindow.SaveSetting) @@ -782,11 +1035,26 @@ class SettingWindow(): SettingWindow.settingWindow.setCentralWidget(setting) SettingWindow.settingWindow.show() SettingWindow.settingWindow.setFixedSize(SettingWindow.settingWindow.frameSize().width(), SettingWindow.settingWindow.frameSize().height()) - return + def Try(): + app.setStyle(QtWidgets.QStyleFactory.create(SettingWindow.theme.currentText())) + def SaveSetting(): + global settingConf try: - write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({"SaveApk": bool(SettingWindow.saveApkOption.currentIndex())})) + write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({ + "SaveApk": bool(SettingWindow.saveApkOption.currentIndex()), + "AutoScreenConfig": SettingWindow.autoScreenConfig.isChecked(), + "ChooseProgramType": SettingWindow.chooseProgramType.isChecked(), + "Theme": SettingWindow.theme.currentText() + })) + settingConf = { + "SaveApk": bool(SettingWindow.saveApkOption.currentIndex()), + "AutoScreenConfig": SettingWindow.autoScreenConfig.isChecked(), + "ChooseProgramType": SettingWindow.chooseProgramType.isChecked(), + "Theme": SettingWindow.theme.currentText() + } + app.setStyle(QtWidgets.QStyleFactory.create(SettingWindow.theme.currentText())) except: traceback.print_exc() QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SettingSaveError"]) @@ -824,7 +1092,7 @@ class UpdateWindow(): updateWidget.setLayout(updateWidgetLayout) UpdateWindow.update.setCentralWidget(updateWidget) UpdateWindow.update.setWindowTitle("检查更新") - UpdateWindow.setWindowIcon(QtGui.QIcon(iconPath)) + UpdateWindow.update.setWindowIcon(QtGui.QIcon(iconPath)) UpdateWindow.update.resize(updateWidget.frameGeometry().width(), int(updateWidget.frameGeometry().height() * 1.5)) UpdateWindow.update.show() @@ -869,9 +1137,7 @@ class ApkInformation(): messageWidget = QtWidgets.QWidget() messageLayout = QtWidgets.QVBoxLayout() ApkInformation.message.setWindowTitle("“{}“的Apk信息".format(GetApkChineseLabel(path))) - #message.iconphoto(False, tk.PhotoImage(file=iconPath)) tab = QtWidgets.QTabWidget() - #tab = ttk.Notebook(message) tab1 = QtWidgets.QWidget() tab2 = QtWidgets.QWidget() @@ -1006,48 +1272,10 @@ class AdbChangeUengineDisplaySize(): AdbChangeUengineDisplaySize.messageWindow.setWindowIcon(QtGui.QIcon(iconPath)) AdbChangeUengineDisplaySize.messageWindow.show() return - message.iconphoto(False, tk.PhotoImage(file=iconPath)) - messageFrame = ttk.Frame(message) - - displaySize = tk.StringVar() - displaySize.set("当前 UEngine 屏幕分辨率:正在获取") - - displaySizeLabel = ttk.Label(messageFrame, textvariable=displaySize) - - input = ttk.Frame(messageFrame) - displayX = ttk.Entry(input) - displayY = ttk.Entry(input) - - settingBUtton = ttk.Button(messageFrame, text="设置分辨率", command=AdbChangeUengineDisplaySize.SettingDisplaySize) - - message.title("修改 UEngine 分辨率") - message.resizable(0, 0) - message.iconphoto(False, tk.PhotoImage(file=iconPath)) - # get screen width and height - screen_width = message.winfo_screenwidth() - screen_height = message.winfo_screenheight() - # calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。 - winwith=570 - winhigh=236 - x = (screen_width/2) - (winwith/2) - y = (screen_height/2) - (winhigh/2) - message.geometry("+{}+{}".format(int(x), int(y))) - - displayX.grid(row=0, column=0) - displayY.grid(row=0, column=1) - - displaySizeLabel.grid(row=0, column=0) - input.grid(row=1, column=0) - settingBUtton.grid(row=2, column=0) - - messageFrame.pack() - threading.Thread(target=AdbChangeUengineDisplaySize.GetUengineDisplaySize).start() - message.mainloop() def GetUengineDisplaySize(): global displaySize displaySize.setText("当前 UEngine 屏幕分辨率:\n" + subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size")) - #displaySize.set(subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size")) def SettingDisplaySize(): global displayX @@ -1178,8 +1406,6 @@ class AddNewUengineDesktopLink(): def SaveHistory(): findApkNameHistory.append(packageName.text()) findApkActivityHistory.append(activityName.text()) - #packageName['value'] = findApkNameHistory - #activityName['value'] = findApkActivityHistory write_txt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json", str(json.dumps(ListToDictionary(findApkNameHistory)))) # 将历史记录的数组转换为字典并写入 write_txt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json", str(json.dumps(ListToDictionary(findApkActivityHistory)))) # 将历史记录的数组转换为字典并写入 @@ -1199,16 +1425,16 @@ class AddNewUengineDesktopLink(): def UseProgram(): global useProgram - useProgram = '''1、UEngine:{} -2、python3:{} -3、PyQt:{} -4、aapt:{} -5、dpkg:{} -6、mkdir:{} -7、echo -8、chmod:{} -9、adb:{} -10、deepin 终端:{}'''.format(subprocess.getoutput("uengine version"), + useProgram = '''

1、UEngine:{}

+

2、python3:{}

+

3、PyQt:{}

+

4、aapt:{}

+

5、dpkg:{}

+

6、mkdir:{}

+

7、echo

+

8、chmod:{}

+

9、adb:{}

+

10、deepin 终端:{}

'''.format(subprocess.getoutput("uengine version"), subprocess.getoutput("python3 --version"), QtCore.qVersion, subprocess.getoutput("aapt version"), @@ -1247,14 +1473,13 @@ about = f'''

©2021-{time.strftime("%Y")}

''' updateThingsString = "" tips = "" -contribute = "
    " +contribute = "" for i in information["Tips"]: tips += f"

    {i}

    " for i in information["Update"]: updateThingsString += f"

    {i}

    " for i in information["Contribute"]: - contribute += f"
  • {i}
  • " -contribute += "
" + contribute += f"

{i}

" title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version) updateTime = information["Time"] updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) @@ -1266,6 +1491,7 @@ threading.Thread(target=UseProgram).start() ########################### # 加载配置 ########################### +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(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹 @@ -1288,7 +1514,6 @@ if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApkIcon.json"): write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApk.json"): # 如果没有配置文件 write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 -app = QtWidgets.QApplication(sys.argv) if not os.path.exists(get_home() + "/.config/uengine-runner/setting.json"): choosemsg = QtWidgets.QMessageBox() choosemsg.setText("""在使用本程序前,请选择安装Apk包的设置以便更好的运行,下列选项的详细介绍: @@ -1304,13 +1529,31 @@ if not os.path.exists(get_home() + "/.config/uengine-runner/setting.json"): choose = None choosemsg.addButton("不备份Apk包直接安装", QtWidgets.QMessageBox.ActionRole).clicked.connect(lambda: BackAPK(0)) choosemsg.addButton("备份Apk包然后在安装后自动拷贝原先目录", QtWidgets.QMessageBox.ActionRole).clicked.connect(lambda: BackAPK(1)) - #choose = easygui.indexbox(title="设置", choices=["不备份Apk包直接安装", "备份Apk包然后在安装后自动拷贝原先目录"]) choosemsg.exec_() if choose == None: QtWidgets.QMessageBox.information(None, "提示", "必须选择一个选项!否则无法进入程序!") sys.exit() write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({"SaveApk": int(choose)})) - +defultProgramList = { + "SaveApk": 1, + "AutoScreenConfig": False, + "ChooseProgramType": False, + "Theme": "" +} +try: + settingConf = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) + change = False + for i in defultProgramList.keys(): + if not i in settingConf: + change = True + settingConf[i] = defultProgramList[i] + if change: + write_txt(get_home() + "/.config/uengine-setting.json", json.dumps(settingConf)) +except: + traceback.print_exc() + app = QtWidgets.QApplication(sys.argv) + QtWidgets.QMessageBox.critical(None, "错误", f"无法读取配置,无法继续\n{traceback.format_exc()}") + sys.exit(1) ########################### # 设置变量 @@ -1367,15 +1610,17 @@ def showhelp(): BtnReadme = QtWidgets.QPushButton("使用说明") BtnLog = QtWidgets.QPushButton("更新内容") BtnZujian = QtWidgets.QPushButton("程序依赖的组件") - BtnGongxian = QtWidgets.QPushButton("有贡献的开发者") + BtnGongxian = QtWidgets.QPushButton("谢明列表") BtnAbout = QtWidgets.QPushButton("关于") + BtnDownN = QtWidgets.QPushButton("程序下载量") HelpStr = QtWidgets.QTextBrowser() - + BtnDownN.setEnabled("--彩蛋" in sys.argv) BtnReadme.clicked.connect(ChgTips) BtnLog.clicked.connect(ChgLog) BtnZujian.clicked.connect(ChgDep) BtnGongxian.clicked.connect(ChgCon) BtnAbout.clicked.connect(ChgAbout) + BtnDownN.clicked.connect(Egg) ChgTips() @@ -1383,8 +1628,9 @@ def showhelp(): helpLayout.addWidget(BtnLog, 1, 0, 1, 1) helpLayout.addWidget(BtnZujian, 2, 0, 1, 1) helpLayout.addWidget(BtnGongxian, 3, 0, 1, 1) - helpLayout.addWidget(BtnAbout, 4, 0, 1, 1) - helpLayout.addWidget(HelpStr, 0, 1, 6, 1) + helpLayout.addWidget(BtnAbout, 5, 0, 1, 1) + helpLayout.addWidget(BtnDownN, 4, 0, 1, 1) + helpLayout.addWidget(HelpStr, 0, 1, 7, 1) helpWidget.setLayout(helpLayout) helpWindow.setCentralWidget(helpWidget) @@ -1549,12 +1795,14 @@ uengineUbuntuInstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["M uengineDeleteUengineCheck = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][9]) uengineReinstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][10]) uengineUbuntuInstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][14]) +uengineWindowSizeSetting = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][16]) uengine.addAction(uengineAllowOrDisallowUpdateAndroidApp) uengine.addAction(uengineSetHttpProxy) uengine.addAction(uengineOpenDebBuilder) uengine.addAction(uengineKeyboardToMouse) uengine.addAction(uengineCheckCpu) uengine.addAction(uengineUbuntuInstall) +uengine.addAction(uengineWindowSizeSetting) uengineService = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Name"]) uengineInternet = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Name"]) uengineIcon = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Name"]) @@ -1563,7 +1811,6 @@ uengineData = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["M uengine.addAction(uengineDeleteUengineCheck) uengine.addAction(uengineReinstall) uengineRoot = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Name"]) -uengine.addAction(uengineUbuntuInstall) # 绑定信号 uengineAllowOrDisallowUpdateAndroidApp.triggered.connect(AllowOrDisallowUpdateAndroidApp) uengineSetHttpProxy.triggered.connect(SetHttpProxy) @@ -1573,6 +1820,7 @@ uengineCheckCpu.triggered.connect(UengineCheckCpu) uengineUbuntuInstall.triggered.connect(UengineUbuntuInstall) uengineDeleteUengineCheck.triggered.connect(DelUengineCheck) uengineReinstall.triggered.connect(ReinstallUengine) +uengineWindowSizeSetting.triggered.connect(UengineWindowSizeSetting.ShowWindow) uengineStart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][0]) uengineStop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][1]) @@ -1649,19 +1897,26 @@ helpUengineRunnerBugUpload = QtWidgets.QAction(langFile[lang]["Main"]["MainWindo helpShowHelp = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][4]) helpRunnerUpdate = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][3]) helpAbout = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][1]) +helpAboutQt = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][5]) help.addAction(helpOpenProgramUrl) help.addAction(helpUengineRunnerBugUpload) help.addAction(helpShowHelp) help.addAction(helpRunnerUpdate) help.addAction(helpAbout) +help.addAction(helpAboutQt) +hm1 = help.addMenu("更多生态适配应用") +hm1_1 = QtWidgets.QAction("运行 Windows 应用:Wine 运行器") +hm1.addAction(hm1_1) +hm1_1.triggered.connect(lambda: webbrowser.open_new_tab("https://gitee.com/gfdgd-xi/deep-wine-runner")) # 绑定信号 helpOpenProgramUrl.triggered.connect(OpenProgramURL) helpUengineRunnerBugUpload.triggered.connect(UengineRunnerBugUpload) helpShowHelp.triggered.connect(ShowHelp) helpRunnerUpdate.triggered.connect(UpdateWindow.ShowWindow) helpAbout.triggered.connect(showhelp) - +helpAboutQt.triggered.connect(lambda: QtWidgets.QMessageBox.aboutQt(widget)) # 设置窗口 +app.setStyle(QtWidgets.QStyleFactory.create(settingConf["Theme"])) widget.setLayout(widgetLayout) window.setCentralWidget(widget) window.setWindowTitle(title) diff --git a/new-deb-build/DEBIAN/control b/new-deb-build/DEBIAN/control index 285de07..1a257a4 100644 --- a/new-deb-build/DEBIAN/control +++ b/new-deb-build/DEBIAN/control @@ -1,18 +1,22 @@ Package: com.gitee.uengine.runner.spark Source: com.gitee.uengine.runner.spark Replaces: spark-uengine-runner, com.gitee.uengine.runner.spark.ubuntu -Version: 1.7.0 +Version: 1.8.0 Architecture: all Section: utils Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>, 柚子, 为什么您不喜欢熊出没和阿布呢, 星空露光, shenmo -Depends: python3, python3-tk, python3-pip, aapt, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell, python3-xlib, fonts-noto-cjk, python3-numpy, python3-matplotlib, wget, inotify-tools, aria2 +Depends: python3, python3-tk, python3-pip, aapt, python3-setuptools, deepin-terminal, curl, python3-pil, python3-requests, adb, fonts-noto-cjk, python3-numpy, python3-matplotlib, wget, inotify-tools, aria2, python3-pyqt5 Recommends: uengine, deepin-elf-verify (>= 0.0.16.7-1) Priority: optional Conflicts: spark-uengine-apk-builder, com.gitee.uengine.runner.spark.ubuntu Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner, https://www.gitlink.org.cn/gfdgd_xi/uengine-runner] -Description: UEngine 运行器,1.7.0 更新内容: - ※1、新增暗黑主题 - ※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题 - ※3、修复 UEngine 安装脚本在安装时不让用户选择,直接默认 N 无法安装的问题 - 4、新增设置 UEngine 代理的功能 - 5、将执行命令和打包器的返回输出从命令结束后显示输出内容改为实时显示内容 +Description: UEngine 运行器,1.8.0 更新内容: + ※1、程序界面大部分由 Tkinter 转 PyQt5 + ※2、添加了自动/手动配置 UEngine 窗口大小文件(自动需要在设置里手动开启,配置窗口的配置文件需要 Root) + ※3、增加了安装/卸载失败后的提示 + ※4、补回谢明名单 + ※5、支持免密安装/卸载 APK + 6、pip 更换华为源,提升下载速度 + 7、新增主题功能 + 8、支持在安装 APK 后手动指定分类(手动指定需要在设置里手动开启) + 开发/参与者:gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>, 柚子, 为什么您不喜欢熊出没和阿布呢, 星空露光, shenmo diff --git a/new-deb-build/DEBIAN/postinst b/new-deb-build/DEBIAN/postinst index 7ed57aa..07d5d7d 100755 --- a/new-deb-build/DEBIAN/postinst +++ b/new-deb-build/DEBIAN/postinst @@ -1,11 +1,9 @@ #!/bin/sh # 使用 pip 安装所需库 -python3 -m pip install --upgrade pip -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade ttkthemes -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade pyautogui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade keyboard -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade easygui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade ttkbootstrap -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade pip --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple +python3 -m pip install --upgrade ttkthemes --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple +python3 -m pip install --upgrade pyautogui --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple +python3 -m pip install --upgrade keyboard --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple # 建立软链接 ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner /usr/bin/uengine-runner ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder /usr/bin/uengine-apk-builder @@ -23,4 +21,4 @@ ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-laun # 因为 Ubuntu 的问题,省略 gtk-update-icon-cache /usr/share/icons/bloom > /dev/null | true # 向服务器返回安装数加1(不显示内容且忽略错误) -curl http://120.25.153.144/uengine-runner/Install.php?Version=1.7.0 -s > /dev/null | true \ No newline at end of file +curl http://120.25.153.144/uengine-runner/Install.php?Version=1.8.0 -s > /dev/null | true \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json index 1653bc7..b10077e 100644 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json @@ -136,7 +136,8 @@ "在 Ubuntu 上安装 UEngine", "启动/禁用UEngine安装的安卓程序程序更新(需要安装 adb 补丁)", "在 Ubuntu 上安装 UEngine", - "设置 UEngine 代理(需要安装 adb 补丁)" + "设置 UEngine 代理(需要安装 adb 补丁)", + "设置 UEngine 指定应用窗口大小" ] }, { @@ -146,7 +147,8 @@ "关于", "反馈程序问题和建议", "检查更新", - "更多帮助" + "更多帮助", + "关于 Qt" ] } ] @@ -304,7 +306,8 @@ "Install UEngine On Ubuntu", "Allow/Disallow UEngine To Install Or Update Other Android Program (Need Install Adb Patch)", "Install UEngine On Ubuntu", - "Set UEngine Http Proxy (Need Install Adb Patch)" + "Set UEngine Http Proxy (Need Install Adb Patch)", + "Set UEngine Some Android Windows Size" ] }, { @@ -314,7 +317,8 @@ "About This Program", "Upload Problem And Advice", "Update This Program", - "More Help" + "More Help", + "About Qt" ] } ] 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 c54a59a..9409c47 100644 --- 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 @@ -362,11 +362,10 @@ class UengineRunner: if __name__ == "__main__": print("本 API 不支持直接运行,请通过引入的方式使用此 API") - #adb = Adb("192.168.250.2:5555") - #print(adb.boolAndroidInstallOtherAppSetting()) + adb = Adb("192.168.250.2:5555") + print(adb.boolAndroidInstallOtherAppSetting()) - #quit() + quit() if not ROOT.GetRoot(): - pass - #print("请获取 ROOT 权限以便更好的使用该 API") \ No newline at end of file + print("请获取 ROOT 权限以便更好的使用该 API") \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/__init__.cpython-37.pyc b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/__init__.cpython-37.pyc index 69ef9b1..3adbef1 100644 Binary files a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/__init__.cpython-37.pyc and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/__init__.cpython-37.pyc differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/builer.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/builer.png deleted file mode 100644 index 407865f..0000000 Binary files a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/builer.png and /dev/null differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult.svg b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult.svg new file mode 100755 index 0000000..baaa994 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.png index c836b68..0b0f47a 100644 Binary files a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.png and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.png differ 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 f82eb45..52018b4 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 @@ -4,10 +4,10 @@ "https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner" ], - "Version": "1.7.0", + "Version": "1.8.0", "System": "Linux(deepin/UOS)", "Tips": [ - "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis", + "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis 或程序的更多帮助", "安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮", "卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。", "保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可", @@ -22,6 +22,16 @@ "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V1.8.0:", + "※1、程序界面大部分由 Tkinter 转 PyQt5", + "※2、添加了自动/手动配置 UEngine 窗口大小文件(自动需要在设置里手动开启,配置窗口的配置文件需要 Root)", + "※3、增加了安装/卸载失败后的提示", + "※4、补回谢明名单", + "※5、支持免密安装/卸载 APK", + "6、pip 更换华为源,提升下载速度", + "7、新增主题功能", + "8、支持在安装 APK 后手动指定分类(手动指定需要在设置里手动开启)", + "", "V1.7.0:", "※1、新增暗黑主题", "※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题", @@ -169,11 +179,22 @@ ], "Time": "2021年08月30日", "Contribute": [ - "gfdgd xi<3025613752@qq.com>", - "actionchen<917981399@qq.com>", - "柚子", - "为什么您不喜欢熊出没和阿布呢", - "星空露光", - "shenmo" + "感谢以下用户提供的问题、建议、图标、代码等,如果有遗漏,请及时与开发者联系添加,以及如果侵犯到您的合法权益,也及时与开发者联系:

", + "
", + "感谢 麻木法师(1312580754) 在星火应用商店QQ交流群展示的接口及其原理", + "感谢 actionchen(917981399@qq.com) 提供了新版页面布局(1.3.0 ~ 最新版本)以及布局代码(1.3.0 ~ 1.7.0)", + "感谢 柚子(https://gitee.com/Limexb) 提供了 UEngine 构建 Root 镜像脚本", + "感谢 星空露光(https://gitee.com/Cynorkyle) 制作了 UEngine 新版图标和安装应用时能选择应用分类的建议", + "感谢 shenmo(jifengshenmo@outlook.com) 反馈了许多程序的问题以及提供了 UEngine 在 Ubuntu 上的安装脚本", + "感谢 desert(https://gitee.com/desert741) 提供了给软件增加启动成功后自动调整分辨率的功能的建议", + "感谢 云思浮(https://gitee.com/foresee_io) 反馈的 1.3.0 依赖缺失问题", + "感谢 miaoys(https://bbs.deepin.org/user/271467)、zccrs(https://bbs.deepin.org/user/277780) 等用户反馈希望程序能和与系统 DTK 主题协调的建议", + "感谢 jiutian123(https://bbs.deepin.org/user/258825) 反馈的 1.5.2、1.5.3 存在问题", + "感谢 kero990(https://bbs.deepin.org/user/277932) 反馈的 README 表示不清的问题", + "感谢 wang(https://gitee.com/wang1279476881) 反馈的 1.6.0 左键打不开 “安装与卸载APK”和打包时 APK 版本号开头带 V 无法正常打包的问题", + "感谢 通天灵宝(https://bbs.deepin.org/user/137230)、wuhaiou123(https://bbs.chinauos.com/zh/user/309117) 反馈的 图标生成错误导致无法生成 .desktop 文件的问题", + "感谢 潜伏(https://bbs.chinauos.com/zh/user/303339) 反馈的右键支持安装/卸载的建议", + "感谢 z***g@gmx.de(https://bbs.chinauos.com/zh/user/312017) 反馈的 UEngine 更新后 uengine-launch.sh 的社区版检测问题", + "参考 忘记、过去(https://bbs.deepin.org/user/154730) 的帖子《如何更优雅地使用 pkexec》(https://bbs.deepin.org/post/202966)" ] } \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/menu.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/menu.png deleted file mode 100644 index 7142895..0000000 Binary files a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/menu.png and /dev/null differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/control b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/control new file mode 100644 index 0000000..1a257a4 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/control @@ -0,0 +1,22 @@ +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.0 +Architecture: all +Section: utils +Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>, 柚子, 为什么您不喜欢熊出没和阿布呢, 星空露光, shenmo +Depends: python3, python3-tk, python3-pip, aapt, python3-setuptools, deepin-terminal, curl, python3-pil, python3-requests, adb, fonts-noto-cjk, python3-numpy, python3-matplotlib, wget, inotify-tools, aria2, python3-pyqt5 +Recommends: uengine, deepin-elf-verify (>= 0.0.16.7-1) +Priority: optional +Conflicts: spark-uengine-apk-builder, com.gitee.uengine.runner.spark.ubuntu +Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner, https://www.gitlink.org.cn/gfdgd_xi/uengine-runner] +Description: UEngine 运行器,1.8.0 更新内容: + ※1、程序界面大部分由 Tkinter 转 PyQt5 + ※2、添加了自动/手动配置 UEngine 窗口大小文件(自动需要在设置里手动开启,配置窗口的配置文件需要 Root) + ※3、增加了安装/卸载失败后的提示 + ※4、补回谢明名单 + ※5、支持免密安装/卸载 APK + 6、pip 更换华为源,提升下载速度 + 7、新增主题功能 + 8、支持在安装 APK 后手动指定分类(手动指定需要在设置里手动开启) + 开发/参与者:gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>, 柚子, 为什么您不喜欢熊出没和阿布呢, 星空露光, shenmo diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/postinst b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/postinst new file mode 100755 index 0000000..07d5d7d --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/postinst @@ -0,0 +1,24 @@ +#!/bin/sh +# 使用 pip 安装所需库 +python3 -m pip install --upgrade pip --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple +python3 -m pip install --upgrade ttkthemes --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple +python3 -m pip install --upgrade pyautogui --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple +python3 -m pip install --upgrade keyboard --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple +# 建立软链接 +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner /usr/bin/uengine-runner +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder /usr/bin/uengine-apk-builder +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall /usr/bin/uengine-app-uninstall +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install /usr/bin/uengine-app-install +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean /usr/bin/uengine-clean +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about /usr/bin/uengine-runner-about +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard /usr/bin/uengine-keyboard +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb /usr/bin/uengine-useadb +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-launch.sh /usr/bin/uengine-runner-launch.sh +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug /usr/bin/uengine-runner-update-bug +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/root-uengine /usr/bin/uengine-root +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh /usr/bin/uengine-runner-applist-launch.sh +# 刷新图标缓存 +# 因为 Ubuntu 的问题,省略 +gtk-update-icon-cache /usr/share/icons/bloom > /dev/null | true +# 向服务器返回安装数加1(不显示内容且忽略错误) +curl http://120.25.153.144/uengine-runner/Install.php?Version=1.8.0 -s > /dev/null | true \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/postrm b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/postrm new file mode 100755 index 0000000..2104d5e --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/DEBIAN/postrm @@ -0,0 +1,19 @@ +#!/bin/sh +# 删除软链接 +rm -fv /usr/bin/uengine-runner +rm -fv /usr/bin/uengine-apk-builder +rm -fv /usr/bin/uengine-app-uninstall +rm -fv /usr/bin/uengine-app-install +rm -fv /usr/bin/uengine-clean +rm -fv /usr/bin/uengine-runner-about +rm -fv /usr/bin/uengine-keyboard +rm -fv /usr/bin/uengine-useadb +rm -fv /usr/bin/uengine-runner-launch.sh +rm -fv /usr/bin/uengine-runner-update-bug +rm -fv /usr/bin/uengine-root +rm -frv /opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__ +rm -frv /opt/apps/com.gitee.uengine.runner.spark/files/__pycache__ +rm -fv /usr/bin/uengine-runner-applist-launch.sh +# 刷新图标缓存 +# 因为 Ubuntu 的问题,省略 +gtk-update-icon-cache /usr/share/icons/bloom > /dev/null | true \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidProgramList.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidProgramList.desktop new file mode 100644 index 0000000..9a06a55 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidProgramList.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Categories=System; +Comment=UEngine 程序菜单 +Encoding=UTF-8 +Exec=/usr/bin/uengine-runner-applist-launch.sh +Icon=/opt/apps/com.gitee.uengine.runner.spark/files/menu.svg +MimeType= +Name=UEngine App List +Name[zh]=UEngine 程序菜单 +StartupWMClass=UEngine 程序菜单 +Terminal=false +Type=Application diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-apk-build.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-apk-build.desktop new file mode 100755 index 0000000..f26a89f --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-apk-build.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Categories=System; +Terminal=false +Exec=/usr/bin/uengine-apk-builder %F +Icon=/opt/apps/com.gitee.uengine.runner.spark/files/builer.svg +Name=Build Apk To Deb(UEngine Runner) +Comment=Build Apk To Deb(UEngine Runner) +Comment[zh]=打包 deb(UEngine 运行器) +Name[zh]=打包 deb(UEngine 运行器) +StartupNotify=true +Hidden=false +NoDisplay=true +MimeType=application/vnd.android.package-archive \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-install.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-install.desktop new file mode 100644 index 0000000..9d21f37 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-install.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Categories=System; +Terminal=false +Exec=/usr/bin/uengine-runner -i %F +Icon=/opt/apps/com.gitee.uengine.runner.spark/files/runner.svg +Name=Install Or Uninstall APK(uengine runner) +Comment=Install Or Uninstall APK(UEngine runner) +Comment[zh]=安装/卸载 APK(UEngine 运行器) +Name[zh]=安装/卸载 APK(UEngine 运行器) +StartupNotify=true +Hidden=false +NoDisplay=true +MimeType=application/vnd.android.package-archive \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-apk-builder.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-apk-builder.desktop new file mode 100755 index 0000000..6cb0b0c --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-apk-builder.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Categories=System; +Terminal=false +Exec=/usr/bin/uengine-apk-builder %F +Icon=/opt/apps/com.gitee.uengine.runner.spark/files/builer.svg +Name=uengine Apk Builder +Comment=UEngine Apk Builder +Comment[zh]=UEngine 应用打包器 +Name[zh]=UEngine 应用打包器 +StartupNotify=true \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-runner.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-runner.desktop new file mode 100755 index 0000000..c60a7df --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-runner.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Categories=System; +Terminal=false +Exec=/usr/bin/uengine-runner +Icon=/opt/apps/com.gitee.uengine.runner.spark/files/runner.svg +Name=uengine Runner +Comment=UEngine Runner +Comment[zh]=UEngine 运行器 +Name[zh]=UEngine 运行器 +StartupNotify=true +MimeType= \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-1.png new file mode 100644 index 0000000..c01a6e1 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-2.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-2.png new file mode 100644 index 0000000..61bd1e4 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-2.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-3.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-3.png new file mode 100644 index 0000000..a13db97 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-3.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-4.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-4.png new file mode 100644 index 0000000..548e6d9 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-4.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-5.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-5.png new file mode 100644 index 0000000..83b8f5e Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-1-5.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-2-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-2-1.png new file mode 100644 index 0000000..1d89dae Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-2-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-2-2.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-2-2.png new file mode 100644 index 0000000..a0ada6c Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-2-2.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-3-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-3-1.png new file mode 100644 index 0000000..46cbca5 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-3-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-4-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-4-1.png new file mode 100644 index 0000000..de1edca Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-4-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-5-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-5-1.png new file mode 100644 index 0000000..14097ab Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-5-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-5-2.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-5-2.png new file mode 100644 index 0000000..caa608c Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-5-2.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-1.png new file mode 100644 index 0000000..52c8b2d Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-2.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-2.png new file mode 100644 index 0000000..de2c729 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-2.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-3.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-3.png new file mode 100644 index 0000000..547a785 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-6-3.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-7-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-7-1.png new file mode 100644 index 0000000..62b95f7 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-7-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-8-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-8-1.png new file mode 100644 index 0000000..eee89ae Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-8-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-1.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-1.png new file mode 100644 index 0000000..8d74781 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-1.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-2.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-2.png new file mode 100644 index 0000000..c3e6e97 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-2.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-3.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-3.png new file mode 100644 index 0000000..94fac14 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-3.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-4.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-4.png new file mode 100644 index 0000000..f889fcf Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-4.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-5.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-5.png new file mode 100644 index 0000000..cdaebb1 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-5.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-6.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-6.png new file mode 100644 index 0000000..ed4ffe3 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-6.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-7.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-7.png new file mode 100644 index 0000000..19b17ba Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/1-9-7.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/index.html b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/index.html new file mode 100644 index 0000000..347a45b --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/index.html @@ -0,0 +1,165 @@ + + + + +index + +

UEngine 运行器帮助

+
+

帮助简述

+

安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮
卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。
保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可
重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可
注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了
打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)
提示:
※1、近期升级的 UEngine 安装时会自动把要安装的 apk 删除,如果这个 apk 文件非常重要请拷贝一个备份版并安装这个备份版
2、需要你有使用 root 权限的能力;
3、需要安装 UEngine 才能使用;
4、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;
5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)

+
+
+

详细帮助

+

如何安装自己的 Apk

+

请保证您已经把要安装的Apk下载到电脑本地并保证Apk完整且有权限

+

方法一

+
    +
  1. 打开 UEngine 运行器
  2. +
  3. 点击浏览按钮,找到想要安装的Apk
  4. +
  5. 点击安装按钮,输入密码 +
  6. +
  7. 提示“操作完成”,在启动器找到新安装的图标启动即可

  8. + +
+

方法二

+
    +
  1. 打开要安装的Apk所在目录,右击=>打开方式=>安装或卸载 APK(UEngine 运行器)
  2. +
  3. 点击安装按钮,输入密码
  4. +
  5. 提示“操作完成”,在启动器找到新安装的图标启动即可

  6. + +
+

卸载Apk

+

方法一

+
    +
  1. 打开 UEngine 运行器
  2. +
  3. 点击浏览按钮,找到想要卸载的Apk
  4. +
  5. 点击卸载按钮,输入密码
  6. +
  7. 提示“操作完成”,卸载完成
  8. + +
+

方法二

+
    +
  1. 打开要安装的Apk所在目录,右击=>打开方式=>安装或卸载 APK(UEngine 运行器)
  2. +
  3. 点击卸载按钮,输入密码
  4. +
  5. 提示“操作完成”,卸载完成
  6. + +
+

查询Apk信息

+
    +
  1. 打开 UEngine 运行器
  2. +
  3. 点击“Apk 信息” 按钮即可查询Apk信息
  4. + +
+

+

查看程序评分

+
    +
  1. 打开 UEngine 运行器
  2. +
  3. 点击“Apk 信息” 按钮即可查询Apk信息 +
  4. +
  5. 点击“查看程序评分情况”即可查看其他用户对程序的评分
  6. + +
+

+

上传用户评分

+
    +
  1. 打开 UEngine 运行器
  2. + +
+

+
    +
  1. 点击“Apk 信息” 按钮即可查询Apk信息
  2. + +
+

+
    +
  1. 点击“上传程序评分情况”,按照要求进行评分
  2. + +
+

+
    +
  1. 如果提示“提交成功!感谢您的提交”就代表评分成功
  2. + +
+

+

更新程序

+
    +
  1. 打开 UEngine 运行器
  2. + +
+

+
    +
  1. 点击“关于”=>“检查更新”,打开更新窗口
  2. + +
+

+
    +
  1. 保证您的电脑没有运行其它Python应用以及本程序所有工作都已经完成,再点击“更新(更新过程中会关闭所有Python应用,包括这个应用)”,输入密码以进行更新
  2. + +
+

+
    +
  1. 提示“更新完毕!”后重新启动 UEngine 运行器就更新完毕了
  2. + +
+

+

保存图标

+
    +
  1. 打开 UEngine 运行器
  2. + +
+

+
    +
  1. 选择要保存图标的Apk,点击“保存图标”按钮,选择要保存的位置即可
  2. + +
+

+

打开已安装的程序列表

+

方法一

+

打开启动器=>UEngine 程序菜单 即可

+

方法二

+
    +
  1. 打开 UEngine 运行器
  2. +
  3. 点击“打开 UEngine 应用列表”即可
  4. + +
+

+

将 Apk 打包成可以无需本应用即可安装的 deb 包

+

打开 UEngine 打包器的三种方法

+
方法一
+

启动器=>UEngine 应用打包器

+
方法二
+

打开要打包的 Apk 所在目录,右击=>“打开方式”=>“打包 deb(UEngine 运行器)”(接下来可以略过步骤一)

+

+
方式三
+

打开 UEngine 运行器,点击菜单栏的“UEngine”=>“UEngine 应用打包”

+

+

打包 deb

+
    +
  1. 打开“UEngine Apk 应用打包器”,点击“浏览按钮”选择apk
  2. + +
+

+
    +
  1. 根据实际情况勾选选项,然后点击“打包”进行打包
  2. + +
+

+
    +
  1. 当提示“打包完成”时,打包完成,可以在桌面(一般是/home/XXX/Desktop)找到您打包的 deb 包,可以双击安装
  2. + +
+

+

+

+

+

+

+

+

+

+

+

+

©2021-2022

+ + \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/index.md b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/index.md new file mode 100644 index 0000000..bb2bc1e --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Help/index.md @@ -0,0 +1,193 @@ +# UEngine 运行器帮助 +--- +## 帮助简述 +> 安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮 +> 卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。 +> 保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可 +> 重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可 +> 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了 +> 打开UEngine应用列表:打开系统已安装的应用列表(安卓界面) +> **提示:** +> **※1、近期升级的 UEngine 安装时会自动把要安装的 apk 删除,如果这个 apk 文件非常重要请拷贝一个备份版并安装这个备份版** +> **2、需要你有使用 root 权限的能力;** +> **3、需要安装 UEngine 才能使用;** +> **4、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;** +> **5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)** + +--- +## 详细帮助 +### 如何安装自己的 Apk +*请保证您已经把要安装的Apk下载到电脑本地并保证Apk完整且有权限* +#### 方法一 +1. 打开 UEngine 运行器 +![](1-1-1.png) +2. 点击浏览按钮,找到想要安装的Apk +![](1-1-2.png) +3. 点击安装按钮,输入密码 +![](1-1-3.png) +4. 提示“操作完成”,在启动器找到新安装的图标启动即可 +![](1-1-4.png) +![](1-1-5.png) +#### 方法二 +1. 打开要安装的Apk所在目录,右击=>打开方式=>安装或卸载 APK(UEngine 运行器) +![](1-2-1.png) +2. 点击安装按钮,输入密码 +![](1-1-3.png) +3. 提示“操作完成”,在启动器找到新安装的图标启动即可 +![](1-1-4.png) +![](1-2-2.png) + +### 卸载Apk +#### 方法一 +1. 打开 UEngine 运行器 +![](1-1-1.png) +2. 点击浏览按钮,找到想要卸载的Apk +![](1-1-2.png) +3. 点击卸载按钮,输入密码 +![](1-1-3.png) +4. 提示“操作完成”,卸载完成 +![](1-1-4.png) +#### 方法二 +1. 打开要安装的Apk所在目录,右击=>打开方式=>安装或卸载 APK(UEngine 运行器) +![](1-2-1.png) +2. 点击卸载按钮,输入密码 +![](1-1-3.png) +3. 提示“操作完成”,卸载完成 +![](1-1-4.png) + +### 查询Apk信息 +1. 打开 UEngine 运行器 + ![](1-1-1.png) + +2. 点击“Apk 信息” 按钮即可查询Apk信息 + + ![](1-3-1.png) + +### 查看程序评分 +1. 打开 UEngine 运行器 + ![](1-1-1.png) + +2. 点击“Apk 信息” 按钮即可查询Apk信息 + ![](1-3-1.png) + +3. 点击“查看程序评分情况”即可查看其他用户对程序的评分 + + ![](1-4-1.png) + +### 上传用户评分 + +1. 打开 UEngine 运行器 + + ![](1-1-1.png) + +2. 点击“Apk 信息” 按钮即可查询Apk信息 + + ![](1-3-1.png) + +3. 点击“上传程序评分情况”,按照要求进行评分 + + ![](1-5-1.png) + +4. 如果提示“提交成功!感谢您的提交”就代表评分成功 + + ![](1-5-2.png) + +### 更新程序 + +1. 打开 UEngine 运行器 + + ![](1-1-1.png) + +2. 点击“关于”=>“检查更新”,打开更新窗口 + + ![](1-6-1.png) + +3. **保证您的电脑没有运行其它Python应用以及本程序所有工作都已经完成**,再点击“更新(更新过程中会关闭所有Python应用,包括这个应用)”,输入密码以进行更新 + + ![](1-6-2.png) + +4. 提示“更新完毕!”后重新启动 UEngine 运行器就更新完毕了 + + ![](1-6-3.png) + +### 保存图标 + +1. 打开 UEngine 运行器 + + ![](1-1-1.png) + +2. 选择要保存图标的Apk,点击“保存图标”按钮,选择要保存的位置即可 + + ![](1-7-1.png) + +### 打开已安装的程序列表 + +#### 方法一 + +打开启动器=>UEngine 程序菜单 即可 + +#### 方法二 + +1. 打开 UEngine 运行器 + ![](1-1-1.png) + +2. 点击“打开 UEngine 应用列表”即可 + + ![](1-8-1.png) + +### 将 Apk 打包成可以无需本应用即可安装的 deb 包 + +#### 打开 UEngine 打包器的三种方法 + +##### 方法一 + +启动器=>UEngine 应用打包器 + +##### 方法二 + +打开要打包的 Apk 所在目录,右击=>“打开方式”=>“打包 deb(UEngine 运行器)”(接下来可以略过步骤一) + +![](1-9-1.png) + +##### 方式三 + +打开 UEngine 运行器,点击菜单栏的“UEngine”=>“UEngine 应用打包” + +![](1-9-2.png) + +#### 打包 deb + +1. 打开“UEngine Apk 应用打包器”,点击“浏览按钮”选择apk + + ![](1-9-3.png) + +2. 根据实际情况勾选选项,然后点击“打包”进行打包 + + ![](1-9-4.png) + +3. 当提示“打包完成”时,打包完成,可以在桌面(一般是`/home/XXX/Desktop`)找到您打包的 deb 包,可以双击安装 + + ![](1-9-5.png) + + ![](1-9-6.png) + + ![](1-9-7.png) + + + + + + + + + + + + + + + + + + + ©2021-2022 \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/LICENSE b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/LICENSE new file mode 100755 index 0000000..818433e --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program 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. + + This program 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 this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json new file mode 100644 index 0000000..b10077e --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json @@ -0,0 +1,344 @@ +{ + "zh_CN.UTF-8": { + "Main": { + "MainWindow": { + "Title": "UEngine 运行器", + "LabApkPath": "安装/卸载 APK:", + "LabUninstallPath": "卸载 Apk:", + "BtnFindApk": "浏览", + "BtnInstall": "安装", + "BtnShowUengineApp": "打开 UEngine 应用列表", + "BtnUninstallApkBrowser": "浏览", + "BtnUninstall": "卸载", + "Btngeticon": "保存图标", + "BtnSaveApk": "保存Apk", + "BtnApkInformation": "Apk 信息", + "Error": { + "InstallError": "信息没有填写完整,无法继续安装 APK", + "UninstallError": "信息没有填写完整,无法继续卸载 APK", + "BackApkError": "无法还原安装包\n提示:新版UEngine安装后会自动删除安装包,备份的Apk在/tmp/uengine-runner/bak.apk,电脑重启后就会丢失!", + "ChooseApkError": "你没有选择 apk 文件", + "SaveApkIconError": "本程序不支持保存该 apk 的图标", + "PathError": "路径不存在,请重试!", + "SettingReadError": "读取设置错误!无法打开设置窗口!", + "SettingSaveError": "保存设置错误!", + "ConnectServerError": "无法连接服务器!", + "ConnectServerStarError": "无法连接服务器!无法进行评分!", + "ApkFileError": "该应用安装包异常,无法查询相关数据!", + "InputDataError": "你输入的数值不正确!" + }, + "Information": { + "Title": "提示", + "CompleteInformation": "完成" + }, + "Answer": { + "Title": "提示", + "AllowOrDisallowUpdateAndroidAppAnswer": [ + "你确定要启用 UEngine 可以安装以及使用默认的更新程序升级应用?(即允许未知来源)", + "你确定要禁用 UEngine 可以安装以及使用默认的更新程序升级应用?(即禁止未知来源)" + ], + "UseAdbPackageAnswer": "你没有安装 adb 补丁,必须安装才能继续。是否安装?", + "CompleteInformation": "设置完毕" + }, + "Menu": [ + { + "Name": "程序", + "Menu": [ + "清空软件历史记录", + "退出程序", + "程序设置" + ] + }, + { + "Name": "adb", + "Menu": [ + "Adb 连接 UEngine", + { + "Name": "Adb 服务", + "Menu": [ + "打开 Adb 服务", + "停止 Adb 服务", + "杀死 Adb 进程" + ] + }, + "显示 Adb 连接的设备", + "Adb 修改 UEngine 分辨率", + "Adb 查看 UEngine 应用列表", + "Adb 查看 UEngine 资源使用情况", + "打开 Adb 连接 UEngine 的终端", + "使用 Scrcpy 连接 UEngine(只支持使用 Snap 安装的 Scrcpy)", + { + "Name": "UEngine 使用 Adb", + "Menu": [ + "Adb 连接 Connect UEngine", + "允许此设备使用 Adb 连接本 UEngine(需要 Root)", + "禁止任何设备使用 Adb 连接本 UEngine(需要 Root)" + ] + } + ] + }, + { + "Name": "UEngine", + "Menu": [ + "UEngine 系统设置", + "UEngine 应用打包", + { + "Name": "UEngine 服务", + "Menu": [ + "启动 UEngine 服务(需要 Root)", + "关闭 UEngine 服务(需要 Root)", + "重启 UEngine 服务(需要 Root)" + ] + }, + { + "Name": "UEngine 网络桥接", + "Menu": [ + "启动 UEngine 网络桥接(需要 Root)", + "关闭 UEngine 网络桥接(需要 Root)", + "重启 UEngine 网络桥接(需要 Root)", + "加载 UEngine 网络桥接(需要 Root)", + "强制加载 UEngine 网络桥接(需要 Root)" + ] + }, + { + "Name": "UEngine 快捷方式", + "Menu": [ + "发送 UEngine 应用列表到桌面", + "发送 UEngine 应用列表到启动器", + "添加/删除指定的 UEngine 快捷方式", + "清空所有 UEngine 快捷方式" + ] + }, + { + "Name": "UEngine 使用 Adb", + "Menu": null + }, + { + "Name": "UEngine 数据", + "Menu": [ + "打开 UEngine 根目录", + "打开 UEngine 用户数据目录", + "清空 UEngine 数据(需要 Root)" + ] + }, + "UEngine 键盘映射", + "UEngine 检测 CPU 是否支持运行", + "删除 UEngine 运行检查", + "重新安装 UEngine", + { + "Name": "获取 UEngine 最高权限", + "Menu": [ + "安装已经制作好的 UEngine 带最高权限的镜像", + "构建 UEngine 带最高权限的镜像到用户主目录", + "安装默认的 UEngine 镜像" + ] + }, + "在 Ubuntu 上安装 UEngine", + "启动/禁用UEngine安装的安卓程序程序更新(需要安装 adb 补丁)", + "在 Ubuntu 上安装 UEngine", + "设置 UEngine 代理(需要安装 adb 补丁)", + "设置 UEngine 指定应用窗口大小" + ] + }, + { + "Name": "关于", + "Menu": [ + "程序官网", + "关于", + "反馈程序问题和建议", + "检查更新", + "更多帮助", + "关于 Qt" + ] + } + ] + } + }, + "Uengine Apk Builder": { + "Title": "UEngine APK 应用打包器", + "label1": "要打包的 apk 路径:", + "button2": "浏览", + "button3": " 打包", + "check": "使用前缀“uengine-dc”", + "Menu": [ + { + "Name": "程序", + "Menu": [ + "退出程序" + ] + } + ] + } + }, + "en_US.UTF-8": { + "Main": { + "MainWindow": { + "Title": "UEngine Runner", + "LabApkPath": "Install Or Uninstall Apk:", + "BtnFindApk": "Find", + "BtnInstall": "Install", + "BtnShowUengineApp": "Open UEngine App List", + "BtnUninstallApkBrowser": "Find", + "BtnUninstall": "Uninstall", + "Btngeticon": "Save Apk Icon", + "BtnSaveApk": "Saving Installed App Apk", + "BtnApkInformation": "Apk Information", + "Error": { + "InstallError": "You don't input the APK file path, Can't install Android program by now.", + "UninstallError": "You don't input the APK file path or android program package name, Can't uninstall Android program by now.", + "BackApkError": "Can't recover the apk\nTips: Newer UEngine will delete the APK installing file when finish install, recover apk is in \"tmp/uengine-runner/bak.apk\", but it will be lose when you restart your computer.", + "ChooseApkError": "You don't choose any APK file.", + "SaveApkIconError": "This APK file isn't allow to save the icon file.", + "PathError": "Path not found, please try again", + "SettingReadError": "Read user setting error! Can't to continue to set!", + "SettingSaveError": "Setting can't save", + "ConnectServerError": "Can't connect the cloud server!", + "ConnectServerStarError": "Can't connect the cloud server! So can't give star for the app!", + "ApkFileError": "This apk file is error and can't find any data about the apk file!", + "InputDataError": "Your input error data!" + }, + "Information": { + "Title": "Tips", + "CompleteInformation": "Complete!" + }, + "Answer": { + "Title": "Tips", + "AllowOrDisallowUpdateAndroidAppAnswer": [ + "Are you sure to allow UEngine to install or update other android program? (Allow )(即允许未知来源)", + "Are you sure to disallow UEngine to install or update other android program? (Allow )(即允许未知来源)" + ], + "UseAdbPackageAnswer": "You don't install adb package with UEngine, you must install, and after install you can connect to set.\nDo you want to install?", + "CompleteInformation": "Set Completed" + }, + "Menu": [ + { + "Name": "Program", + "Menu": [ + "Clean Program History", + "Exit The Program", + "Program Setting" + ] + }, + { + "Name": "adb", + "Menu": [ + "Use Adb To Connect UEngine", + { + "Name": "Adb Services", + "Menu": [ + "Open Adb Service", + "Close Adb Service", + "Kill Adb Program" + ] + }, + "Show Adb To Connect Devices", + "Use Adb To Change UEngine Display Size", + "Use Adb To Show UEngine Installing Program List", + "Use Adb To Show UEngine Using System Resources", + "Open Adb Console With UEngine", + "Use Scrcpy Connect UEngine (Only Support Using Scrcpy With Installing the Scrcpy)", + { + "Name": "UEngine Use Adb", + "Menu": [ + "Use Adb To Connect UEngine", + "Allow This Devices Using Adb To Connect The UEngine (Allow Need Using For Root)", + "Unallow Any Devices Using Adb To Connect The UEngine (Unallow Need Using For Root)" + ] + } + ] + }, + { + "Name": "UEngine", + "Menu": [ + "UEngine System Control Panel", + "UEngine Android App Builder", + { + "Name": "UEngine Service", + "Menu": [ + "Open UEngine Service (It Need Run With Root)", + "Close UEngine Service (It Need Run With Root)", + "Restart UEngine Service (It Need Run With Root)" + ] + }, + { + "Name": "UEngine Internet Connecting", + "Menu": [ + "Open UEngine Internet Bridge (It Need Run With Root)", + "Close UEngine Internet Bridge (It Need Run With Root)", + "Restart UEngine Internet Bridge (It Need Run With Root)", + "Load UEngine Internet Bridge (It Need Run With Root)", + "Force Loading UEngine Internet Bridge (It Need Run With Root)" + ] + }, + { + "Name": "UEngine App Link", + "Menu": [ + "Send UEngine Program List To Desktop", + "Send UEngine Program List To Launcher", + "Add Or Delete UEngine App Link", + "Delete All UEngine App Link" + ] + }, + { + "Name": "UEngine Use Adb", + "Menu": null + }, + { + "Name": "UEngine Data", + "Menu": [ + "Open UEngine Root Folder", + "Open UEngine User Folder", + "Delete All UEngine Data (It Need Run With Root)" + ] + }, + "UEngine Keyboard", + "UEngine Check CPU Can Or Can't Run", + "Delete UEngine Runing Checking", + "Reinstall UEngine", + { + "Name": "Get UEngine Root User", + "Menu": [ + "Install UEngine Image With Root User", + "Build An UEngine Image With Root User In Your Home Path", + "Install Defult UEngine Image" + ] + }, + "Install UEngine On Ubuntu", + "Allow/Disallow UEngine To Install Or Update Other Android Program (Need Install Adb Patch)", + "Install UEngine On Ubuntu", + "Set UEngine Http Proxy (Need Install Adb Patch)", + "Set UEngine Some Android Windows Size" + ] + }, + { + "Name": "About", + "Menu": [ + "Program WebSize", + "About This Program", + "Upload Problem And Advice", + "Update This Program", + "More Help", + "About Qt" + ] + } + ] + } + }, + "Uengine Apk Builder": { + "Title": "UEngine APK Builder", + "label1": "Will Build APK Path", + "button2": "Find", + "button3": " Build", + "check": "Use Prefix With \"uengine-dc\"", + "Menu": [ + { + "Name": "Program", + "Menu": [ + "Exit The Program" + ] + } + ] + } + } + +} \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/README.md b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/README.md new file mode 100755 index 0000000..be2cf48 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/README.md @@ -0,0 +1,273 @@ +# uengine 运行器 1.5.3 + +### 介绍 +        新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。 +![1.5.3](https://storage.deepin.org/thread/202112121231595786_截图_选择区域_20211212123106.png) +(测试平台:UOS 家庭版 21.1,deepin 20.3,UOS 专业版 1040) +(自己美术功底太差,图标直接用 anbox 的了) + +## 安装前必读 ++ releases 里有两个 deb 包,**是一样的除了包名和打包标准不同**,**只能选择其中一个安装**,**两个都安装会产生冲突**,两个deb包的作用如下: + - 包名为`spark-uengine-runner`的,是旧包,按照**正常标准打包**,适用于从**星火应用商店安装**以及**从低版本(即1.3.2即以下版本升级上来的用户)升级**或者**之前就安装该版本的用户**甚至**想跨平台的用户**等等 + - 包名为`com.gitee.uengine.runner.spark`的,是按照**deepin/UOS的标准打包的**,适用于**之前就安装该版本并升级上来的用户**以及**希望按照该方法打包的用户**等等 ++ **近期升级的 UEngine 安装时会自动把要安装的 apk 删除**,如果这个 apk 文件非常重要请**拷贝一个备份版并安装这个备份版** + +### 更新内容 +#### V1.6.0(开学版,即将完成!!!) +##### 目前更新内容 +**※1、更换了新的图标(暂未全部更新完成!)** +**※2、支持程序的评分和查看分数详情的功能(如果炸了我的服务器,这个就作废了)** +**※3、修复了在安装奇奇怪怪的安装包(如格式、标识不正确的)时的快捷方式图标为空以及快捷方式文本的变化** +**※4、添加更新功能,可以自行升级到最新版本(如果炸了我的服务器,这个就作废了)** +**※5、新增程序帮助** +6、新填彩蛋(在“关于”=>“关于”显示的窗口双击“关于”开启)(如果炸了我的服务器,这个就作废了) + +#### V1.5.3(2021-12-12,DDUC11版): +##### 更新内容 +**※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题** +**※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录**`~/.local/share/icons/hicolor/256x256/apps`**不存在时点击无反应,参考报错1.5.3-1** +**※3、修复了“UEngine APK 应用打包器”打包的deb包的.desktop文件的**`Icon`**和**`Exec`**字段有误的问题以及使用“使用前缀‘uengine-dc’”前缀的问题** +4、“UEngine APK 应用打包器”支持打包完后自动删除临时目录 +5、“UEngine APK 应用打包器”以及“添加/删除 UEngine 图标”支持在运行出现错误时显示报错 +##### 报错: +*1.5.3-1* +```bash +Exception in Tkinter callback +Traceback (most recent call last): + File "/usr/lib/python3.7/tkinter/__init__.py", line 1705, in __call__ + return self.func(*args) + File "/home/gfdgd_xi/Desktop/uengine-runner/main.py", line 865, in SaveDesktopLink + shutil.copy(programPath + "/defult.png", iconSavePath) + File "/usr/lib/python3.7/shutil.py", line 245, in copy + copyfile(src, dst, follow_symlinks=follow_symlinks) + File "/usr/lib/python3.7/shutil.py", line 121, in copyfile + with open(dst, 'wb') as fdst: +FileNotFoundError: [Errno 2] No such file or directory: '/home/gfdgd_xi/.local/share/icons/hicolor/256x256/apps/com.miHoYo.cloudgames.ys.png' +``` +##### 截图 +![1.5.3](https://storage.deepin.org/thread/202112121231595786_截图_选择区域_20211212123106.png) + +#### V1.5.2(2021-11-28): +**※1、支持安装和构建带 Root 的 UEngine 的镜像** +2、更新了反馈链接 +![](https://storage.deepin.org/thread/202111281607295590_截图_选择区域_20211128160706.png) + +#### V1.5.1(2021-10-05,国庆节版): +**※1、精简用户界面,合并安装和卸载输入框和浏览按钮等** +**※2、修复安装以其的程序图标无法点击进入的问题(deepin 社区版不存在此问题)** +**※3、支持在程序本体反馈问题** +4、修复了菜单栏的部分显示问题 +5、支持显示 apk 的部分信息 +6、支持删除 UEngine 程序运行检查以及重新安装 UEngine 的功能 +7、自带有跳过家庭版必须有指定包名才能运行程序限制的脚本 +8、补回依赖包“adb” +![1.5.1](https://storage.deepin.org/thread/202110051821076836_截图_dde-desktop_20211005182021.png) + +#### V1.5.0(2021-09-21,中秋节版): +**没有什么实质性的功能,只是开始有多语言支持** +**※1、部分窗口支持英语** +2、修复在英语状态下启动器图标名称异常的问题 +![1.5.0](https://storage.deepin.org/thread/202109202157289430_截图_选择区域_20210920215550.png) + +#### V1.4.3(2021-09-11,开学第一版): +**※1、支持打包器打包的包名带前缀“uengine-dc”** +**※2、修复了两种情况可能导致程序卡住/出错无法继续运行的情况(配置文件夹不齐全和获取版本信息卡住两种情况)** +**※3、修改了 UEngine 打包器打包的应用包名可能有大写的情况** +4、支持一键使用 Scrcpy 连接 UEngine(①先安装 adb 破解补丁;②请确保是使用snap安装的 Scrcpy【目前只支持 snap 安装的 Scrcpy 进行连接】) +5、支持右键打包 apk +![1.4.3](https://storage.deepin.org/thread/202109111635389828_截图_选择区域_20210911163449.png) + +#### V1.4.2(2021-08-30,快开学了): +**※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;** +2、菜单栏的项目添加以及外观优化; +3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式; +4、把 uengine 改为 UEngine; +5、修改 pkexec 获取密码时显示的图标和文本; +6、添加了 UEngine 系统设置的快捷方式; +![1.4.2](https://storage.deepin.org/thread/202108301750554993_截图_选择区域_20210830134502.png) + +#### V1.4.1(2021-08-26): +**※1、初步支持键盘映射** +2、修复新版包在发送uengine列表快捷方式时会提示找不到文件 +![1.4.1](https://storage.deepin.org/thread/20210826151947783_截图_选择区域_20210826151312.png) + +#### V1.4.0(2021-08-19): +**※1、添加新版打包方式(deepin打包方式);** +**※2、支持测试运行/创建/删除uengine图标;** +**※3、支持提取安装的apk;** +**※4、支持打包deb包;** +5、修改菜单栏布局; +6、支持打开uengine数据目录和用户数据目录; +7、程序信息保存到json,非直接写入程序本体; +8、更多命令操作; +![1.4.0](https://storage.deepin.org/thread/202108191410327464_截图_选择区域_20210819140938.png) + +#### V1.3.2(2021-08-16): +**※1、支持uengine数据重置;** +**※2、支持修改uengine网络桥接的启动状态;** +**※3、支持右键安装/卸载;** +**※4、支持启用或禁用uengine;** +**※5、修复打包问题,不会出现“dpkg:警告:卸载spark-uengine-runner时,目录/opt/apps/uengine-runner非空,因而不会删除该目录”的错误;** +![1.3.2](https://storage.deepin.org/thread/202108152141139401_截图_选择区域_20210815213948.png) + +#### V1.3.1(2021-08-12): +**※1、修复打包问题,防止部分用户安装出错的问题;** +**※2、修复了程序无法提取图标时可以提取默认图标使用;** +![1.3.1](https://storage.deepin.org/thread/202108121509217807_截图_选择区域_20210812150849.png) + +#### V1.3.0(2021-08-08): +**※1、修改了界面布局;** +**※2、修复大多数新安装普通用户的路图标及启动菜单文件路径不存在导致安装APK报错的bugs;** +3、删除少量冗余代码,调整代码顺序; +4、支持提取 apk 图标。 +![1.3.0](https://storage.deepin.org/thread/202108082100582804_截图_tk_20210808210047.png) + +#### V1.2.3(2021-08-02): +1、调整部分控件名称; +2、调整界面布局及界面风格; +![1.2.3](https://images.gitee.com/uploads/images/2021/0802/080620_1dd289ca_7896131.png) + +#### V1.2.2(2021-07-11): +1、对程序错误的显示更加人性化; +2、对 icon 的获取方式进行了升级; +3、增加了注释、删除部分冗余代码。 +![1.2.2](https://images.gitee.com/uploads/images/2021/0711/145140_b04e51b7_7896131.png) + +#### V1.2.1(2021-07-02): +**※1、进行了安装方式的修改(不使用 adb),修复原无法安装和卸载的问题;** +2、进行了部分优化; +3、进行了功能缩水; +4、修复 deb 打包错误。 +![1.2.1](https://images.gitee.com/uploads/images/2021/0702/204040_6abb6f3f_7896131.png) + +#### V1.2.0(2021-06-06): +1、支持安装自动添加快捷方式、卸载删除快捷方式; +2、支持使用包名或 APK 文件卸载程序; +3、支持查看安装的所有包名; +4、进行了部分优化 +![1.2.0](https://images.gitee.com/uploads/images/2021/0606/115536_0c0ddf38_7896131.png) + +#### V1.1.0(2021-05-30): +1、修改了因编写时出现的中、英文混用的情况 +2、支持一键连接默认 IP +3、修复在不连接设备直接选择 apk 安装时会卡住的问题 +4、修复在把“uengine 程序菜单”发送到桌面或启动器如果询问覆盖时点击取消会卡住的问题 +5、修改了程序界面为白色调,不和标题栏冲突矛盾 +![1.1.0](https://images.gitee.com/uploads/images/2021/0530/133429_7e6bf629_7896131.png) + +#### V1.0.0(2021-05-29): +![1.0.0](https://images.gitee.com/uploads/images/2021/0529/173756_2e333c86_7896131.png) + +### 源码安装教程 +按下 Ctrl+Alt+T 打开终端,按以下内容操作: +1. 安装所需依赖 + +```bash +sudo apt install deepin-elf-verify python3 python3-tk python3-pip +sudo apt install aapt uengine python3-setuptools deepin-terminal curl +sudo apt install python3-pil python3-pil.imagetk python3-requests adb +sudo apt install translate-shell python3-xlib python3-requests fonts-noto-cjk python3-numpy +python3 -m pip install pip -U +python3 -m pip install --upgrade ttkthemes -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade pyautogui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade keyboard -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +``` + +2. 下载本程序 + +```bash +git clone https://gitee.com/gfdgd-xi/uengine-runner.git +``` + +3. 运行本程序 + +```bash +sudo mkdir /opt/apps/uengine-runner +sudo cp uengine-runner /opt/apps/uengine-runner -rv +sudo cp getxmlimg.py /opt/apps/uengine-runner -rv +sudo cp icon.png /opt/apps/uengine-runner -rv +chmod 777 /opt/apps/uengine-runner/main.py +sudo cp /opt/apps/uengine-runner/main.py /usr/bin/uengine-runner +./main.py +``` + +4. 卸载本程序 +```bash +sudo rm /usr/bin/uengine-runner -v +sudo rm /opt/apps/uengine-runner/ -rfv +pip3 uninstall ttkthemes +``` + +### 使用说明 +1、需要你有使用 root 权限的能力; +2、需要安装 UEngine 才能使用,UOS建议在商店安装一个安卓应用,让系统自动安装 UEngine 及相关的依赖包; +3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准; +4、如果报错是有关产生 .deksotp 文件有关,一般可以打开程序列表运行。如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。 + +### 故障排除 +提 issue 最好,当然有些问题自己无法解决,请大佬 push 一下 +如果出现故障,尝试终端运行,如果是可以自行解决的问题,就**自行解决**,如果可以就**提 issues 并提供解决方案**,不行就**提 isscue 并提供程序和终端报错以及程序版本** + +### 下载量 +这里只统计蓝奏云的下载量,链接(懒得更了): +[https://kdocs.cn/l/smrvazWGuKcY](https://kdocs.cn/l/smrvazWGuKcY) + +### 已知问题 +

+ +![Error](https://storage.deepin.org/thread/202108101105396531_截图___tk__messagebox_20210810110449.png) +部分 app 无法读取出图片,已知: +| 程序 | 下载链接 | +| :-: | :-: | +| Firefox For Android | https://www.firefox.com.cn/download/ | +| 网易云音乐 For Android | https://music.163.com/#/download | +| 抖音 | https://www.wandoujia.com/apps/7461948 | +| 360 手机浏览器 | https://mse.360.cn/ | +| E-Go | 忘了 | +| 其他待测试…… | 其他待测试…… | +**注意:提取不出图标不代表未安装成功!** + + +### 贡献 +

+ +非常欢迎大家的贡献 +贡献的开发者列表: +| 开发者 | 邮箱 | +| :-: | :-: | +| gfdgd xi | 3025613752@qq.com | +| actionchen | 917981399@qq.com | +| 柚子 | https://gitee.com/Limexb | + +### 相关项目 +| 项目名称 | 项目地址 | +| :-: | :-:| +| uengine-installer | https://gitee.com/Maicss/uengine-installer | +| uengine APK 打包器 | https://gitee.com/gfdgd-xi/uengine-apk-builder | +| Root UEngine | https://gitee.com/Limexb/root-uengine | + +### 附测试生成图标无问题列表: +**至于能不能用就不测试了,这暂时不是重点** +**现在新加了评分功能,就看大家的评分了!** +| 程序 | 下载链接 | +|:-:|:-:| +| QQ 全家桶(完整版、极速版、Android Pad 版) | https://im.qq.com | +| TIM | 忘了 | +| 微信 | https://weixin.qq.com | +| 百度翻译 | 忘了 | +| 百度网盘 | https://pan.baidu.com | +| 腾讯课堂 | 忘了 | +| 抖音极速版 | 忘了 | +| 豌豆荚 | 忘了 | +| 小猿口算 | 忘了 | +| Hyperbowl | 忘了 | +| bilibili | https://d.bilibili.com/download_app.html?bsource=app_bili | +| 蓝奏云 | https://up.woozooo.com/lanzouh5.apk | +| QQ 音乐(完整版、Android Pad 版、TV 版、车载版) | https://y.qq.com/download/index.html | +| 360 手机卫士(完整版、极速版) | https://shouji.360.cn/v6/index.html | +| 360 清理大师(稳定版、尝鲜版) | http://shouji.360.cn/360cleandroid/ | +| 360 手机助手 | http://sj.360.cn/index.html | +| WPS Office For Android | https://www.wps.cn/ | +| 钉钉 for android | https://page.dingtalk.com/wow/dingtalk/act/download?spm=a3140.8196062.0.0.6f4c5c3dWBhYUM | + +### ©2021-2022 \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/__pycache__/getxmlimg.cpython-37.pyc b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/__pycache__/getxmlimg.cpython-37.pyc new file mode 100644 index 0000000..75289c7 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/__pycache__/getxmlimg.cpython-37.pyc differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/README.md b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/README.md new file mode 100644 index 0000000..8630a4e --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/README.md @@ -0,0 +1,109 @@ +# API 介绍 +# 必知 +1. 此 API 只支持可以运行 UEngine 的 Linux 上,Windows 上无法使用 +2. 部分函数需要 root 权限 +3. 这是 UEngine 运行器的函数重构,所以一些 UEngine 运行器上没有的 bug 可能在这个 API 里有 +## ProgramInformation +用于获取一些程序信息,详细如下(未特殊表明的是变量,否则是函数): +| 变量/函数名 | 变量/函数介绍 | +|:-:|:-:| +| programPath | 获取程序所在路径 | +| version | API 版本 | +| updateTime | 更新时间 | +| websize | 程序官网 | +| home | 用户 home(用户文件)目录 | +| developer | 参与的开发者列表 | +| language | 当前语言 | +| DesktopPath() | (函数)用户桌面目录 | + +## Check +用于检查 API 所需的东西是否完整,详细如下: +| 函数名 | 函数介绍 | +|:-:|:-:| +| CheckDepend() | 检查 API 所需的依赖是否完整 | + +## ROOT +用于检查 ROOT 方面问题,详细如下: +| 函数名 | 函数介绍 | +|:-:|:-:| +| GetRoot() | 检查程序/API是否以 ROOT 权限运行 | + +## APK +这是面向对象的写法,所以应用方式也不一样: +```python +import api +xxx = api.APK("APK 所在路径") +``` +具体函数介绍: +| 函数名 | 函数介绍 | +|:-:|:-:| +| xxx.install() | 安装这个 APK 包(需要 Root) | +| xxx.uninstall()| 卸载这个 APK 包(需要 Root) | +| xxx.information()| 获取从 aapt 获取到的 APK 信息 | +| xxx.activityName() | 获取 APK 的 Activity 信息 | +| xxx.packageName() | 获取 APK 包名 | +| xxx.chineseLabel() | 获取 APK 中文名称 | +| xxx.saveApkIcon("图标保存路径") | 保存 APK 的图标到指定路径 | +| xxx.version() | 获取 APK 版本号 | +| xxx.saveDesktopFile("图标保存路径", "快捷方式保存路径") | 保存支持 UEngine 启动的 APK 快捷方式 | +| xxx.run() | 运行该应用(需要保证已经安装) | +| xxx.buildDeb("deb 包保存路径", qianZhui) | 打包为 deb 包(“qianZhui”是布尔值,可略,True代表有前缀为“uengine-dc”,False代表没有前缀) | + +## UEngine +用于对 UEngine 进行一点点操控,详细如下: +| 函数名 | 函数介绍 | +|:-:|:-:| +| UengineAppManager() | 显示 UEngine 安装应用程序管理器 | +| OpenApp("应用包名", "应用Activity") | 运行指定的应用(需要保证程序已经安装) | +| UengineDataClean() | 清空 UEngine 数据(需要 Root) | +| RemoveUengineCheck() | 删除 UEngine 的检查脚本(需要 Root) | +| CPUCheck() | 检查 CPU 是否支持运行 UEngine | +| BuildUengineRootImage() | 构建 UEngine 的 Root 镜像 | +| OpenUengineRootData() | 打开 UEngine 数据目录 | +| InstallRootUengineImage() | 安装已经被 Root 过的 UEngine 镜像(需要 Root) | +| Services | 用于操控 UEngine 服务的类,见下(需要 Root) | +| InternetBridge | 用于操控 UEngine 网络桥接的类,见下(需要 Root) | +### Services +关于 UEngine 的服务控制: +| 函数名 | 函数介绍 | +|:-:|:-:| +| Services.Open() | 打开 UEngine 服务(需要 Root) | +| Services.Close() | 关闭 UEngine 服务(需要 Root) | +| Services.Restart() | 重启 UEngine 服务(需要 Root) | +### InternetBridge +关于 UEngine 的网络桥接控制: +| 函数名 | 函数介绍 | +|:-:|:-:| +| InternetBridge.Open() | 打开 UEngine 网络桥接(需要 Root) | +| InternetBridge.Close() | 关闭 UEngine 网络桥接(需要 Root) | +| InternetBridge.Restart() | 重启 UEngine 网络桥接(需要 Root) | +| InternetBridge.Reload() | 重新加载 UEngine 网络桥接(需要 Root) | +| InternetBridge.ForceReload() | 强制加载 UEngine 网络桥接(需要 Root) | +## Adb +用于对 Adb 的部分操控 +| 函数名 | 函数介绍 | +|:-:|:-:| +| Services | 用于操控 Adb 服务的类,见下 | +### Service +关于 Adb 的服务控制: +| 函数名 | 函数介绍 | +|:-:|:-:| +| Services.Open() | 打开 Adb 服务 | +| Services.Close() | 关闭 Adb 服务 | +| Services.Kill() | 杀死 Adb 进程 | +## File +关于文件的读取和写入,这是面向对象的写法,所以应用方式也不一样: +```python +import api +xxx = api.File("文件所在路径") +``` +| 函数名 | 函数介绍 | +|:-:|:-:| +| xxx.read() | 读取这个文件 | +| xxx.write("写入内容") | 写入这个文件 | + +## UengineRunner +用于 UEngine 运行器的部分操控(请保证安装了 UEngine 运行器) +| 函数名 | 函数介绍 | +|:-:|:-:| +| CleanHistory() | 清理 UEngine 运行器的历史记录 | \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/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/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py new file mode 100644 index 0000000..c54a59a --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py @@ -0,0 +1,372 @@ +import os +import random +import shutil +import zipfile +import traceback +import subprocess +from getxmlimg import getsavexml + +class ProgramInformation: + programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string + version = "1.6.0Alpha2" + updateTime = "2022年05月21日" + websize = ["https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner"] + home = os.path.expanduser('~') + developer = ["gfdgd xi<3025613752@qq.com>", "为什么您不喜欢熊出没和阿布呢", "星空露光", "actionchen<917981399@qq.com>", "柚子"] + lang = os.getenv('LANG') + # 获取用户桌面目录 + def DesktopPath() -> "获取用户桌面目录": + for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件 + desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1 + if desktop_index != -1: # 如果有对应项 + break # 结束循环 + if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1 + return -1 + else: + get = line[17:-2] # 截取桌面目录路径 + get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容 + if get != -1: # 如果有 + get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~) + return get # 返回目录 + +# 判断程序以正确方式运行 +class Check: + def CheckDepend(): + depend = ["/usr/bin/uengine", "UEngine", "/usr/bin/adb", "adb", "/usr/bin/uengine-session-launch-helper", "UEngine", "/usr/bin/aapt", "aapt"] + for i in range(0, len(depend), 2): + if not os.path.exists(depend[i]): + print("依赖{}不存在".format(depend[i + 1])) + +class ROOT: + def GetRoot(): + return os.geteuid() == 0 + +class APK: + def __init__(self, apkPath): + self.apkPath = apkPath + def install(self): + os.system("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(self.apkPath)) + def uninstall(self): + os.system("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(self.packageName())) + def information(self): + return subprocess.getoutput("aapt dump badging '{}'".format(self.apkPath)) + def activityName(self): + info = self.information() + for line in info.split('\n'): + if "launchable-activity" in line: + line = line[0: line.index("label='")] + line = line.replace("launchable-activity: ", "") + line = line.replace("'", "") + line = line.replace(" ", "") + line = line.replace("name=", "") + line = line.replace("label=", "") + line = line.replace("icon=", "") + return line + # 获取 apk 包名 + def packageName(self): + info = self.information() + for line in info.split('\n'): + if "package:" in line: + line = line[0: line.index("versionCode='")] + line = line.replace("package:", "") + line = line.replace("name=", "") + line = line.replace("'", "") + line = line.replace(" ", "") + return line + # 获取软件的中文名称 + def chineseLabel(self) -> "获取软件的中文名称": + info = self.information() + for line in info.split('\n'): + if "application-label:" in line: + line = line.replace("application-label:", "") + line = line.replace("'", "") + return line + # 保存apk图标 + def saveApkIcon(self, iconSavePath) -> "保存 apk 文件的图标": + try: + if os.path.exists(iconSavePath): + os.remove(iconSavePath) + info = self.information() + for line in info.split('\n'): + if "application:" in line: + xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'", "") + if xmlpath.endswith('.xml'): + xmlsave = getsavexml() + print(xmlpath) + xmlsave.savexml(self.apkPath, xmlpath, iconSavePath) + return + else: + zip = zipfile.ZipFile(self.apkPath) + iconData = zip.read(xmlpath) + with open(iconSavePath, 'w+b') as saveIconFile: + saveIconFile.write(iconData) + return + print("None Icon! Show defult icon") + shutil.copy(ProgramInformation.programPath + "/defult.png", iconSavePath) + except: + traceback.print_exc() + print("Error, show defult icon") + shutil.copy(ProgramInformation.programPath + "/defult.png", iconSavePath) + def version(self): + info = self.information() + for line in info.split('\n'): + if "package:" in line: + if "compileSdkVersion='" in line: + line = line.replace(line[line.index("compileSdkVersion='"): -1], "") + if "platform" in line: + line = line.replace(line[line.index("platform"): -1], "") + line = line.replace(line[0: line.index("versionName='")], "") + line = line.replace("versionName='", "") + line = line.replace("'", "") + line = line.replace(" ", "") + return line + def saveDesktopFile(self, desktopPath, iconPath): + showName = self.chineseLabel() + if showName == "" or showName == None: + showName = "未知应用" + self.saveApkIcon(iconPath) + things = '''[Desktop Entry] + Categories=app; + Encoding=UTF-8 + Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} + GenericName={} + Icon={} + MimeType= + Name={} + StartupWMClass={} + Terminal=false + Type=Application + '''.format(self.packageName(), self.activityName(), showName, iconPath, showName, showName) + File(desktopPath).write(things) + def run(self): + UEngine.OpenApp(self.packageName(), self.activityName()) + + def buildDeb(self, savePath, qianZhui = True): + tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024))) + #RunCommandShow("echo '======================================New===================================='") + #RunCommandShow("echo '创建目录'") + os.makedirs("{}/DEBIAN".format(tempPath)) + os.makedirs("{}/usr/share/applications".format(tempPath)) + os.makedirs("{}/usr/share/uengine/apk".format(tempPath)) + os.makedirs("{}/usr/share/uengine/icons".format(tempPath)) + apkPackageName = self.packageName() + if qianZhui: + apkPackageNameNew = "uengine-dc-" + self.packageName().lower() + else: + apkPackageNameNew = self.packageName().lower() + apkPackageVersion = self.version() + if apkPackageVersion[0].upper() == "V": + package = list(apkPackageVersion) + package.pop(0) + apkPackageVersion = "".join(package) + apkChineseLabel = self.chineseLabel() + apkActivityName = self.activityName() + iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew) + debControl = '''Package: {} +Version: {} +Architecture: all +Maintainer: {} +Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1) +Section: utils +Priority: optional +Description: {}\n'''.format(apkPackageNameNew, apkPackageVersion, apkChineseLabel, apkChineseLabel) + debPostinst = '''#!/bin/sh + +APK_DIR="/usr/share/uengine/apk" +APK_NAME="{}" +APK_PATH="$APK_DIR/$APK_NAME" +DESKTOP_FILE="{}" + + +if [ -f $APK_PATH ]; then + echo "Installing $APK_NAME" +else + echo "ERROR: $APK_NAME does not exist." + exit 0 +fi + +session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep` +if test -z "$session_manager"; then + echo "ERROR: app install failed(session-manager is not running)." + sess_dir="/usr/share/uengine/session_install" + if [ ! -d $sess_dir ]; then + mkdir $sess_dir + chmod 777 $sess_dir + fi + apk_name=${{APK_PATH##*/}} + fileName="$sess_dir/$apk_name" + echo $DESKTOP_FILE > $fileName + abistr="" + if test -n "$abistr"; then + abi=`echo $abistr |awk -F \= '{{print $2}}'` + echo $abi >> $fileName + fi + chmod 766 $fileName +fi + +/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH" + +exit 0'''.format(apkPackageNameNew + ".apk", "/usr/share/applications/{}.desktop".format(apkPackageNameNew)) + debPrerm = '''#!/bin/sh + +APP_NAME="{}" +DESKTOP_FILE="{}" + +session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep` +if test -z "$session_manager"; then + echo "ERROR: app uninstall failed(session-manager is not running)." + sess_dir="/usr/share/uengine/session_uninstall" + if [ ! -d $sess_dir ]; then + mkdir $sess_dir + chmod 777 $sess_dir + fi + fileName="$sess_dir/$APP_NAME" + echo $DESKTOP_FILE > $fileName + chmod 766 $fileName +fi + +echo "Uninstalling $APP_NAME" +/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME" + +exit 0'''.format(apkPackageName, "/usr/share/applications/{}.desktop".format(apkPackageNameNew)) + desktopFile = '''[Desktop Entry] +Categories=Other; +Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} +Icon=/usr/share/uengine/icons/{}.png +Terminal=false +Type=Application +GenericName={} +Name={} +''' + # RunCommandShow("echo '{}' > '{}/DEBIAN/control'".format(debControl, tempPath)) + #RunCommandShow("echo 正在写入文件:'{}/DEBIAN/control'".format(tempPath)) + File("{}/DEBIAN/control".format(tempPath)).write(debControl) + #RunCommandShow("echo 正在写入文件:'{}/DEBIAN/postinst'".format(tempPath)) + File("{}/DEBIAN/postinst".format(tempPath)).write(debPostinst) + #RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath)) + File("{}/DEBIAN/prerm".format(tempPath)).write(debPrerm) + #RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageNameNew)) + # write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), desktopFile) + self.saveDesktopFile("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), + "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew)) + #BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, + # "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew), + # "{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew)) + #RunCommandShow("echo '复制文件'") + #RunCommandShow("echo '写入 APK 软件图标'") + #SaveApkIcon(apkPath, iconSavePath) + self.saveApkIcon(iconSavePath) + #RunCommandShow("echo '复制 APK 文件'") + shutil.copy(self.apkPath, "{}/usr/share/uengine/apk/{}.apk".format(tempPath, apkPackageNameNew)) + #RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew)) + #RunCommandShow("echo '正在设置文件权限……'") + os.system("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath)) + os.system("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath)) + #RunCommandShow("echo '打包 deb 到桌面……'") + os.system( + "dpkg -b '{}' '{}'".format(tempPath, savePath)) + #RunCommandShow("echo '正在删除临时目录……'") + #shutil.rmtree(tempPath) + #RunCommandShow("rm -rfv '{}'".format(tempPath)) + #RunCommandShow("echo '完成!'") + #findApkHistory.append(apkPath) + #combobox1['value'] = findApkHistory + #write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", + # str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + #messagebox.showinfo(title="提示", message="打包完成") + #DisabledAndEnbled(False) + + +class UEngine: + def UengineAppManager(): + os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") + def OpenApp(appPackage, appActivity): + os.system("uengine launch --package={} --component={}".format(appPackage, appActivity)) + # 清空 uengine 数据 + def UengineDataClean() -> "清空 uengine 数据": + shutil.rmtree("{}/.local/share/applications/uengine/".format(ProgramInformation.home)) + shutil.rmtree("/data/uengine") + def RemoveUengineCheck(): + os.remove("/usr/share/uengine/uengine-check-runnable.sh") + def CPUCheck(): + return subprocess.getoutput("uengine check-features") + def BuildUengineRootImage(): + os.system(ProgramInformation.programPath + "/root-uengine.sh") + def OpenUengineRootData(): + os.system("xdg-open /data/uengine/data/data") + def InstallRootUengineImage(): + if not os.path.exists: + os.mkdir("/tmp/uengine-runner") + File("/tmp/uengine-runner/install.sh").write("sudo dpkg -i /tmp/uengine-runner/u*.deb\nsudo apt install -f") + os.system("wget -P '/tmp/uengine-runner' 'https://hub.fastgit.xyz/gfdgd-xi/uengine-runner/releases/download/U1.2.15/uengine-android-image_1.2.15_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'") + class Services: + def Open(): + os.system("pkexec systemctl enable uengine-container uengine-session && systemctl start uengine-container uengine-session") + def Close(): + os.system("pkexec systemctl disable uengine-container uengine-session") + def Restart(): + os.system("pkexec systemctl restart uengine*") + class InternetBridge: + def Open(): + os.system("pkexec uengine-bridge.sh start") + def Close(): + os.system("pkexec uengine-bridge.sh stop") + def Restart(): + os.system("pkexec uengine-bridge.sh restart") + def Reload(): + os.system("pkexec uengine-bridge.sh reload") + def ForceReload(): + os.system("pkexec uengine-bridge.sh force-reload") + +class Adb: + def __init__(self, ip=""): + self.ip = ip + + def connect(self): + os.system(f"adb connect {self.ip}") + + class Service: + def Open(): + os.system("adb start-server") + def Close(): + os.system("adb kill-server") + def Kill(): + os.system("killall adb") + + def boolAndroidInstallOtherAppSetting(self): + return subprocess.getoutput(f"adb -s {self.ip} shell settings get secure install_non_market_apps").replace(" ", "") == "1" + + def setAndroidInstallOtherAppSetting(self, op: bool): + os.system(f"adb -s {self.ip} shell settings put secure install_non_market_apps {int(op)}") + +class File: + def __init__(self, filePath): + self.filePath = filePath + def read(self): + f = open(self.filePath, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + def write(self, things) -> "写入文本文档": + TxtDir = os.path.dirname(self.filePath) + print(TxtDir) + if not os.path.exists(TxtDir): + os.makedirs(TxtDir, exist_ok=True) + file = open(self.filePath, 'w', encoding='UTF-8') # 设置文件对象 + file.write(things) # 写入文本 + file.close() # 关闭文本对象 + +class UengineRunner: + def CleanHistory(): + shutil.rmtree(ProgramInformation.home + "/.config/uengine-runner") + +if __name__ == "__main__": + print("本 API 不支持直接运行,请通过引入的方式使用此 API") + #adb = Adb("192.168.250.2:5555") + #print(adb.boolAndroidInstallOtherAppSetting()) + + #quit() + +if not ROOT.GetRoot(): + pass + #print("请获取 ROOT 权限以便更好的使用该 API") \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/__init__.cpython-37.pyc b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..69ef9b1 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/__init__.cpython-37.pyc differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/getxmlimg.cpython-37.pyc b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/getxmlimg.cpython-37.pyc new file mode 100644 index 0000000..79021ab Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__/getxmlimg.cpython-37.pyc differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/defult.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/defult.png new file mode 100644 index 0000000..c836b68 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/defult.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/getxmlimg.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/getxmlimg.py new file mode 100755 index 0000000..af59a70 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/getxmlimg.py @@ -0,0 +1,118 @@ +import PIL.Image as Image +import PIL.ImageDraw as ImageDraw +import zipfile +import subprocess +import re + +class getsavexml(): + + def savexml(self,apkFilePath,xmlpath,iconSavePath): + cmddumpid = "aapt dump xmltree "+ apkFilePath + " " + xmlpath + print(cmddumpid) + xmltree = subprocess.getoutput(cmddumpid) + xmls = xmltree.splitlines() + # find strs ,print next line + def FindStrs(lines,strs): + i=0 + while i < len(lines): + if re.search(strs,lines[i]): + tmpstr = lines[i+1] + i += 1 + Resultstr = tmpstr.split(":")[-1].split("=")[-1].split("0x")[-1] + return Resultstr + else: + i += 1 + #从apk的信息中获取前后景图片的ID号 + backimgid = FindStrs(xmls,"background") + foreimgid = FindStrs(xmls,"foreground") + print(backimgid) + print(foreimgid) + + # 直接从apk resource文件获取前后两层图片路径及ID字符串 + resource = subprocess.getoutput("aapt dump --values resources " + apkFilePath + "| grep -iE -A1 " + "\"" + backimgid + "|" + foreimgid + "\"") + resourcelines = resource.splitlines() + print(resourcelines) + + # 从过滤出的字符串中获取所有相同ID的图片路径 + def Findpicpath(lines,imgid): + i=0 + Resultstr = [] + while i < len(lines): + if re.search(imgid,lines[i]) and re.search("string8",lines[i+1]) : + print(lines[i+1]) + tmpstr = lines[i+1].replace("\"","") + i += 1 + Resultstr.append(tmpstr.split()[-1]) + else: + i += 1 + return Resultstr + + #获取所有带前后图片ID的图片路径(相同背景或者前景的图片ID但分辨率不一样) + backimgs = Findpicpath(resourcelines,backimgid) + foreimgs = Findpicpath(resourcelines,foreimgid) + print(backimgs) + print(foreimgs) + #获取分辨率最高的图片路径 + def getmaxsize(imgs): + j = 0 + size=(0,0) + zipapk = zipfile.ZipFile(apkFilePath) + imgpath = "" + while j < len(imgs): + print(imgs[j]) + img = Image.open(zipapk.open(imgs[j])) + print(imgs[j]) + print(img.size) + if size < img.size: + size = img.size + imgpath = imgs[j] + j += 1 + return imgpath + + # 获取到文件列表后,进行比较分辨率,选取分辨率最高的张图片 + iconbackpath = getmaxsize(backimgs) + iconforepath = getmaxsize(foreimgs) + print(iconbackpath + " " + iconforepath) + + #从APK文件获取最终图片 + zipapk = zipfile.ZipFile(apkFilePath) + iconback = zipapk.open(iconbackpath) + iconfore = zipapk.open(iconforepath) + + + # 叠加图片,mask 设置前景为蒙版 + iconbackimg = Image.open(iconback).convert("RGBA") + iconforeimg = Image.open(iconfore).convert("RGBA") + iconbackimg.paste(iconforeimg,mask=iconforeimg) + + + # 圆角图片函数,网上拷贝的 + def circle_corner(img, radii): #把原图片变成圆角,这个函数是从网上找的,原址 https://www.pyget.cn/p/185266 + """ + 圆角处理 + :param img: 源图象。 + :param radii: 半径,如:30。 + :return: 返回一个圆角处理后的图象。 + """ + # 画圆(用于分离4个角) + circle = Image.new('L', (radii * 2, radii * 2), 0) # 创建一个黑色背景的画布 + draw = ImageDraw.Draw(circle) + draw.ellipse((0, 0, radii * 2, radii * 2), fill=255) # 画白色圆形 + # 原图 + img = img.convert("RGBA") + w, h = img.size + # 画4个角(将整圆分离为4个部分) + alpha = Image.new('L', img.size, 255) + alpha.paste(circle.crop((0, 0, radii, radii)), (0, 0)) # 左上角 + alpha.paste(circle.crop((radii, 0, radii * 2, radii)), (w - radii, 0)) # 右上角 + alpha.paste(circle.crop((radii, radii, radii * 2, radii * 2)), (w - radii, h - radii)) # 右下角 + alpha.paste(circle.crop((0, radii, radii, radii * 2)), (0, h - radii)) # 左下角 + # alpha.show() + img.putalpha(alpha) # 白色区域透明可见,黑色区域不可见 + return img + + # 圆角半径1/8边长,保存icon图片 + w,h = iconbackimg.size + iconimg = circle_corner(iconbackimg,int(w/8)) + iconimg.save(iconSavePath) + diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/root-uengine.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/root-uengine.sh new file mode 100755 index 0000000..335f765 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/root-uengine.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +#sudo apt install squashfs-tools + +mkdir -p ~/temp +cd ~/temp +echo "正在下载supersu" +aria2c -x 16 -s 16 -d ~/temp http://supersuroot.org/downloads/SuperSU-v2.82-201705271822.zip +cd .. +mkdir -p ~/temp/work/dabao/extract/DEBIAN +echo "正在解压supersu" +unzip ~/temp/SuperSU-v2.82-201705271822.zip -d ~/temp/work/su +WORKDIR=~/temp/work +cd "$WORKDIR" +echo "正在下载uengine-android-image" +apt download uengine-android-image +echo "正在解压uengine-android-image" +cd dabao +dpkg-deb -x $WORKDIR/uengine-android-image*.deb extract/ +dpkg-deb -e $WORKDIR/uengine-android-image*.deb extract/DEBIAN +cd .. +cp dabao/extract/usr/share/uengine/android.img android.img + +echo "正在解压android镜像" +sudo unsquashfs android.img + +sudo mkdir -p ./squashfs-root/system/app/SuperSU +sudo mkdir -p ./squashfs-root/system/bin/.ext/ + +echo "正在将supersu安装到android镜像" +sudo cp ./su/common/Superuser.apk ./squashfs-root/system/app/SuperSU/SuperSU.apk +sudo cp ./su/common/install-recovery.sh ./squashfs-root/system/etc/install-recovery.sh +sudo cp ./su/common/install-recovery.sh ./squashfs-root/system/bin/install-recovery.sh +sudo cp ./su/x64/su ./squashfs-root/system/xbin/su +sudo cp ./su/x64/su ./squashfs-root/system/bin/.ext/.su +sudo cp ./su/x64/su ./squashfs-root/system/xbin/daemonsu +sudo cp ./su/x64/supolicy ./squashfs-root/system/xbin/supolicy +sudo cp ./su/x64/libsupol.so ./squashfs-root/system/lib64/libsupol.so +sudo cp ./squashfs-root/system/bin/app_process64 ./squashfs-root/system/bin/app_process_init +sudo cp ./squashfs-root/system/bin/app_process64 ./squashfs-root/system/bin/app_process64_original +sudo cp ./squashfs-root/system/xbin/daemonsu ./squashfs-root/system/bin/app_process +sudo cp ./squashfs-root/system/xbin/daemonsu ./squashfs-root/system/bin/app_process64 + +sudo chmod +x ./squashfs-root/system/app/SuperSU/SuperSU.apk +sudo chmod +x ./squashfs-root/system/etc/install-recovery.sh +sudo chmod +x ./squashfs-root/system/bin/install-recovery.sh +sudo chmod +x ./squashfs-root/system/xbin/su +sudo chmod +x ./squashfs-root/system/bin/.ext/.su +sudo chmod +x ./squashfs-root/system/xbin/daemonsu +sudo chmod +x ./squashfs-root/system/xbin/supolicy +sudo chmod +x ./squashfs-root/system/lib64/libsupol.so +sudo chmod +x ./squashfs-root/system/bin/app_process_init +sudo chmod +x ./squashfs-root/system/bin/app_process64_original +sudo chmod +x ./squashfs-root/system/bin/app_process +sudo chmod +x ./squashfs-root/system/bin/app_process64 + +echo "正在打包android镜像" +sudo rm android.img +sudo mksquashfs squashfs-root android.img -b 131072 -comp xz -Xbcj ia64 + + +cp android.img dabao/extract/usr/share/uengine/android.img + +echo "正在打包uengine-android-image" +cd dabao/extract +find usr -type f -print0 |xargs -0 md5sum >md5sums +cd .. +mkdir build +dpkg-deb -b extract/ build/ + +cp build/*.deb ~/ + +echo "正在清理垃圾" +sudo rm -rf ~/temp + +echo "已在用户主目录生成新的安装包,安装后重启即可生效" \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/builer.svg b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/builer.svg new file mode 100755 index 0000000..2cfd070 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/builer.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult-old.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult-old.png new file mode 100755 index 0000000..4cff476 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult-old.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult.png new file mode 100755 index 0000000..4cff476 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/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/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/getxmlimg.py new file mode 100755 index 0000000..af59a70 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/getxmlimg.py @@ -0,0 +1,118 @@ +import PIL.Image as Image +import PIL.ImageDraw as ImageDraw +import zipfile +import subprocess +import re + +class getsavexml(): + + def savexml(self,apkFilePath,xmlpath,iconSavePath): + cmddumpid = "aapt dump xmltree "+ apkFilePath + " " + xmlpath + print(cmddumpid) + xmltree = subprocess.getoutput(cmddumpid) + xmls = xmltree.splitlines() + # find strs ,print next line + def FindStrs(lines,strs): + i=0 + while i < len(lines): + if re.search(strs,lines[i]): + tmpstr = lines[i+1] + i += 1 + Resultstr = tmpstr.split(":")[-1].split("=")[-1].split("0x")[-1] + return Resultstr + else: + i += 1 + #从apk的信息中获取前后景图片的ID号 + backimgid = FindStrs(xmls,"background") + foreimgid = FindStrs(xmls,"foreground") + print(backimgid) + print(foreimgid) + + # 直接从apk resource文件获取前后两层图片路径及ID字符串 + resource = subprocess.getoutput("aapt dump --values resources " + apkFilePath + "| grep -iE -A1 " + "\"" + backimgid + "|" + foreimgid + "\"") + resourcelines = resource.splitlines() + print(resourcelines) + + # 从过滤出的字符串中获取所有相同ID的图片路径 + def Findpicpath(lines,imgid): + i=0 + Resultstr = [] + while i < len(lines): + if re.search(imgid,lines[i]) and re.search("string8",lines[i+1]) : + print(lines[i+1]) + tmpstr = lines[i+1].replace("\"","") + i += 1 + Resultstr.append(tmpstr.split()[-1]) + else: + i += 1 + return Resultstr + + #获取所有带前后图片ID的图片路径(相同背景或者前景的图片ID但分辨率不一样) + backimgs = Findpicpath(resourcelines,backimgid) + foreimgs = Findpicpath(resourcelines,foreimgid) + print(backimgs) + print(foreimgs) + #获取分辨率最高的图片路径 + def getmaxsize(imgs): + j = 0 + size=(0,0) + zipapk = zipfile.ZipFile(apkFilePath) + imgpath = "" + while j < len(imgs): + print(imgs[j]) + img = Image.open(zipapk.open(imgs[j])) + print(imgs[j]) + print(img.size) + if size < img.size: + size = img.size + imgpath = imgs[j] + j += 1 + return imgpath + + # 获取到文件列表后,进行比较分辨率,选取分辨率最高的张图片 + iconbackpath = getmaxsize(backimgs) + iconforepath = getmaxsize(foreimgs) + print(iconbackpath + " " + iconforepath) + + #从APK文件获取最终图片 + zipapk = zipfile.ZipFile(apkFilePath) + iconback = zipapk.open(iconbackpath) + iconfore = zipapk.open(iconforepath) + + + # 叠加图片,mask 设置前景为蒙版 + iconbackimg = Image.open(iconback).convert("RGBA") + iconforeimg = Image.open(iconfore).convert("RGBA") + iconbackimg.paste(iconforeimg,mask=iconforeimg) + + + # 圆角图片函数,网上拷贝的 + def circle_corner(img, radii): #把原图片变成圆角,这个函数是从网上找的,原址 https://www.pyget.cn/p/185266 + """ + 圆角处理 + :param img: 源图象。 + :param radii: 半径,如:30。 + :return: 返回一个圆角处理后的图象。 + """ + # 画圆(用于分离4个角) + circle = Image.new('L', (radii * 2, radii * 2), 0) # 创建一个黑色背景的画布 + draw = ImageDraw.Draw(circle) + draw.ellipse((0, 0, radii * 2, radii * 2), fill=255) # 画白色圆形 + # 原图 + img = img.convert("RGBA") + w, h = img.size + # 画4个角(将整圆分离为4个部分) + alpha = Image.new('L', img.size, 255) + alpha.paste(circle.crop((0, 0, radii, radii)), (0, 0)) # 左上角 + alpha.paste(circle.crop((radii, 0, radii * 2, radii)), (w - radii, 0)) # 右上角 + alpha.paste(circle.crop((radii, radii, radii * 2, radii * 2)), (w - radii, h - radii)) # 右下角 + alpha.paste(circle.crop((0, radii, radii, radii * 2)), (0, h - radii)) # 左下角 + # alpha.show() + img.putalpha(alpha) # 白色区域透明可见,黑色区域不可见 + return img + + # 圆角半径1/8边长,保存icon图片 + w,h = iconbackimg.size + iconimg = circle_corner(iconbackimg,int(w/8)) + iconimg.save(iconSavePath) + diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.png new file mode 100644 index 0000000..c836b68 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.svg b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.svg new file mode 100755 index 0000000..baaa994 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/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/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json new file mode 100755 index 0000000..52018b4 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json @@ -0,0 +1,200 @@ +{ + "Package": "com.gitee.uengine.runner.spark", + "Url": [ + "https://gitee.com/gfdgd-xi/uengine-runner", + "https://github.com/gfdgd-xi/uengine-runner" + ], + "Version": "1.8.0", + "System": "Linux(deepin/UOS)", + "Tips": [ + "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis 或程序的更多帮助", + "安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮", + "卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。", + "保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可", + "重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可", + " 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了", + "打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)", + "提示:", + "※1、近期升级的 UEngine 安装时会自动把要安装的 apk 删除,如果这个 apk 文件非常重要请拷贝一个备份版并安装这个备份版", + "2、需要你有使用 root 权限的能力;", + "3、需要安装 UEngine 才能使用;", + "4、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;", + "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" + ], + "Update": [ + "V1.8.0:", + "※1、程序界面大部分由 Tkinter 转 PyQt5", + "※2、添加了自动/手动配置 UEngine 窗口大小文件(自动需要在设置里手动开启,配置窗口的配置文件需要 Root)", + "※3、增加了安装/卸载失败后的提示", + "※4、补回谢明名单", + "※5、支持免密安装/卸载 APK", + "6、pip 更换华为源,提升下载速度", + "7、新增主题功能", + "8、支持在安装 APK 后手动指定分类(手动指定需要在设置里手动开启)", + "", + "V1.7.0:", + "※1、新增暗黑主题", + "※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题", + "※3、修复 UEngine 安装脚本在安装时不让用户选择,直接默认 N 无法安装的问题", + "4、新增设置 UEngine 代理的功能", + "5、将执行命令和打包器的返回输出从命令结束后显示输出内容改为实时显示内容", + "", + "V1.6.2:", + "※1、优化了 UEngine 运行器的英语翻译", + "※2、新增加了可以打开或关闭第三方应用安装的功能(使用此功能后在UEngine里可以使用默认的APK安装程序安装应用,此操作需要使用程序的Adb补丁)", + "※3、新增加了 UEngine 的 Ubuntu 安装程序", + "※4、双包合一,只保留了UOS打包标准,可以从旧标准无缝升级(推荐使用本程序的升级程序进行升级)", + "5、修复了本程序在 Ubuntu 上安装和卸载报错而无法继续的问题", + "6、优化帮助/关于窗口在高分辨率电脑上显示不全的问题", + "", + "V1.6.1:", + "※1、修复了打包 deb 包在 APK 的包名有大写时无法启动的问题", + "※2、提供新版本的 UEngine Root 镜像", + "※3、更新了 UEngine Root 的下载地址", + "※4、修复了本程序的“UEngine 键盘映射”无法启动的问题", + "5、把构建 UEngine Root 镜像修改为多线程下载(wget=>aria2)", + "6、提供了 UEngine 运行器的 API(可以从项目地址中获取)", + "7、补上遗漏的项目参与者“星空露光”,新加项目参与者“为什么您不喜欢熊出没和阿布呢”", + "", + "V1.6.0:", + "※1、更换了新的图标", + "※2、支持程序的评分和查看分数详情的功能(如果炸了我的服务器,这个就作废了)", + "※3、修复了在安装奇奇怪怪的安装包(如格式、标识不正确的)时的快捷方式图标为空以及快捷方式文本的变化", + "※4、添加更新功能,可以自行升级到最新版本(如果炸了我的服务器,这个就作废了)", + "※5、新增程序帮助", + "6、新填彩蛋(在“关于”=>“关于”显示的窗口双击“关于”开启)(如果炸了我的服务器,这个就作废了)", + "7、修复了“UEngine 打包器”前缀选项勾选设置不生效的问题", + "", + "V1.5.3:", + "※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题", + "※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应,参考报错", + "※3、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀‘uengine-dc’”前缀的问题", + "4、“UEngine APK应用打包器”支持打包完后自动删除临时目录", + "5、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错", + "", + "V1.5.2:", + "※1、支持安装和构建带Root的UEngine的镜像", + "2、更新了反馈链接", + "", + "V1.5.1:", + "※1、精简用户界面,合并安装和卸载输入框和浏览按钮等", + "※2、修复安装以其的程序图标无法点击进入的问题(deepin 社区版不存在此问题)", + "※3、支持在程序本体反馈问题", + "4、修复了菜单栏的部分显示问题", + "5、支持显示 apk 的部分信息", + "6、支持删除 UEngine 程序运行检查以及重新安装 UEngine 的功能", + "7、自带有跳过家庭版必须有指定包名才能运行程序限制的脚本", + "8、补回依赖包“adb”", + "", + "V1.5.0:", + "※1、部分窗口支持英语", + "2、修复在英语状态下启动器图标名称异常的问题", + "", + "V1.4.3:", + "※1、支持打包器打包的包名带前缀“uengine-dc”", + "※2、修复了两种情况可能导致程序卡住/出错无法继续运行的情况(配置文件夹不齐全和获取版本信息卡住两种情况)", + "※3、修改了 UEngine 打包器打包的应用包名可能有大写的情况", + "4、支持一键使用 Scrcpy 连接 UEngine(①先安装 adb 破解补丁;②请确保是使用snap安装的 Scrcpy【目前只支持 snap 安装的 Scrcpy 进行连接】)", + "5、支持右键打包 apk", + "", + "V1.4.2:", + "※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;", + "2、菜单栏的项目添加以及外观优化;", + "3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;", + "4、把 uengine 改为 UEngine;", + "5、修改 pkexec 获取密码时显示的图标和文本;", + "6、添加了 UEngine 系统设置的快捷方式;", + "", + "V1.4.1:", + "※1、初步支持键盘映射", + "2、修复新版包在发送uengine列表快捷方式时会提示找不到文件", + "", + "V1.4.0:", + "※1、添加新版打包方式(deepin打包方式);", + "※2、支持测试运行/创建/删除uengine图标;", + "※3、支持提取安装的apk;", + "※4、支持打包deb包;", + "5、修改菜单栏布局;", + "6、支持打开uengine数据目录和用户数据目录;", + "7、程序信息保存到json,非直接写入程序本体;", + "8、更多命令操作;", + "", + "V.1.3.2:", + "※1、支持uengine数据重置;", + "※2、支持修改uengine网络桥接的启动状态;", + "※3、支持右键安装/卸载;", + "※4、支持启用或禁用uengine;", + "※5、修复打包问题,不会出现“dpkg:警告:卸载spark-uengine-runner时,目录/opt/apps/uengine-runner非空,因而不会删除该目录”的错误;", + "", + "V1.3.1:", + "※1、修复打包问题,防止部分用户安装出错的问题;", + "※2、修复了程序无法提取图标时可以提取默认图标使用;", + "", + "V1.3.0:", + "※1、修改了界面布局;", + "※2、修复大多数新安装普通用户的路图标及启动菜单文件路径不存在导致安装APK报错的bugs;", + "3、删除少量冗余代码,调整代码顺序;", + "4、支持提取apk图标。", + "", + "V1.2.3", + "1、调整部分控件名称;", + "2、调整界面布局及界面风格;", + "", + "V1.2.2", + "1、对程序错误的显示更加人性化;", + "2、对 icon 的获取方式进行了升级;", + "3、增加了注释、删除部分冗余代码。", + "", + "V1.2.1", + "※1、进行了安装方式的修改(不使用 adb),修复原无法安装和卸载的问题;", + "2、进行了部分优化;", + "3、进行了功能缩水;", + "4、修复 deb 打包错误。", + "", + "V1.2.0", + "1、支持安装自动添加快捷方式、卸载删除快捷方式;", + "2、支持使用包名或 APK 文件卸载程序;", + "3、支持查看安装的所有包名;", + "4、进行了部分优化", + "", + "V1.1.0", + "暂无数据", + "", + "V1.0.0", + "暂无数据" + ], + "Use": [ + "1、UEngine相关软件包(基于anbox开发)", + "2、Python3", + "3、tkinter(tkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk)", + "4、aapt", + "5、dpkg", + "6、tree", + "7、mkdir", + "8、echo", + "9、chmod", + "10、adb", + "11、deepin 终端", + "……" + ], + "Time": "2021年08月30日", + "Contribute": [ + "感谢以下用户提供的问题、建议、图标、代码等,如果有遗漏,请及时与开发者联系添加,以及如果侵犯到您的合法权益,也及时与开发者联系:

", + "
", + "感谢 麻木法师(1312580754) 在星火应用商店QQ交流群展示的接口及其原理", + "感谢 actionchen(917981399@qq.com) 提供了新版页面布局(1.3.0 ~ 最新版本)以及布局代码(1.3.0 ~ 1.7.0)", + "感谢 柚子(https://gitee.com/Limexb) 提供了 UEngine 构建 Root 镜像脚本", + "感谢 星空露光(https://gitee.com/Cynorkyle) 制作了 UEngine 新版图标和安装应用时能选择应用分类的建议", + "感谢 shenmo(jifengshenmo@outlook.com) 反馈了许多程序的问题以及提供了 UEngine 在 Ubuntu 上的安装脚本", + "感谢 desert(https://gitee.com/desert741) 提供了给软件增加启动成功后自动调整分辨率的功能的建议", + "感谢 云思浮(https://gitee.com/foresee_io) 反馈的 1.3.0 依赖缺失问题", + "感谢 miaoys(https://bbs.deepin.org/user/271467)、zccrs(https://bbs.deepin.org/user/277780) 等用户反馈希望程序能和与系统 DTK 主题协调的建议", + "感谢 jiutian123(https://bbs.deepin.org/user/258825) 反馈的 1.5.2、1.5.3 存在问题", + "感谢 kero990(https://bbs.deepin.org/user/277932) 反馈的 README 表示不清的问题", + "感谢 wang(https://gitee.com/wang1279476881) 反馈的 1.6.0 左键打不开 “安装与卸载APK”和打包时 APK 版本号开头带 V 无法正常打包的问题", + "感谢 通天灵宝(https://bbs.deepin.org/user/137230)、wuhaiou123(https://bbs.chinauos.com/zh/user/309117) 反馈的 图标生成错误导致无法生成 .desktop 文件的问题", + "感谢 潜伏(https://bbs.chinauos.com/zh/user/303339) 反馈的右键支持安装/卸载的建议", + "感谢 z***g@gmx.de(https://bbs.chinauos.com/zh/user/312017) 反馈的 UEngine 更新后 uengine-launch.sh 的社区版检测问题", + "参考 忘记、过去(https://bbs.deepin.org/user/154730) 的帖子《如何更优雅地使用 pkexec》(https://bbs.deepin.org/post/202966)" + ] +} \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/launch.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/launch.sh new file mode 100755 index 0000000..674905e --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/launch.sh @@ -0,0 +1,3 @@ +#!/bin/bash +XDG_CURRENT_DESKTOP="Deepin" +$1 -platformtheme deepin "$@" diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/menu.svg b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/menu.svg new file mode 100755 index 0000000..28561dd --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/menu.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/old-icon.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/old-icon.png new file mode 100755 index 0000000..0ec7233 Binary files /dev/null and b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/old-icon.png differ diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/root-uengine.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/root-uengine.sh new file mode 100755 index 0000000..a7edcda --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/root-uengine.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +sudo apt install squashfs-tools + +mkdir -p ~/temp +cd ~/temp +echo "正在下载supersu" +aria2c -x 16 -s 16 -d ~/temp http://supersuroot.org/downloads/SuperSU-v2.82-201705271822.zip +cd .. +mkdir -p ~/temp/work/dabao/extract/DEBIAN +echo "正在解压supersu" +unzip ~/temp/SuperSU-v2.82-201705271822.zip -d ~/temp/work/su +WORKDIR=~/temp/work +cd "$WORKDIR" +echo "正在下载uengine-android-image" +apt download uengine-android-image +echo "正在解压uengine-android-image" +cd dabao +dpkg-deb -x $WORKDIR/uengine-android-image*.deb extract/ +dpkg-deb -e $WORKDIR/uengine-android-image*.deb extract/DEBIAN +cd .. +cp dabao/extract/usr/share/uengine/android.img android.img + +echo "正在解压android镜像" +sudo unsquashfs android.img + +sudo mkdir -p ./squashfs-root/system/app/SuperSU +sudo mkdir -p ./squashfs-root/system/bin/.ext/ + +echo "正在将supersu安装到android镜像" +sudo cp ./su/common/Superuser.apk ./squashfs-root/system/app/SuperSU/SuperSU.apk +sudo cp ./su/common/install-recovery.sh ./squashfs-root/system/etc/install-recovery.sh +sudo cp ./su/common/install-recovery.sh ./squashfs-root/system/bin/install-recovery.sh +sudo cp ./su/x64/su ./squashfs-root/system/xbin/su +sudo cp ./su/x64/su ./squashfs-root/system/bin/.ext/.su +sudo cp ./su/x64/su ./squashfs-root/system/xbin/daemonsu +sudo cp ./su/x64/supolicy ./squashfs-root/system/xbin/supolicy +sudo cp ./su/x64/libsupol.so ./squashfs-root/system/lib64/libsupol.so +sudo cp ./squashfs-root/system/bin/app_process64 ./squashfs-root/system/bin/app_process_init +sudo cp ./squashfs-root/system/bin/app_process64 ./squashfs-root/system/bin/app_process64_original +sudo cp ./squashfs-root/system/xbin/daemonsu ./squashfs-root/system/bin/app_process +sudo cp ./squashfs-root/system/xbin/daemonsu ./squashfs-root/system/bin/app_process64 + +sudo chmod +x ./squashfs-root/system/app/SuperSU/SuperSU.apk +sudo chmod +x ./squashfs-root/system/etc/install-recovery.sh +sudo chmod +x ./squashfs-root/system/bin/install-recovery.sh +sudo chmod +x ./squashfs-root/system/xbin/su +sudo chmod +x ./squashfs-root/system/bin/.ext/.su +sudo chmod +x ./squashfs-root/system/xbin/daemonsu +sudo chmod +x ./squashfs-root/system/xbin/supolicy +sudo chmod +x ./squashfs-root/system/lib64/libsupol.so +sudo chmod +x ./squashfs-root/system/bin/app_process_init +sudo chmod +x ./squashfs-root/system/bin/app_process64_original +sudo chmod +x ./squashfs-root/system/bin/app_process +sudo chmod +x ./squashfs-root/system/bin/app_process64 + +echo "正在打包android镜像" +sudo rm android.img +sudo mksquashfs squashfs-root android.img -b 131072 -comp xz -Xbcj ia64 + + +cp android.img dabao/extract/usr/share/uengine/android.img + +echo "正在打包uengine-android-image" +cd dabao/extract +find usr -type f -print0 |xargs -0 md5sum >md5sums +cd .. +mkdir build +dpkg-deb -b extract/ build/ + +cp build/*.deb ~/ + +echo "正在清理垃圾" +sudo rm -rf ~/temp + +echo "已在用户主目录生成新的安装包,安装后重启即可生效" \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/runner.svg b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/runner.svg new file mode 100755 index 0000000..e27c0f4 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/runner.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/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/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder new file mode 100755 index 0000000..89bd788 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder @@ -0,0 +1,526 @@ +#!/usr/bin/env python3 +# 使用系统默认的 python3 运行 +########################################################################################### +# 作者:gfdgd xi +# 版本:1.7.0 +# 更新时间:2022年07月23日 +# 感谢:anbox、deepin 和 统信 +# 基于 Python3 的 tkinter 构建 +########################################################################################### +################# +# 引入所需的库 +################# +import os +import sys +import json +import shutil +import random +import zipfile +import traceback +import threading +import subprocess +import PyQt5.QtGui as QtGui +import PyQt5.QtCore as QtCore +import PyQt5.QtWidgets as QtWidgets +from getxmlimg import getsavexml + +def FindApk(): + path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 APK", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"], "APK 可执行文件(*.apk);;所有文件(*.*)") + if path != "" and path != "()": + try: + combobox1.setEditText(path[0]) + write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path[0])})) # 写入配置文件 + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + +class QT: + run = None + +def BuildDeb(): + if combobox1.currentText() == "": + QtWidgets.QMessageBox.critical(None, "提示", "信息没有填写完整,无法继续打包 APK") + return + if not os.path.exists(combobox1.currentText()): + QtWidgets.QMessageBox.critical(None, "提示", "信息填写错误,无法继续打包 APK") + return + DisabledAndEnbled(True) + QT.run = BuildApkDeb(combobox1.currentText()) + QT.run.signal.connect(TextboxAddText1) + QT.run.labelChange.connect(ChangeItems) + QT.run.tips.connect(TipsMessagebox) + QT.run.start() + +class BuildApkDeb(QtCore.QThread): + signal = QtCore.pyqtSignal(str) + labelChange = QtCore.pyqtSignal(str) + tips = QtCore.pyqtSignal(str) + + def __init__(self, apkPath) -> None: + self.apkPath = apkPath + super().__init__() + + def RunCommandShow(self, command): + if command.replace(" ", "").replace("\n", "") == "": + return + self.signal.emit("$> {}".format(command)) + res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 实时读取程序返回 + while res.poll() is None: + try: + texts = res.stdout.readline().decode("utf8") + except: + texts = "" + print(texts, end="") + self.signal.emit(texts) + # 已废弃 + # TextboxAddText1(GetCommandReturn(command)) + + def run(self): + try: + apkPath = self.apkPath + tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024))) + self.RunCommandShow("echo '======================================New===================================='") + self.RunCommandShow("echo '创建目录'") + self.RunCommandShow("mkdir -pv '{}/DEBIAN'".format(tempPath)) + self.RunCommandShow("mkdir -pv '{}/usr/share/applications'".format(tempPath)) + self.RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath)) + self.RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath)) + self.RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'") + apkPackageName = GetApkPackageName(apkPath, False) + if check.isChecked(): + apkPackageNameNew = GetApkPackageName(apkPath, True).lower() + else: + apkPackageNameNew = GetApkPackageName(apkPath, False).lower() + apkPackageVersion = GetApkVersion(apkPath) + if apkPackageVersion[0].upper() == "V": + package = list(apkPackageVersion) + package.pop(0) + apkPackageVersion = "".join(package) + apkChineseLabel = GetApkChineseLabel(apkPath) + apkActivityName = GetApkActivityName(apkPath) + iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew) + debControl = '''Package: {} +Version: {} +Architecture: all +Maintainer: {} +Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1) +Section: utils +Priority: optional +Description: {}\n'''.format(apkPackageNameNew, apkPackageVersion, apkChineseLabel, apkChineseLabel) + debPostinst = '''#!/bin/sh + +APK_DIR="/usr/share/uengine/apk" +APK_NAME="{}" +APK_PATH="$APK_DIR/$APK_NAME" +DESKTOP_FILE="{}" + + +if [ -f $APK_PATH ]; then + echo "Installing $APK_NAME" +else + echo "ERROR: $APK_NAME does not exist." + exit 0 +fi + +session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep` +if test -z "$session_manager"; then + echo "ERROR: app install failed(session-manager is not running)." + sess_dir="/usr/share/uengine/session_install" + if [ ! -d $sess_dir ]; then + mkdir $sess_dir + chmod 777 $sess_dir + fi + apk_name=${{APK_PATH##*/}} + fileName="$sess_dir/$apk_name" + echo $DESKTOP_FILE > $fileName + abistr="" + if test -n "$abistr"; then + abi=`echo $abistr |awk -F \= '{{print $2}}'` + echo $abi >> $fileName + fi + chmod 766 $fileName +fi + +/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH" + +exit 0'''.format(apkPackageNameNew + ".apk", "/usr/share/applications/{}.desktop".format(apkPackageNameNew)) + debPrerm = '''#!/bin/sh + +APP_NAME="{}" +DESKTOP_FILE="{}" + +session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep` +if test -z "$session_manager"; then + echo "ERROR: app uninstall failed(session-manager is not running)." + sess_dir="/usr/share/uengine/session_uninstall" + if [ ! -d $sess_dir ]; then + mkdir $sess_dir + chmod 777 $sess_dir + fi + fileName="$sess_dir/$APP_NAME" + echo $DESKTOP_FILE > $fileName + chmod 766 $fileName +fi + +echo "Uninstalling $APP_NAME" +/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME" + +exit 0'''.format(apkPackageName, "/usr/share/applications/{}.desktop".format(apkPackageNameNew)) + desktopFile = '''[Desktop Entry] +Categories=Other; +Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} +Icon=/usr/share/uengine/icons/{}.png +Terminal=false +Type=Application +GenericName={} +Name={} +''' + #self.RunCommandShow("echo '{}' > '{}/DEBIAN/control'".format(debControl, tempPath)) + self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/control'".format(tempPath)) + write_txt("{}/DEBIAN/control".format(tempPath), debControl) + self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/postinst'".format(tempPath)) + write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst) + self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath)) + write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm) + self.RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageNameNew)) + #write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), desktopFile) + BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew), + "{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew)) + self.RunCommandShow("echo '复制文件'") + self.RunCommandShow("echo '写入 APK 软件图标'") + SaveApkIcon(apkPath, iconSavePath) + self.RunCommandShow("echo '复制 APK 文件'") + self.RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew)) + self.RunCommandShow("echo '正在设置文件权限……'") + self.RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath)) + self.RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath)) + self.RunCommandShow("echo '打包 deb 到桌面……'") + self.RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, apkPackageVersion)) + self.RunCommandShow("echo '正在删除临时目录……'") + self.RunCommandShow("rm -rfv '{}'".format(tempPath)) + self.RunCommandShow("echo '完成!'") + findApkHistory.append(apkPath) + self.labelChange.emit("") + write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + DisabledAndEnbled(False) + self.tips.emit("打包完成") + + except: + DisabledAndEnbled(False) + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + +def TipsMessagebox(tips): + QtWidgets.QMessageBox.information(widget, "提示", tips) + +def ChangeItems(self): + combobox1.clear() + combobox1.addItems(findApkHistory) + #combobox1.setEditText("") + +def DisabledAndEnbled(choose): + combobox1.setDisabled(choose) + check.setDisabled(choose) + button2.setDisabled(choose) + button3.setDisabled(choose) + +# 重启本应用程序 +def ReStartProgram(): + python = sys.executable + os.execl(python, python, * sys.argv) + +def GetCommandReturn(command): + return subprocess.getoutput(command) + +# 获取用户主目录 +def get_home(): + return os.path.expanduser('~') + +# 获取当前语言 +def get_now_lang()->"获取当前语言": + return os.getenv('LANG') + +# 获取用户桌面目录 +def get_desktop_path(): + for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件 + desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1 + if desktop_index != -1: # 如果有对应项 + break # 结束循环 + if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1 + return -1 + else: + get = line[17:-2] # 截取桌面目录路径 + get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容 + if get != -1: # 如果有 + get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~) + return get # 返回目录 + +# 数组转字典 +def ListToDictionary(list): + dictionary = {} + for i in range(len(list)): + dictionary[i] = list[i] + return dictionary + +# 读取文本文档 +def readtxt(path): + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +# 写入文本文档 +def write_txt(path, things): + file = open(path, 'w', encoding='UTF-8') # 设置文件对象 + file.write(things) # 写入文本 + file.close() # 关闭文本对象 + +def GetApkInformation(apkFilePath): + return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath)) + +def GetApkActivityName(apkFilePath): + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "launchable-activity" in line: + line = line[0: line.index("label='")] + line = line.replace("launchable-activity: ", "") + line = line.replace("'", "") + line = line.replace(" ", "") + line = line.replace("name=", "") + line = line.replace("label=", "") + line = line.replace("icon=", "") + return line + +def GetApkPackageName(apkFilePath, setting): + # 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数 + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "package:" in line: + line = line[0: line.index("versionCode='")] + line = line.replace("package:", "") + line = line.replace("name=", "") + line = line.replace("'", "") + line = line.replace(" ", "") + # 此较为特殊,因为需要判断用户是否要添加前缀 + if setting: + return "uengine-dc-{}".format(line) + return line + +def GetApkVersion(apkFilePath): + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "package:" in line: + if "compileSdkVersion='" in line: + line = line.replace(line[line.index("compileSdkVersion='"): -1], "") + if "platform" in line: + line = line.replace(line[line.index("platform"): -1], "") + line = line.replace(line[0: line.index("versionName='")], "") + line = line.replace("versionName='", "") + line = line.replace("'", "") + line = line.replace(" ", "") + return line + +def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath): + if showName == "" or showName == None: + showName = "未知应用" + things = ''' + [Desktop Entry] +Categories=app; +Encoding=UTF-8 +Exec=/usr/bin/uengine launch --action=android.intent.action.MAIN --package={} --component={} +GenericName={} +Icon={} +MimeType= +Name={} +StartupWMClass={} +Terminal=false +Type=Application +'''.format(packageName, activityName, showName, iconPath, showName, showName) + write_txt(savePath, things) + +def GetApkChineseLabel(apkFilePath): + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "application-label:" in line: + line = line.replace("application-label:", "") + line = line.replace("'", "") + return line + +#合并两个函数到一起 +def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": + try: + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "application:" in line: + xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'","") + if xmlpath.endswith('.xml'): + xmlsave = getsavexml() + print(xmlpath) + xmlsave.savexml(apkFilePath,xmlpath,iconSavePath) + else: + zip = zipfile.ZipFile(apkFilePath) + iconData = zip.read(xmlpath) + with open(iconSavePath, 'w+b') as saveIconFile: + saveIconFile.write(iconData) + return + print("Show defult icon") + shutil.copy(programPath + "/defult.png", iconSavePath) + except: + traceback.print_exc() + print("Error, show defult icon") + shutil.copy(programPath + "/defult.png", iconSavePath) + +def TextboxAddText1(message): + global textbox1 + textbox1.append(message) + +# 获取用户桌面目录 +def get_desktop_path(): + for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件 + desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1 + if desktop_index != -1: # 如果有对应项 + break # 结束循环 + if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1 + return -1 + else: + get = line[17:-2] # 截取桌面目录路径 + get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容 + if get != -1: # 如果有 + get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~) + return get # 返回目录 + +# 获取用户主目录 +def get_home(): + return os.path.expanduser('~') + +########################### +# 程序信息 +########################### +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +lang = get_now_lang() +langFile = json.loads(readtxt(programPath + "/Language.json")) +if not lang in langFile.keys(): + lang = "en_US.UTF-8" +information = json.loads(readtxt(programPath + "/information.json")) +version = information["Version"] +title = "{} {}".format(langFile[lang]["Uengine Apk Builder"]["Title"], version) +iconPath = "{}/builer.svg".format(os.path.split(os.path.realpath(__file__))[0]) + +########################### +# 加载配置 +########################### +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/FindApkBuildHistory.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", json.dumps({})) # 创建配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuild.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": "~"})) # 创建配置文件 + +########################### +# 设置变量 +########################### +findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json")).values()) + +########################### +# 窗口创建 +########################### +app = QtWidgets.QApplication(sys.argv) +# 权重 +size = QtWidgets.QSizePolicy() +size.setHorizontalPolicy(0) +widgetSize = QtWidgets.QSizePolicy() +widgetSize.setVerticalPolicy(0) +# +window = QtWidgets.QMainWindow() +widget = QtWidgets.QWidget() +widgetLayout = QtWidgets.QGridLayout() +combobox1 = QtWidgets.QComboBox() +label1 = QtWidgets.QLabel(langFile[lang]["Uengine Apk Builder"]["label1"]) +button2 = QtWidgets.QPushButton(langFile[lang]["Uengine Apk Builder"]["button2"]) +button3 = QtWidgets.QPushButton(langFile[lang]["Uengine Apk Builder"]["button3"]) +textbox1 = QtWidgets.QTextBrowser() +frame2 = QtWidgets.QHBoxLayout() +check = QtWidgets.QCheckBox(langFile[lang]["Uengine Apk Builder"]["check"]) +label1.setSizePolicy(size) +button2.setSizePolicy(size) +check.setSizePolicy(size) +button3.setSizePolicy(size) +combobox1.setEditable(True) +combobox1.addItems(findApkHistory) +combobox1.setEditText("") +button2.clicked.connect(FindApk) +button3.clicked.connect(BuildDeb) +widgetLayout.addWidget(label1, 0, 0, 1, 1) +widgetLayout.addWidget(combobox1, 0, 1, 1, 1) +widgetLayout.addWidget(button2, 0, 2, 1, 1) +widgetLayout.addLayout(frame2, 1, 0, 1, 3) +widgetLayout.addWidget(textbox1, 2, 0, 1, 3) +# 菜单栏 +menu = window.menuBar() +programmenu = menu.addMenu(langFile[lang]["Uengine Apk Builder"]["Menu"][0]["Name"]) +exitProgram = QtWidgets.QAction(langFile[lang]["Uengine Apk Builder"]["Menu"][0]["Menu"][0]) +exitProgram.triggered.connect(window.close) +programmenu.addAction(exitProgram) +# +frame2.addWidget(check) +frame2.addWidget(button3) +widget.setLayout(widgetLayout) +window.setWindowTitle(title) +window.setCentralWidget(widget) +window.setWindowIcon(QtGui.QIcon(iconPath)) +window.resize(window.frameSize().width() * 1.3, window.frameSize().height() * 1.1) +window.show() +sys.exit(app.exec_()) +# 读取主题 +try: + theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0")) +except: + print("主题读取错误,默认使用浅色主题") + theme = True +if theme: + win = tk.Tk() + themes = ttkthemes.ThemedStyle(win) + themes.set_theme("breeze") +else: + import ttkbootstrap + style = ttkbootstrap.Style(theme="darkly") + win = style.master # 创建窗口 + +qianZhui = tk.BooleanVar() + +window = ttk.Frame(win) +frame2 = ttk.Frame(window) +label1 = ttk.Label(window, text=langFile[lang]["Uengine Apk Builder"]["label1"]) +combobox1 = ttk.Combobox(window, width=100) +button2 = ttk.Button(window, text=langFile[lang]["Uengine Apk Builder"]["button2"], command=FindApk) +button3 = ttk.Button(frame2, text=langFile[lang]["Uengine Apk Builder"]["button3"], command=BuildDeb) +check = ttk.Checkbutton(frame2, variable=qianZhui,text=langFile[lang]["Uengine Apk Builder"]["check"]) +textbox1 = tk.Text(window, width=100) +menu = tk.Menu(window, background="white") # 设置菜单栏 +programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏 + +menu.add_cascade(label=langFile[lang]["Uengine Apk Builder"]["Menu"][0]["Name"], menu=programmenu) +programmenu.add_command(label=langFile[lang]["Uengine Apk Builder"]["Menu"][0]["Menu"][0], command=window.quit) # 设置“退出程序”项 +# 设置控件 +combobox1['value'] = findApkHistory +textbox1.configure(state=tk.DISABLED) +textbox1.config(foreground='white', background='black') +# 如果有参数 +if len(sys.argv) > 1: + combobox1.set(sys.argv[1]) +# 设置窗口 +win.title(title) +win.resizable(0, 0) +win.iconphoto(False, tk.PhotoImage(file=iconPath)) +# +win.config(menu=menu) # 显示菜单栏 +label1.grid(row=2, column=0) +combobox1.grid(row=2, column=1) +button2.grid(row=2, column=2) +button3.grid(row=0, column=1) +check.grid(row=0, column=0) +frame2.grid(row=3, columnspa=3) +textbox1.grid(row=4, columnspa=3) +window.pack() +win.mainloop() \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install new file mode 100755 index 0000000..120467c --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +import os +import sys +if len(sys.argv) > 1: + if sys.argv[1] == "--help": + print("帮助:") + print("uengine-app-install apk路径") + sys.exit(0) + sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(sys.argv[1]))) +print("命令参数错误") +sys.exit(1) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall new file mode 100755 index 0000000..452bfc9 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +import os +import sys +if len(sys.argv) > 1: + if sys.argv[1] == "--help": + print("帮助:") + print("uengine-app-uninstall apk包名") + sys.exit(0) + sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(sys.argv[1]))) +print("命令参数错误") +sys.exit(1) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean new file mode 100755 index 0000000..98543e0 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +import os +import sys +if len(sys.argv) > 1: + if sys.argv[1] == "--help": + print("帮助:") + print("输入命令即可清空/重置UEngine") + sys.exit(0) + print("参数错误") + sys.exit(1) +sys.exit(os.system("sudo rm -rf /data/uengine")) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer new file mode 100755 index 0000000..2eacf87 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer @@ -0,0 +1,36 @@ +#/bin/bash +is_tar_checked="0" +rm -rf /tmp/uengine +until [ "$is_tar_checked" = "1" ];do +echo "请拖入uengine.tar.xz并回车确认,可在 https://cowtransfer.com/s/44656ada129e42 下载获取。" +read tar_path +tar_path=`echo "$tar_path" | sed $'s/\'//g'` +echo "路径为 $tar_path" +tar_md5sum=`md5sum $tar_path` +tar_md5sum=`echo ${tar_md5sum%%/*}` + +if [ "$tar_md5sum" = "b8429c4d8bfd507b9dc4547e0b71c962" ];then +is_tar_checked="1" +else +echo $tar_md5sum +echo "md5完整性检查失败,请检查是否是这个文件" +sleep 3 +reset +fi +done + +echo "完整性检查通过,开始部署。部署过程会需要root权限,完成后会要求重启。请注意不要在安装过程中安装或卸载其他软件" +cd /tmp +tar -xf "$tar_path" +mkdir -p $HOME/uengine +mkdir -p $HOME/uengine-launch +cp /tmp/uengine/run_daemon.sh $HOME/uengine-launch +cp /tmp/uengine/launch_uengine.sh $HOME/uengine-launch +cd /tmp/uengine +/tmp/uengine/install.sh +sudo apt install -y libkf5globalaccel5 libqt5multimedia5 libqt5sensors5 libegl1-mesa-dev +echo "重启后在$HOME/uengine-launch执行launch_uengine.sh即可打开uengine守护进程。随后即可安装和使用安卓应用" +echo "你需要在每次启动安卓应用之前打开这个脚本。打开后可安全关闭" +echo "按回车重启" +read +reboot diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard new file mode 100755 index 0000000..eaf54a7 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard @@ -0,0 +1,241 @@ +#!/usr/bin/env python3 +############################################################### +# 版本:1.8.0 +# 更新时间:2022年07月26日 +# Need: unix, python3-tk, python3-pip, pymouse, keyboard +############################################################### +import os +import sys +import time +import json +import shutil +import keyboard +import traceback +import ttkthemes +import pyautogui +import threading +import tkinter as tk +import tkinter.ttk as ttk +import tkinter.messagebox as messagebox +import tkinter.filedialog as filedialog +######################## +# +######################## +def Inputt(key): + if key.event_type == "up": + global setting + if setting: + Setting(key) + else: + Mouse(key) + +def Open(): + path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]]) + if not path == "" or path == (): + shutil.copy(path, get_home() + "/.config/uengine-keyboard/key.json") + if messagebox.askyesno(title="提示", message="导入成功!是否现在重启程序以便生效?"): + ReStartProgram() + +def Save(): + path = filedialog.asksaveasfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]]) + if not path == "" or path == (): + shutil.copy(get_home() + "/.config/uengine-keyboard/key.json", path) + messagebox.showinfo(title="提示", message="导出成功!") + +# 重启本应用程序 +def ReStartProgram()->"重启本应用程序": + python = sys.executable + os.execl(python, python, * sys.argv) + + +def Mouse(key): + print(keybo) + if keybo.__contains__(key.name): + print(keybo[key.name]["MousePlace"]) + pyautogui.FAILSAFE = False + try: + print((keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])) + pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]) + + except: + traceback.print_exc() + +def Setting(key): + if key.event_type == 'up': + keybo[key.name] = {"Mouse": "Left", "MousePlace": pyautogui.position()} + write_txt("{}/.config/uengine-keyboard/key.json".format(get_home()), json.dumps(keybo)) + global inputs + inputs = True + global setting + setting = False + return False + +def ShowTips(): + global close + try: + if setting: + settingLabelText.set('''设置方法:把鼠标移动带所需位置然后按下需要设置的按键即可({}x{}) +提示: +1、目前不支持同时按两个及以上按键,只支持在单一时间内按一个按键; +2、使用映射不能关闭本窗口,但可以最小化; +3、本程序需要 root 权限才能使用; +4、映射时会占用鼠标,所以在使用时最好不要使用鼠标;'''.format(pyautogui.position()[0], pyautogui.position()[1])) + settingButton.configure(state=tk.DISABLED) + else: + settingLabelText.set('''点击“设置”按钮设置映射({}x{}) +提示: +1、目前不支持同时按两个及以上按键,只支持在单一时间内按一个按键; +2、使用映射不能关闭本窗口,但可以最小化; +3、本程序需要 root 权限才能使用; +4、映射时会占用鼠标,所以在使用时最好不要使用鼠标;'''.format(pyautogui.position()[0], pyautogui.position()[1])) + settingButton.configure(state=tk.NORMAL) + time.sleep(0.1) + if not close: + ShowTips() + except: + traceback.print_exc() + print(close) + if not close: + ShowTips() + +def Closing(): + global close + close = True + # 偷懒了,直接强制关闭进程 + os.system(f"kill {os.getpid()}") + + +def Key(): + keyboard.hook(Inputt) + +# 获取用户主目录 +def get_home()->"获取用户主目录": + return os.path.expanduser('~') + +# 写入文本文档 +def write_txt(path: "路径", things: "内容")->"写入文本文档": + file = open(path, 'w', encoding='UTF-8') # 设置文件对象 + file.write(things) # 写入文本 + file.close() # 关闭文本对象 + +# 读取文本文档 +def readtxt(path: "路径")->"读取文本文档": + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +def Settings(): + global setting + setting = True + +def Clean(): + if messagebox.askokcancel(title="提示", message="你确定要删除吗?"): + shutil.rmtree("{}/.config/uengine-keyboard".format(get_home())) + if messagebox.askyesno(title="提示", message="删除成功!是否现在重启程序以便生效?"): + ReStartProgram() + +def About(): + threading.Thread(target=os.system, args=["{}/uengine-runner-about".format(programPath)]).start() + +lock = False +def ThreadCheck(): + global lock + lock = True + pyautogui.position() + lock = False + +def RestartProgramTimer(): + threading.Thread(target=ThreadCheck).start() + time.sleep(0.1) + if lock: + ReStartProgram() + RestartProgramTimer() + +################### +# +################### +if not os.path.exists("{}/.config/uengine-keyboard".format(get_home())): + os.mkdir("{}/.config/uengine-keyboard".format(get_home())) +if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home())): + write_txt("{}/.config/uengine-keyboard/key.json".format(get_home()), "{}") + +################### +# +################### +setting = False +close = False +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) +keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home()))) +version = json.loads(readtxt("{}/information.json".format(programPath)))["Version"] +pyautogui.PAUSE = 0 + +################### +# 判断是不是 root +################### +if os.geteuid() != 0: + print("不是以 root 权限运行本程序!") + root = tk.Tk() + root.overrideredirect(1) + root.withdraw() + messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!") + sys.exit(1) + +################### +# +################### +window = tk.Tk() +win = ttk.Frame(window) +show = ttk.Frame(win) + +settingLabelText = tk.StringVar() + +# 设置菜单栏 +menu = tk.Menu(window, tearoff=0, background="white") +programMenu = tk.Menu(menu, tearoff=0, background="white") +aboutMenu = tk.Menu(menu, tearoff=0, background="white") + +settingLabel = ttk.Label(win, textvariable=settingLabelText) + +settingMouseToKeyboard = ttk.Button(show, text="启动键盘映射(已启用)") +settingButton = ttk.Button(show, text="添加或覆盖键盘映射设置", command=Settings) + +settingMouseToKeyboard.configure(state=tk.DISABLED) + +style = ttkthemes.ThemedStyle(window) +style.set_theme("breeze") +window.protocol('WM_DELETE_WINDOW', Closing) +window.resizable(0, 0) +window.iconphoto(False, tk.PhotoImage(file=iconPath)) +window.title("UEngine 键盘映射 {}".format(version)) + +menu.add_cascade(label="程序", menu=programMenu) +menu.add_cascade(label="帮助", menu=aboutMenu) +menu.configure(activebackground="dodgerblue") + +programMenu.add_command(label="导入映射设置", command=Open) +programMenu.add_command(label="导出映射设置", command=Save) +programMenu.add_command(label="删除所有映射设置", command=Clean) +programMenu.add_separator() +programMenu.add_command(label="退出程序", command=sys.exit) +programMenu.configure(activebackground="dodgerblue") + +aboutMenu.add_command(label="关于", command=About) + +window.config(menu=menu) # 显示菜单栏 + +show.grid(row=1, column=0) + +settingLabel.grid(row=0, column=0) + +settingMouseToKeyboard.grid(row=0, column=0) +settingButton.grid(row=0, column=1) + +win.pack(fill="both", expand="yes") +keys = threading.Thread(target=Key) +keys.start() +threading.Thread(target=ShowTips).start() +pyautogui.FAILSAFE = False +threading.Thread(target=RestartProgramTimer).start() +window.mainloop() \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/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/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner new file mode 100755 index 0000000..5a65185 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner @@ -0,0 +1,1926 @@ +#!/usr/bin/env python3 +# 使用系统默认的 python3 运行 +########################################################################################### +# 作者:gfdgd xi<3025613752@qq.com> +# 版本:1.8.0 +# 更新时间:2022年07月25日 +# 感谢:anbox、deepin 和 UOS +# 基于 Python3 的 PyQt5 构建 +# 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>、为什么您不喜欢熊出没和阿布呢 +########################################################################################### +################# +# 引入所需的库 +################# +import os +import api +import sys +import time +import json +import numpy +import shutil +import zipfile +import requests +import traceback +import threading +import webbrowser +import subprocess +import matplotlib +import matplotlib.figure +import matplotlib.pylab +import matplotlib.font_manager +import PyQt5.QtGui as QtGui +import PyQt5.QtCore as QtCore +import PyQt5.QtWidgets as QtWidgets +from getxmlimg import getsavexml + +class UninstallProgram(QtCore.QThread): + info = QtCore.pyqtSignal(str) + error = QtCore.pyqtSignal(str) + combo = QtCore.pyqtSignal(int) + + def __init__(self, package) -> None: + self.package = package + super().__init__() + + def run(self): + package = self.package + try: + global fineUninstallApkHistory + Return = os.system("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package)) + print(Return) + if Return != 0: + 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(get_desktop_path(), package)): + os.remove("{}/{}.desktop".format(get_desktop_path(), package)) + findApkHistory.append(ComboInstallPath.currentText()) + self.combo.emit(0) + write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + self.info.emit("操作执行完毕!") + DisabledAndEnbled(False) + except: + traceback.print_exc() + self.error.emit(traceback.format_exc()) + DisabledAndEnbled(False) +# 卸载程序 +#def UninstallProgram(package: "apk 包名")->"卸载程序": +# pass + +# 卸载按钮事件 +def ButtonClick8(): + if ComboInstallPath.currentText() is "": + QtWidgets.QMessageBox.information(widget, "提示", langFile[lang]["Main"]["MainWindow"]["Error"]["UninstallError"]) + return + DisabledAndEnbled(True) + if os.path.exists(ComboInstallPath.currentText()): + path = GetApkPackageName(ComboInstallPath.currentText()) + else: + path = ComboInstallPath.currentText() + print(path) + QT.installRun = UninstallProgram(path) + QT.installRun.error.connect(ErrorBox) + QT.installRun.info.connect(InformationBox) + QT.installRun.combo.connect(UpdateCombobox) + QT.installRun.start() + #threading.Thread(target=UninstallProgram, args=[path]).start() + +# 浏览窗口 +temppath="" +def FindApk()->"浏览窗口": + path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 Apk", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApk.json"))["path"], "APK 文件(*.apk);;所有文件(*.*)")[0] + global temppath + temppath = path + print("apk path is find:" + path) + if path != "" and path != "()": + try: + ComboInstallPath.setEditText(path) + write_txt(get_home() + "/.config/uengine-runner/FindApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 + except: + pass + +class QT: + installRun = None + +# 安装按钮事件 +def Button3Install(): + if ComboInstallPath.currentText() is "" or not os.path.exists(ComboInstallPath.currentText()): + QtWidgets.QMessageBox.information(widget, "提示", langFile[lang]["Main"]["MainWindow"]["Error"]["InstallError"]) + return + DisabledAndEnbled(True) + #threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start() + QT.installRun = InstallApk(ComboInstallPath.currentText()) + QT.installRun.infor.connect(InformationBox) + QT.installRun.error.connect(ErrorBox) + QT.installRun.combo.connect(UpdateCombobox) + QT.installRun.make.connect(InstallBuildDesktop) + QT.installRun.start() + +# 安装应用 +class InstallApk(QtCore.QThread): + infor = QtCore.pyqtSignal(str) + error = QtCore.pyqtSignal(str) + combo = QtCore.pyqtSignal(int) + make = QtCore.pyqtSignal(str) + + def __init__(self, path, quit = False) -> None: + self.path = path + self.quit = quit + super().__init__() + + def run(self): + path = self.path + quit = self.quit + 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())): + print("Mkdir") + os.makedirs("{}/.local/share/applications/uengine/".format(get_home())) + # 读取设置 + setting = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) + # 安装应用 + print("start install apk") + global findApkHistory + print("start install apk12") + iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path)) + tempstr1 = iconSavePath + print("start install apk1") + iconSaveDir = os.path.dirname(iconSavePath) + if not os.path.exists(iconSaveDir): + os.makedirs(iconSaveDir,exist_ok=True) + SaveApkIcon(path, iconSavePath) + try: + if setting["SaveApk"]: + shutil.copy(path, "/tmp/uengine-runner/bak.apk") + except: + if QtWidgets.QMessageBox.critical(widget, "错误", "无法备份安装包,是否不备份安装包继续安装?\n提示:新版UEngine安装后会自动删除安装包") == QtWidgets.QMessageBox.No: + DisabledAndEnbled(False) + return + setting["SaveApk"] = False + print("start install apk2") + commandReturn = os.system("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path)) + try: + if setting["SaveApk"]: + shutil.copy("/tmp/uengine-runner/bak.apk", path) + except: + self.error.emit(langFile[lang]["Main"]["MainWindow"]["Error"]["BackApkError"]) + if commandReturn != 0: + self.error.emit("疑似 APK 安装失败,请检查 UEngine 是否正常安装、运行以及 APK 文件是否正确、完整") + DisabledAndEnbled(False) + return + if settingConf["AutoScreenConfig"]: + # 计算最合适的大小 + # 竖屏 + screen = QtGui.QGuiApplication.primaryScreen() + mm = screen.availableGeometry() + verticalHeighe = int(mm.height() * 0.9) # 竖屏高 + verticalWidth = int(verticalHeighe / 16 * 9) # 竖屏宽 + horizontaltWidth = int(mm.width() * 0.8) # 横屏宽 + horizontaltHeighe = int(horizontaltWidth / 16 * 9) # 横屏高 + + #verticalHeighe = + write_txt(f"/tmp/{GetApkPackageName(path)}.txt", f"""verticalWidth {verticalWidth} //竖屏宽 +verticalHeighe {verticalHeighe} //竖屏高 +horizontaltWidth {horizontaltWidth} //横屏宽,备选为1280 +horizontaltHeighe {horizontaltHeighe} //横屏高 ,备选为720 +verticalScreen 1 //设置默认横屏还是竖屏,1为竖屏,0为横屏 +allowFullScreen 1 //设置是否允许全屏,1为允许,0为不允许 +allowScreenSwitching 1 //设置是否允许横竖屏切换,1为允许,0为不允许 +defaultFullScreen 0 //设置是否默认显示最大化,1为默认最大化,0为不是 + +logicalDensityDpi 160 +physicalDpi 72 +appWidth {verticalWidth} +appHeight {verticalHeighe} +logicalWidth {verticalWidth} +logicalHeight {verticalHeighe} +""") + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -a {GetApkPackageName(path)}"): + self.error.emit("屏幕配置设置失败") + DisabledAndEnbled(False) + return + if settingConf["ChooseProgramType"]: + self.make.emit(iconSavePath) + else: + BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, + "{}/{}.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))) + print("\nprint install complete") + if quit: + return + findApkHistory.append(ComboInstallPath.currentText()) + self.combo.emit(0) + write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + self.infor.emit("操作完成!") + except: + traceback.print_exc() + self.error.emit(traceback.format_exc()) + DisabledAndEnbled(False) + +def InstallBuildDesktop(iconSavePath): + choose = QtWidgets.QInputDialog.getItem(widget, "提示", "请选择分类,如果点击取消,将会设置为默认的分类", ["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility"])[0] + path = ComboInstallPath.currentText() + BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), 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) + print("\nprint install complete") + +def UpdateCombobox(tmp): + ComboInstallPath.clear() + ComboInstallPath.addItems(findApkHistory) + ComboInstallPath.setEditText(findApkHistory[-1]) + +def ErrorBox(error): + QtWidgets.QMessageBox.critical(widget, "错误", error) + +def InformationBox(info): + QtWidgets.QMessageBox.information(widget, "提示", info) + +# 禁用或启动所有控件 +def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控件": + ComboInstallPath.setDisabled(choose) + #ComboUninstallPath.configure(state=a) + BtnFindApk.setDisabled(choose) + BtnInstall.setDisabled(choose) + BtnShowUengineApp.setDisabled(choose) + #BtnUninstallApkBrowser.configure(state=a) + BtnUninstall.setDisabled(choose) + Btngeticon.setDisabled(choose) + BtnSaveApk.setDisabled(choose) + BtnApkInformation.setDisabled(choose) + LabApkPath.setDisabled(choose) + +# 需引入 subprocess +# 运行系统命令并获取返回值 +def GetCommandReturn(cmd: "命令")->"运行系统命令并获取返回值": + # cmd 是要获取输出的命令 + return subprocess.getoutput(cmd) + +def GetSystemVersion(): + systemInformation = readtxt("/etc/os-release") + for systemInformation in systemInformation.split('\n'): + if "PRETTY_NAME=" in systemInformation: + return systemInformation.replace("PRETTY_NAME=", "").replace('"', '') + +# 打开所有窗口事件 +def Button5Click(): + threading.Thread(target=OpenUengineProgramList).start() + +# 打开“uengine 所有程序列表” +def OpenUengineProgramList()->"打开“uengine 所有程序列表”": + os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") + +# 打开程序官网 +def OpenProgramURL()->"打开程序官网": + webbrowser.open_new_tab(programUrl) + +# 重启本应用程序 +def ReStartProgram()->"重启本应用程序": + python = sys.executable + os.execl(python, python, * sys.argv) + +# 清理历史记录 +def CleanProgramHistory()->"清理历史记录": + try: + if QtWidgets.QMessageBox.warning(widget, "警告", "删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Ok: + shutil.rmtree(get_home() + "/.config/uengine-runner") + ReStartProgram() + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + +# 获取用户主目录 +def get_home()->"获取用户主目录": + return os.path.expanduser('~') + +# 获取当前语言 +def get_now_lang()->"获取当前语言": + return os.getenv('LANG') + +# 发送“启动 uengine 所有程序”的 .desktop 文件到桌面 +def SendUengineAndroidListForDesktop()->"发送“启动 uengine 所有程序”的 .desktop 文件到桌面": + global desktop + global desktopName + DisabledAndEnbled(True) + try: + if os.path.exists("{}/{}".format(get_desktop_path(), desktopName)): + if QtWidgets.QMessageBox.question(widget, "提示", "桌面已经存在快捷方式,你确定要覆盖吗?") == QtWidgets.QMessageBox.No: + DisabledAndEnbled(False) + return + shutil.copy(desktop, get_desktop_path()) + QtWidgets.QMessageBox.critical(widget, "提示", "发送成功!") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + DisabledAndEnbled(False) + +# 获取用户桌面目录 +def get_desktop_path()->"获取用户桌面目录": + for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件 + desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1 + if desktop_index != -1: # 如果有对应项 + break # 结束循环 + if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1 + return -1 + else: + get = line[17:-2] # 截取桌面目录路径 + get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容 + if get != -1: # 如果有 + get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~) + return get # 返回目录 + +# 发送“启动 uengine 所有程序”的 .desktop 文件到启动器 +def SendUengineAndroidListForLauncher()->"发送“启动 uengine 所有程序”的 .desktop 文件到启动器": + DisabledAndEnbled(True) + try: + if os.path.exists("{}/.local/share/applications/{}".format(get_home(), desktopName)): + if QtWidgets.QMessageBox.question(widget, "提示", "启动器已经存在快捷方式,你确定要覆盖吗?") == QtWidgets.QMessageBox.No: + DisabledAndEnbled(False) + return + if not os.path.exists("{}/.local/share/applications/".format(get_home())): + os.makedirs("{}/.local/share/applications/".format(get_home())) + shutil.copy(desktop, "{}/.local/share/applications/{}".format(get_home(), desktopName)) + os.system("chmod 755 {}/.local/share/applications/{}".format(get_home(), desktopName)) + QtWidgets.QMessageBox.critical(widget, "提示", "发送成功!") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + DisabledAndEnbled(False) + +# 数组转字典 +def ListToDictionary(list: "需要转换的数组")->"数组转字典": + dictionary = {} + for i in range(len(list)): + dictionary[i] = list[i] + return dictionary + +# 读取文本文档 +def readtxt(path: "路径")->"读取文本文档": + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +# 写入文本文档 +def write_txt(path: "路径", things: "内容")->"写入文本文档": + TxtDir = os.path.dirname(path) + print(TxtDir) + if not os.path.exists(TxtDir): + os.makedirs(TxtDir,exist_ok=True) + file = open(path, 'w', encoding='UTF-8') # 设置文件对象 + file.write(things) # 写入文本 + file.close() # 关闭文本对象 + +# 获取 aapt 的所有信息 +def GetApkInformation(apkFilePath: "apk 所在路径")->"获取 aapt 的所有信息": + return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath)) + +# 获取 apk Activity +def GetApkActivityName(apkFilePath: "apk 所在路径")->"获取 apk Activity": + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "launchable-activity" in line: + line = line[0: line.index("label='")] + line = line.replace("launchable-activity: ", "") + line = line.replace("'", "") + line = line.replace(" ", "") + line = line.replace("name=", "") + line = line.replace("label=", "") + line = line.replace("icon=", "") + return line + +# 获取 apk 包名 +def GetApkPackageName(apkFilePath: "apk 所在路径")->"获取 apk 包名": + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "package:" in line: + line = line[0: line.index("versionCode='")] + line = line.replace("package:", "") + line = line.replace("name=", "") + line = line.replace("'", "") + line = line.replace(" ", "") + return line + +def InstallRootUengineImage(): + if not os.path.exists: + os.mkdir("/tmp/uengine-runner") + write_txt("/tmp/uengine-runner/install.sh", "sudo dpkg -i /tmp/uengine-runner/u*.deb\nsudo apt install -f") + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"wget -P '/tmp/uengine-runner' 'https://hub.fastgit.xyz/gfdgd-xi/uengine-runner/releases/download/U1.2.15/uengine-android-image_1.2.15_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'\""]).start() + +def UengineUbuntuInstall(): + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath + '/uengine-installer'}'\""]).start() + +def UbuntuInstallUengine(): + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath + '/uengine-installer'}'\""]).start() + +def BuildRootUengineImage(): + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath}/root-uengine.sh'\""]).start() + +def ReinstallUengineImage(): + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e ''pkexec apt reinstall uengine-android-image -y"]).start() + +# 生成 uengine 启动文件到桌面 +def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径", choose="")->"生成 uengine 启动文件到桌面": + if showName == "" or showName == None: + showName = "未知应用" + if choose != "": + things = f'''[Desktop Entry] +Encoding=UTF-8 +Exec=uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName} +GenericName={showName} +Icon={iconPath} +MimeType= +Name={showName} +StartupWMClass={showName} +Categories={choose}; +Terminal=false +Type=Application +''' + else: + things = f'''[Desktop Entry] +Categories=app; +Encoding=UTF-8 +Exec=uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName} +GenericName={showName} +Icon={iconPath} +MimeType= +Name={showName} +StartupWMClass={showName} +Terminal=false +Type=Application +''' + write_txt(savePath, things) + +# 获取软件的中文名称 +def GetApkChineseLabel(apkFilePath)->"获取软件的中文名称": + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "application-label:" in line: + line = line.replace("application-label:", "") + line = line.replace("'", "") + return line + +# 保存apk图标 +def SaveApkIcon(apkFilePath, iconSavePath)->"保存 apk 文件的图标": + try: + if os.path.exists(iconSavePath): + os.remove(iconSavePath) + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "application:" in line: + xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'","") + if xmlpath.endswith('.xml'): + xmlsave = getsavexml() + print(xmlpath) + xmlsave.savexml(apkFilePath,xmlpath,iconSavePath) + return + else: + zip = zipfile.ZipFile(apkFilePath) + iconData = zip.read(xmlpath) + with open(iconSavePath, 'w+b') as saveIconFile: + saveIconFile.write(iconData) + return + print("None Icon! Show defult icon") + shutil.copy(programPath + "/defult.png", iconSavePath) + except: + traceback.print_exc() + print("Error, show defult icon") + shutil.copy(programPath + "/defult.png", iconSavePath) + +def saveicon(): + global temppath + global tempstr1 + iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(temppath)) + print(iconSavePath+"iconpaths") + SaveApkIcon(temppath, iconSavePath) + +def KeyboardToMouse(): + threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-keyboard".format(programPath)]).start() + +# 用户自行保存 +def SaveIconToOtherPath(): + apkPath = ComboInstallPath.currentText() + if apkPath == "": + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ChooseApkError"]) + return + path = QtWidgets.QFileDialog.getSaveFileName(widget, "保存图标", "icon.png", "PNG 图片(*.png);;所有文件(*.*)", json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApkIcon.json"))["path"])[0] + if not path == "": + try: + SaveApkIcon(apkPath, path) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SaveApkIconError"]) + return + write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 + findApkHistory.append(ComboInstallPath.currentText()) + UpdateCombobox(0) + write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + QtWidgets.QMessageBox.information(widget, "提示", "保存成功!") + +# 清空 uengine 数据 +def BackUengineClean()->"清空 uengine 数据": + print("Choose") + 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())) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"pkexec rm -rfv /data/uengine\"") + return + print("Choose False") + +# 启用 uengine 网络桥接 +def UengineBridgeStart()->"启用 uengine 网络桥接": + DisabledAndEnbled(True) + os.system("pkexec uengine-bridge.sh start") + DisabledAndEnbled(False) + +# 关闭 uengine 网络桥接 +def UengineBridgeStop()->"关闭 uengine 网络桥接": + DisabledAndEnbled(True) + os.system("pkexec uengine-bridge.sh stop") + DisabledAndEnbled(False) + +# 重启 uengine 网络桥接 +def UengineBridgeRestart()->"重启 uengine 网络桥接": + DisabledAndEnbled(True) + os.system("pkexec uengine-bridge.sh restart") + DisabledAndEnbled(False) + +# 加载 uengine 网络桥接 +def UengineBridgeReload()->"加载 uengine 网络桥接": + DisabledAndEnbled(True) + os.system("pkexec uengine-bridge.sh reload") + DisabledAndEnbled(False) + +# 强制加载 uengine 网络桥接 +def UengineBridgeForceReload()->"强制加载 uengine 网络桥接": + DisabledAndEnbled(True) + os.system("pkexec uengine-bridge.sh force-reload") + DisabledAndEnbled(False) + +# 启用 uengine 服务 +def StartUengine()->"启用 uengine 服务": + DisabledAndEnbled(True) + os.system("systemctl enable uengine-container uengine-session && systemctl start uengine-container uengine-session") + DisabledAndEnbled(False) + +# 关闭 uengine 服务 +def StopUengine()->"关闭 uengine 服务": + DisabledAndEnbled(True) + os.system("systemctl disable uengine-container uengine-session") + DisabledAndEnbled(False) + +# 重启 uengine 服务 +def UengineRestart()->"重启 uengine 服务": + DisabledAndEnbled(True) + os.system("systemctl restart uengine*") + DisabledAndEnbled(False) + +def ScrcpyConnectUengine(): + if os.path.exists("/snap/bin/scrcpy"): + threading.Thread(target=os.system, args=["/snap/bin/scrcpy -s '192.168.250.2:5555'"]).start() + return + if QtWidgets.QMessageBox.question(widget, "提示", "你没有安装Scrcpy(指使用Snap安装),\n如果你使用了其他方法安装了Scrcpy,可以输入命令“scrcpy -s '192.168.250.2:5555'”,\n是否现在要使用Snap安装Scrcpy?") == QtWidgets.QMessageBox.Yes: + if not os.path.exists("/tmp/uengine-runner"): + os.makedirs("/tmp/uengine-runner") + write_txt("/tmp/uengine-runner/InstallScrcpy.sh", '''#!/bin/bash +sudo apt install snapd -y +sudo snap refresh +sudo snap install scrcpy''') + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"chmod 777 /tmp/uengine-runner/InstallScrcpy.sh -Rv && pkexec /tmp/uengine-runner/InstallScrcpy.sh\""]).start() + return + +# 获取用户桌面目录 +def get_desktop_path()->"获取用户桌面目录": + for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件 + desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1 + if desktop_index != -1: # 如果有对应项 + break # 结束循环 + if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1 + return -1 + else: + get = line[17:-2] # 截取桌面目录路径 + get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容 + if get != -1: # 如果有 + get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~) + return get # 返回目录 + +# 提取已安装程序的apk +def SaveInstallUengineApp(): + while True: + result = QtWidgets.QInputDialog.getText(widget, "输入 APK 包名", "请输入要获取的apk包名以便进行下一步操作") + if result[1] == False: + return + result = result[0] + if os.path.exists("/data/uengine/data/data/app/{}-1".format(result)): + break + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["PathError"]) + path = QtWidgets.QFileDialog.getSaveFileName(widget, "保存apk", "~", "APK 文件(*.apk);;所有文件(*.*)", json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApk.json"))["path"])[0] + if path == "" or path == (): + return + try: + shutil.copy("/data/uengine/data/data/app/{}-1/base.apk".format(result), path) + write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": os.path.dirname(path)})) + QtWidgets.QMessageBox.information(widget, "提示", "提取完成!") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + +def UengineCheckCpu(): + english = GetCommandReturn("uengine check-features") + QtWidgets.QMessageBox.information(widget, "提示", english) + +# 获取用户主目录 +def get_home()->"获取用户主目录": + return os.path.expanduser('~') + +# 删除所有的 uengine 应用快捷方式 +def CleanAllUengineDesktopLink(): + if QtWidgets.QMessageBox.question(widget, "提示", "你是否要删除所有的 UEngine 应用快捷方式?") == QtWidgets.QMessageBox.No: + try: + shutil.rmtree("{}/.local/share/applications/uengine".format(get_home())) + os.makedirs("{}/.local/share/applications/uengine".format(get_home())) + QtWidgets.QMessageBox.information(widget, "提示", "删除完毕!") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + +# 打开 uengine 应用打包器 +def OpenUengineDebBuilder(): + threading.Thread(target=os.system, args=[programPath + "/uengine-apk-builder"]).start() + +# 打开 uengine 根目录 +def OpenUengineRootData(): + threading.Thread(target=os.system, args=["xdg-open /data/uengine/data/data"]).start() + +# 打开 uengine 用户数据目录 +def OpenUengineUserData(): + threading.Thread(target=os.system, args=["xdg-open ~/安卓应用文件"]).start() + +# 终端显示 adb 命令行 +def AdbShellShowInTer(): + os.system("adb connect 192.168.250.2:5555") + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -w ~ -e 'adb -s 192.168.250.2:5555 shell'"]).start() + +# 终端显示 adb top +def AdbCPUAndRAWShowInTer(): + os.system("adb connect 192.168.250.2:5555") + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -w ~ -e 'adb -s 192.168.250.2:5555 shell top'"]).start() + +def UengineSettingShow(): + threading.Thread(target=os.system, args=["/usr/bin/uengine launch --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start() + +# 杀死 adb 进程 +def AdbKillAdbProgress(): + os.system("killall adb") + QtWidgets.QMessageBox.information(widget, "提示", "完成!") + +# 关闭 adb 服务 +def AdbStopServer(): + os.system("adb kill-server") + QtWidgets.QMessageBox.information(widget, "提示", "完成!") + +# 开启 adb 服务 +def AdbStartServer(): + os.system("adb start-server") + QtWidgets.QMessageBox.information(widget, "提示", "完成!") + +def ReinstallUengine(): + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt reinstall uengine uengine-android-image uengine-modules-dkms -y && notify-send -i uengine \"安装完毕!\"'"]).start() + +def DelUengineCheck(): + if not os.path.exists("/usr/share/uengine/uengine-check-runnable.sh"): + QtWidgets.QMessageBox.information(widget, "提示", "本功能已经被删除,无法重复删除!") + return + if QtWidgets.QMessageBox.warning(widget, "警告", "删除后将无法使用本软件恢复\n如果需要恢复本功能,请重新安装 UEngine!", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Ok) == QtWidgets.QMessageBox.Ok: + threading.Thread(target=os.system, args=["'{programPath}/launch.sh' deepin-terminal -C 'pkexec rm -v /usr/share/uengine/uengine-check-runnable.sh'"]).start() + +# 使用 adb 连接 uengine +def UengineConnectAdb(): + QtWidgets.QMessageBox.information(widget, "提示", subprocess.getoutput("adb connect 192.168.250.2:5555")) + +# 允许用户使用 adb +def UengineUseAdb(): + # 因为需要 root,所以需要开二号程序 + os.system("adb start-server") # 保证有生成文件 + os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath, "{}/.android/adbkey.pub".format(get_home()))) # 写入配置 + if QtWidgets.QMessageBox.question(widget, "提示", "是否要连接到 UEngine?") == QtWidgets.QMessageBox.Yes: + UengineConnectAdb() + +def UengineDoNotUseAdb(): + # 因为需要 root,所以需要开二号程序 + if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"): + QtWidgets.QMessageBox.critical(widget, "提示", "你的 uengine 在设置前已经禁用 adb 连接,无需重复设置") + return + threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 1".format(programPath)]).start() + +def UengineRunnerBugUpload(): + threading.Thread(target=os.system, args=[programPath + "/uengine-runner-update-bug"]).start() + +def AdbConnectDeviceShow(): + ShowTextTipsWindow.ShowWindow(subprocess.getoutput("adb devices -l")) + +def AdbAndroidInstallAppList(): + ShowTextTipsWindow.ShowWindow('''系统应用: +{} +第三方应用: +{} +全部应用以及apk所在路径: +{}'''.format(subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list packages -s"), + subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list package -3"), + subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list packages -f"))) + +def GetApkVersion(apkFilePath): + info = GetApkInformation(apkFilePath) + for line in info.split('\n'): + if "package:" in line: + if "compileSdkVersion='" in line: + line = line.replace(line[line.index("compileSdkVersion='"): -1], "") + if "platform" in line: + line = line.replace(line[line.index("platform"): -1], "") + line = line.replace(line[0: line.index("versionName='")], "") + line = line.replace("versionName='", "") + line = line.replace("'", "") + line = line.replace(" ", "") + return line + +def VersionCheck(version1, version2): + return version1 == version2 + +def ShowHelp(): + webbrowser.open_new_tab(programPath + "/Help/index.html") + +def AllowOrDisallowUpdateAndroidApp(): + if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"): + if QtWidgets.QMessageBox.question(widget, langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], langFile[lang]["Main"]["MainWindow"]["Answer"]["UseAdbPackageAnswer"]) == QtWidgets.QMessageBox.No: + return + os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath,"{}/.android/adbkey.pub".format(get_home()))) # 写入配 + adb = api.Adb("192.168.250.2:5555") + adb.Service.Close() + adb.connect() + if QtWidgets.QMessageBox.question(widget, langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["AllowOrDisallowUpdateAndroidAppAnswer"][int(adb.boolAndroidInstallOtherAppSetting())]) == QtWidgets.QMessageBox.Yes: + adb.setAndroidInstallOtherAppSetting(not adb.boolAndroidInstallOtherAppSetting()) + QtWidgets.QMessageBox.information(widget, langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"]) + +def SetHttpProxy(): + adb = api.Adb("192.168.250.2:5555") + adb.Service.Close() + adb.connect() + if QtWidgets.QMessageBox.question(widget, "提示", "此功能需要安装 adb 补丁,请保证已经安装然后按下“Yes”") == QtWidgets.QMessageBox.No: + return + proxy = QtWidgets.QInputDialog.getText(widget, "输入代理", "请输入要设置的代理(为空代表不设置代理)") + if proxy[1] == False: + return + if proxy[0] == "": + os.system("adb -s 192.168.250.2:5555 shell settings delete global http_proxy") + os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_host") + os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_port") + QtWidgets.QMessageBox.information(widget, "提示", "设置成功!") + else: + os.system(f"adb -s 192.168.250.2:5555 shell settings put global http_proxy \"{proxy[0]}\"") + QtWidgets.QMessageBox.information(widget, "提示", "设置成功!") + +class UengineWindowSizeSetting: + setting = None + package = "com.nuts.extremspeedup" + verticalWidth = None + verticalHeighe = None + horizontaltWidth = None + horizontaltHeighe = None + verticalScreen = None + allowFullScreen = None + allowScreenSwitching = None + defaultFullScreen = None + logicalDensityDpi = None + physicalDpi = None + appWidth = None + appHeight = None + logicalWidth = None + logicalHeight = None + lineEdit = { + "verticalWidth": verticalWidth, + "verticalHeighe": verticalHeighe, + "horizontaltWidth": horizontaltWidth, + "horizontaltHeighe": horizontaltHeighe, + "logicalDensityDpi": logicalDensityDpi, + "physicalDpi": physicalDpi, + "appWidth": appWidth, + "appHeight": appHeight, + "logicalWidth": logicalWidth, + "logicalHeight": logicalHeight + } + checkbox = { + "verticalScreen": verticalScreen, + "allowFullScreen": allowFullScreen, + "allowScreenSwitching": allowScreenSwitching, + "defaultFullScreen": defaultFullScreen + } + def ShowWindow(): + unfound = False + while True: + if ComboInstallPath.currentText() == "": + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名") + else: + if GetApkPackageName(ComboInstallPath.currentText()) == None: + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名", text=ComboInstallPath.currentText()) + else: + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名", text=GetApkPackageName(ComboInstallPath.currentText())) + if not choose[1]: + return + if choose[0] == "": + QtWidgets.QMessageBox.information(widget, "提示", "包名不能为空") + continue + if not os.path.exists(f"/usr/share/uengine/appetc/{choose[0]}.txt"): + if QtWidgets.QMessageBox.question(widget, "提示", "未找到这个包名对应的配置文件,是否要创建一个?") == QtWidgets.QMessageBox.No: + continue + unfound = True + UengineWindowSizeSetting.package = choose[0] + break + UengineWindowSizeSetting.setting = QtWidgets.QMainWindow() + settingWidget = QtWidgets.QWidget() + settingLayout = QtWidgets.QGridLayout() + + UengineWindowSizeSetting.verticalWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.verticalHeighe = QtWidgets.QLineEdit() + UengineWindowSizeSetting.horizontaltWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.horizontaltHeighe = QtWidgets.QLineEdit() + UengineWindowSizeSetting.verticalScreen = QtWidgets.QCheckBox("默认为竖屏") + UengineWindowSizeSetting.allowFullScreen = QtWidgets.QCheckBox("允许全屏") + UengineWindowSizeSetting.allowScreenSwitching = QtWidgets.QCheckBox("允许横竖屏切换") + UengineWindowSizeSetting.defaultFullScreen = QtWidgets.QCheckBox("默认显示最大化") + UengineWindowSizeSetting.logicalDensityDpi = QtWidgets.QLineEdit() + UengineWindowSizeSetting.physicalDpi = QtWidgets.QLineEdit() + UengineWindowSizeSetting.appWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.appHeight = QtWidgets.QLineEdit() + UengineWindowSizeSetting.logicalWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.logicalHeight = QtWidgets.QLineEdit() + saveButton = QtWidgets.QPushButton("保存设置") + deleButton = QtWidgets.QPushButton("删除设置") + saveButton.clicked.connect(UengineWindowSizeSetting.SaveSetting) + deleButton.clicked.connect(UengineWindowSizeSetting.DeleteSetting) + settingLayout.addWidget(QtWidgets.QLabel("竖屏宽:"), 0, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalWidth, 0, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("竖屏高:"), 1, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalHeighe, 1, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("横屏宽,备选为1280:"), 2, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.horizontaltWidth, 2, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("横屏高,备选为720:"), 3, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.horizontaltHeighe, 3, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置默认横屏还是竖屏:"), 4, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalScreen, 4, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否允许全屏:"), 5, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.allowFullScreen, 5, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否允许横竖屏切换:"), 6, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.allowScreenSwitching, 6, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否默认显示最大化:"), 7, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.defaultFullScreen, 7, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("
"), 8, 0, 1, 3) + settingLayout.addWidget(QtWidgets.QLabel("屏幕缩放,数值大则大:"), 9, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalDensityDpi, 9, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("physicalDpi:"), 10, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.physicalDpi, 10, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("appWidth:"), 11, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.appWidth, 11, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("appHeight:"), 12, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.appHeight, 12, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("logicalWidth:"), 13, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalWidth, 13, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("logicalHeight:"), 14, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalHeight, 14, 1, 1, 2) + settingLayout.addWidget(saveButton, 15, 1, 1, 1) + settingLayout.addWidget(deleButton, 15, 2, 1, 1) + UengineWindowSizeSetting.lineEdit = { + "verticalWidth": UengineWindowSizeSetting.verticalWidth, + "verticalHeighe": UengineWindowSizeSetting.verticalHeighe, + "horizontaltWidth": UengineWindowSizeSetting.horizontaltWidth, + "horizontaltHeighe": UengineWindowSizeSetting.horizontaltHeighe, + "logicalDensityDpi": UengineWindowSizeSetting.logicalDensityDpi, + "physicalDpi": UengineWindowSizeSetting.physicalDpi, + "appWidth": UengineWindowSizeSetting.appWidth, + "appHeight": UengineWindowSizeSetting.appHeight, + "logicalWidth": UengineWindowSizeSetting.logicalWidth, + "logicalHeight": UengineWindowSizeSetting.logicalHeight + } + UengineWindowSizeSetting.checkbox = { + "verticalScreen": UengineWindowSizeSetting.verticalScreen, + "allowFullScreen": UengineWindowSizeSetting.allowFullScreen, + "allowScreenSwitching": UengineWindowSizeSetting.allowScreenSwitching, + "defaultFullScreen": UengineWindowSizeSetting.defaultFullScreen + } + settingWidget.setLayout(settingLayout) + UengineWindowSizeSetting.setting.setCentralWidget(settingWidget) + if not unfound: + UengineWindowSizeSetting.ReadSetting() + else: + for i in UengineWindowSizeSetting.checkbox.values(): + i.setChecked(True) + UengineWindowSizeSetting.setting.setWindowTitle(f"设置 Android 应用的窗口大小缩放设置") + UengineWindowSizeSetting.setting.show() + UengineWindowSizeSetting.setting.resize(UengineWindowSizeSetting.setting.frameSize().width() * 1.3, UengineWindowSizeSetting.setting.frameSize().height()) + + def ReadSetting(): + file = open(f"/usr/share/uengine/appetc/{UengineWindowSizeSetting.package}.txt") + while True: + line = file.readline() + if not line: + break + line = line.strip() + print(line) + if "//" in line: + line = line[:line.index("//")] + try: + if line[:line.index(" ")].strip() in UengineWindowSizeSetting.lineEdit.keys(): + UengineWindowSizeSetting.lineEdit[line[:line.index(" ")].strip()].setText(line[line.index(" "):].strip()) + if line[:line.index(" ")].strip() in UengineWindowSizeSetting.checkbox.keys(): + UengineWindowSizeSetting.checkbox[line[:line.index(" ")].strip()].setChecked(bool(line[line.index(" "):].strip())) + except: # 错误行,忽略 + pass + file.close() + + def SaveSetting(): + file = open(f"/tmp/{UengineWindowSizeSetting.package}.txt", "w") + for i in UengineWindowSizeSetting.lineEdit.keys(): + if UengineWindowSizeSetting.lineEdit[i].text() == "": # 空选项,不写入 + continue + try: + file.write(f"{i} {int(UengineWindowSizeSetting.lineEdit[i].text())}\n") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", "格式输入错误") + return + for i in UengineWindowSizeSetting.checkbox.keys(): + try: + file.write(f"{i} {int(UengineWindowSizeSetting.checkbox[i].isChecked())}\n") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + return + file.close() + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -a {UengineWindowSizeSetting.package}"): + QtWidgets.QMessageBox.critical(widget, "错误", "保存失败") + return + QtWidgets.QMessageBox.information(widget, "提示", "保存完成!") + + def DeleteSetting(): + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -d {UengineWindowSizeSetting.package}"): + QtWidgets.QMessageBox.critical(widget, "错误", "删除失败") + return + QtWidgets.QMessageBox.information(widget, "提示", "删除完成!") + + +class SettingWindow(): + saveApkOption = None + settingWindow = None + autoScreenConfig = None + chooseProgramType = None + theme = None + def ShowWindow(): + SettingWindow.settingWindow = QtWidgets.QMainWindow() + setting = QtWidgets.QWidget() + settingLayout = QtWidgets.QGridLayout() + + SettingWindow.saveApkOption = QtWidgets.QComboBox() + SettingWindow.autoScreenConfig = QtWidgets.QCheckBox("安装APK时自动根据系统分辨率设置,卸载时自动移除") + SettingWindow.chooseProgramType = QtWidgets.QCheckBox("安装APK时手动选择程序分类") + SettingWindow.theme = QtWidgets.QComboBox() + themeTry = QtWidgets.QPushButton("测试(重启后变回设置的主题)") + SettingWindow.theme.addItems(QtWidgets.QStyleFactory.keys()) + controlFrame = QtWidgets.QHBoxLayout() + cancalButton = QtWidgets.QPushButton("取消") + okButton = QtWidgets.QPushButton("保存") + + settingLayout.addWidget(QtWidgets.QLabel("APK 安装模式:"), 0, 0, 1, 1) + settingLayout.addWidget(SettingWindow.saveApkOption, 0, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("窗口大小策略:"), 1, 0, 1, 1) + settingLayout.addWidget(SettingWindow.autoScreenConfig, 1, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("程序分类策略:"), 2, 0, 1, 1) + settingLayout.addWidget(SettingWindow.chooseProgramType, 2, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("程序分类策略:"), 2, 0, 1, 1) + settingLayout.addWidget(SettingWindow.theme, 2, 1, 1, 1) + settingLayout.addWidget(themeTry, 2, 2, 1, 1) + settingLayout.addLayout(controlFrame, 4, 1, 1, 2) + controlFrame.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) + controlFrame.addWidget(cancalButton) + controlFrame.addWidget(okButton) + + SettingWindow.saveApkOption.addItems(["不备份Apk包直接安装", "备份Apk包然后在安装后自动拷贝原先目录"]) + try: + data = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) + except: + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SettingReadError"]) + SettingWindow.settingWindow.close() + return + SettingWindow.autoScreenConfig.setChecked(settingConf["AutoScreenConfig"]) + SettingWindow.saveApkOption.setCurrentIndex(int(data["SaveApk"])) + SettingWindow.chooseProgramType.setChecked(settingConf["ChooseProgramType"]) + SettingWindow.theme.setCurrentText(settingConf["Theme"]) + themeTry.clicked.connect(SettingWindow.Try) + cancalButton.clicked.connect(SettingWindow.settingWindow.close) + okButton.clicked.connect(SettingWindow.SaveSetting) + + setting.setLayout(settingLayout) + SettingWindow.settingWindow.setWindowTitle(f"设置 UEngine 运行器 {version}") + SettingWindow.settingWindow.setWindowIcon(QtGui.QIcon(iconPath)) + SettingWindow.settingWindow.setCentralWidget(setting) + SettingWindow.settingWindow.show() + SettingWindow.settingWindow.setFixedSize(SettingWindow.settingWindow.frameSize().width(), SettingWindow.settingWindow.frameSize().height()) + + def Try(): + app.setStyle(QtWidgets.QStyleFactory.create(SettingWindow.theme.currentText())) + + def SaveSetting(): + global settingConf + try: + write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({ + "SaveApk": bool(SettingWindow.saveApkOption.currentIndex()), + "AutoScreenConfig": SettingWindow.autoScreenConfig.isChecked(), + "ChooseProgramType": SettingWindow.chooseProgramType.isChecked(), + "Theme": SettingWindow.theme.currentText() + })) + settingConf = { + "SaveApk": bool(SettingWindow.saveApkOption.currentIndex()), + "AutoScreenConfig": SettingWindow.autoScreenConfig.isChecked(), + "ChooseProgramType": SettingWindow.chooseProgramType.isChecked(), + "Theme": SettingWindow.theme.currentText() + } + app.setStyle(QtWidgets.QStyleFactory.create(SettingWindow.theme.currentText())) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SettingSaveError"]) + return + QtWidgets.QMessageBox.information(widget, "提示", "设置保存完毕!") + +class UpdateWindow(): + data = {} + update = None + def ShowWindow(): + UpdateWindow.update = QtWidgets.QMainWindow() + updateWidget = QtWidgets.QWidget() + updateWidgetLayout = QtWidgets.QGridLayout() + versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:未知\n更新内容:") + updateText = QtWidgets.QTextBrowser() + ok = QtWidgets.QPushButton("更新(更新过程中会关闭所有Python应用,包括这个应用)") + ok.clicked.connect(UpdateWindow.Update) + cancel = QtWidgets.QPushButton("取消") + cancel.clicked.connect(UpdateWindow.update.close) + try: + UpdateWindow.data = json.loads(requests.get("http://120.25.153.144/uengine-runner/update.json").text) + versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:{UpdateWindow.data['Version']}\n更新内容:") + if UpdateWindow.data["Version"] == version: + updateText.setText("此为最新版本,无需更新") + ok.setDisabled(True) + else: + updateText.setText(UpdateWindow.data["New"].replace("\\n", "\n")) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(updateWidget, "错误", "无法连接服务器!") + updateWidgetLayout.addWidget(versionLabel, 0, 0, 1, 1) + updateWidgetLayout.addWidget(updateText, 1, 0, 1, 3) + updateWidgetLayout.addWidget(ok, 2, 2, 1, 1) + updateWidgetLayout.addWidget(cancel, 2, 1, 1, 1) + updateWidget.setLayout(updateWidgetLayout) + UpdateWindow.update.setCentralWidget(updateWidget) + UpdateWindow.update.setWindowTitle("检查更新") + UpdateWindow.update.setWindowIcon(QtGui.QIcon(iconPath)) + UpdateWindow.update.resize(updateWidget.frameGeometry().width(), int(updateWidget.frameGeometry().height() * 1.5)) + UpdateWindow.update.show() + + def Update(): + if os.path.exists("/tmp/uengine-runner/update"): + shutil.rmtree("/tmp/uengine-runner/update") + os.makedirs("/tmp/uengine-runner/update") + try: + print(UpdateWindow.data["Url"]) + write_txt("/tmp/uengine-runner/update.sh", f"""#!/bin/bash +echo 删除多余的安装包 +rm -rfv /tmp/uengine-runner/update/* +echo 关闭“UEngine 运行器”以及其它“Python 应用” +killall python3 +echo 下载安装包 +wget -P /tmp/uengine-runner/update {UpdateWindow.data["Url"][0]} +echo 安装安装包 +dpkg -i /tmp/uengine-runner/update/* +echo 修复依赖关系 +apt install -f -y +notify-send -i "{iconPath}" "更新完毕!" +zenity --info --text=\"更新完毕!\" --ellipsize +""") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误,无法继续更新", traceback.format_exc()) + os.system(f"'{programPath}/launch.sh' deepin-terminal -e pkexec bash /tmp/uengine-runner/update.sh") + +image = None +class ApkInformation(): + message = None + def ShowWindows(): + global fullInformation + global path + global tab1 + path = ComboInstallPath.currentText() + package = GetApkPackageName(path) + if package == None or package == "": + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ApkFileError"]) + return + ApkInformation.message = QtWidgets.QMainWindow() + messageWidget = QtWidgets.QWidget() + messageLayout = QtWidgets.QVBoxLayout() + ApkInformation.message.setWindowTitle("“{}“的Apk信息".format(GetApkChineseLabel(path))) + tab = QtWidgets.QTabWidget() + + tab1 = QtWidgets.QWidget() + tab2 = QtWidgets.QWidget() + + tab.addTab(tab1, "简化版") + tab1Layout = QtWidgets.QGridLayout() + SaveApkIcon(path, "/tmp/uengine-runner-android-app-icon.png") + simpleInformation = QtWidgets.QLabel(f""" +

+

包名:{GetApkPackageName(path)}

+

中文名:{GetApkChineseLabel(path)}

+

Activity:{GetApkActivityName(path)}

+

版本:{GetApkVersion(path)}

""") + + seeFen = QtWidgets.QPushButton("查看程序评分情况") + updFen = QtWidgets.QPushButton("上传程序评分情况") + seeFen.clicked.connect(ApkInformation.ShowMap) + updFen.clicked.connect(ApkInformation.UpdateMark) + tab1Layout.addWidget(simpleInformation, 0, 0, 1, 3) + tab1Layout.addWidget(seeFen, 1, 1, 1, 1) + tab1Layout.addWidget(updFen, 2, 1, 1, 1) + tab1.setLayout(tab1Layout) + + tab.addTab(tab2, "完整版") + tab2Layout = QtWidgets.QVBoxLayout() + fullInformation = QtWidgets.QTextBrowser() + fullInformation.setText(GetApkInformation(path)) + tab2Layout.addWidget(fullInformation) + tab2.setLayout(tab2Layout) + + messageLayout.addWidget(tab) + messageWidget.setLayout(messageLayout) + ApkInformation.message.setCentralWidget(messageWidget) + ApkInformation.message.setWindowIcon(QtGui.QIcon(iconPath)) + ApkInformation.message.setWindowTitle("APK 信息") + ApkInformation.message.show() + return + + def UpdateMark(): + chooseWindow = QtWidgets.QMessageBox() + chooseWindow.setWindowTitle("选择评分") + chooseWindow.setText(f"""选择应用“{GetApkChineseLabel(path)}”的使用评分。建议参考如下规范进行评分: +含有不良信息(-1分):含有违法违规信息(如果有就不要选择其它选项了) +0星:完全无法使用,连安装都有问题 +1星:完全无法使用,但是能正常安装 +2星:可以打开,但只能使用一点点功能 +3星:勉强能使用,运行也不大流畅 +4星:大部分功能正常,运行流畅(可能会有点小卡) +5星:完全正常且非常流畅,没有任何功能和性能问题,就和直接在手机上用一样 +""") + choices=["含有不良信息", "0分", "1分", "2分", "3分", "4分", "5分", "取消"] + button0 = chooseWindow.addButton(choices[0], QtWidgets.QMessageBox.ActionRole) + button1 = chooseWindow.addButton(choices[1], QtWidgets.QMessageBox.ActionRole) + button2 = chooseWindow.addButton(choices[2], QtWidgets.QMessageBox.ActionRole) + button3 = chooseWindow.addButton(choices[3], QtWidgets.QMessageBox.ActionRole) + button4 = chooseWindow.addButton(choices[4], QtWidgets.QMessageBox.ActionRole) + button5 = chooseWindow.addButton(choices[5], QtWidgets.QMessageBox.ActionRole) + button6 = chooseWindow.addButton(choices[6], QtWidgets.QMessageBox.ActionRole) + button7 = chooseWindow.addButton(choices[7], QtWidgets.QMessageBox.ActionRole) + button0.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(0))) + button1.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(1))) + button2.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(2))) + button3.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(3))) + button4.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(4))) + button5.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(5))) + button6.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(6))) + button7.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(7))) + chooseWindow.exec_() + return + + def UpdateMarkInternet(choose): + print(choose) + if choose == None or choose == 7: + return + try: + QtWidgets.QMessageBox.critical(widget, "提示", requests.post("http://120.25.153.144/uengine-runner/app/check/add.php", {"Package": GetApkPackageName(path), "Type": choose}).text) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ConnectServerStarError"]) + + + def ShowMap(): + package = GetApkPackageName(path) + if package == None or package == "": + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ApkFileError"]) + return + try: + data = json.loads(requests.get("http://120.25.153.144/uengine-runner/app/check/" + package +"/data.json").text) + print(data) + except: + QtWidgets.QMessageBox.information(widget, "提示", "此程序暂时没有评分,欢迎您贡献第一个评分!") + return + index = numpy.arange(len(data)) + print(index) + chinese = GetApkChineseLabel(path) + fig = matplotlib.pylab.figure() + fig.canvas.set_window_title("“" + chinese + "”的用户评分(数据只供参考)") + fonts = matplotlib.font_manager.FontProperties(fname='/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc') # 用于支持中文显示,需要依赖fonts-noto-cjk + matplotlib.pylab.barh(index, data) + matplotlib.pylab.yticks(index, ["不良信息", "0分", "1分", "2分", "3分", "4分", "5分"], fontproperties=fonts) + matplotlib.pylab.xlabel("用户评分数", fontproperties=fonts) + matplotlib.pylab.ylabel("等级", fontproperties=fonts) + matplotlib.pylab.title("“" + chinese + "”的用户评分(数据只供参考)", fontproperties=fonts) + matplotlib.pylab.show(block=True) + +class AdbChangeUengineDisplaySize(): + messageWindow = None + def ShowWindows(): + global displayX + global displayY + global displaySize + AdbChangeUengineDisplaySize.messageWindow = QtWidgets.QMainWindow() + message = QtWidgets.QWidget() + messageLayout = QtWidgets.QGridLayout() + + displaySize = QtWidgets.QLabel("当前 UEngine 屏幕分辨率:\n" + subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size")) + displayX = QtWidgets.QLineEdit() + displayY = QtWidgets.QLineEdit() + setButton = QtWidgets.QPushButton("设置分辨率") + setButton.setSizePolicy(size) + setButton.clicked.connect(AdbChangeUengineDisplaySize.SettingDisplaySize) + messageLayout.addWidget(displaySize, 0, 0, 1, 3) + messageLayout.addWidget(displayX, 1, 0, 1, 1) + messageLayout.addWidget(QtWidgets.QLabel("×")) + messageLayout.addWidget(displayY, 1, 2, 1, 1) + messageLayout.addWidget(setButton, 2, 0, 1, 3, QtCore.Qt.AlignCenter) + + + message.setLayout(messageLayout) + AdbChangeUengineDisplaySize.messageWindow.setCentralWidget(message) + AdbChangeUengineDisplaySize.messageWindow.setWindowTitle("修改 UEngine 分辨率") + AdbChangeUengineDisplaySize.messageWindow.setWindowIcon(QtGui.QIcon(iconPath)) + AdbChangeUengineDisplaySize.messageWindow.show() + return + + def GetUengineDisplaySize(): + global displaySize + displaySize.setText("当前 UEngine 屏幕分辨率:\n" + subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size")) + + def SettingDisplaySize(): + global displayX + global displayY + try: + int(displayX.text()) + int(displayY.text()) + except: + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["InputDataError"]) + return + os.system("adb -s '192.168.250.2:5555' shell wm size {}x{}".format(displayX.text(), displayY.text())) + AdbChangeUengineDisplaySize.GetUengineDisplaySize() + QtWidgets.QMessageBox.information(widget, "提示", "执行完毕!") + +class ShowTextTipsWindow(): + messageWindow = None + def ShowWindow(things): + ShowTextTipsWindow.messageWindow = QtWidgets.QMainWindow() + message = QtWidgets.QWidget() + messageLayout = QtWidgets.QVBoxLayout() + + text = QtWidgets.QTextBrowser() + text.setText(things) + ok = QtWidgets.QPushButton("确定") + ok.clicked.connect(ShowTextTipsWindow.messageWindow.close) + #ok.setSizePolicy(size) + + messageLayout.addWidget(text) + messageLayout.addWidget(ok) + + message.setLayout(messageLayout) + ShowTextTipsWindow.messageWindow.setCentralWidget(message) + ShowTextTipsWindow.messageWindow.setWindowTitle("提示") + ShowTextTipsWindow.messageWindow.setWindowIcon(QtGui.QIcon(iconPath)) + ShowTextTipsWindow.messageWindow.show() + ShowTextTipsWindow.messageWindow.resize(ShowTextTipsWindow.messageWindow.frameSize().width() * 2, ShowTextTipsWindow.messageWindow.frameSize().height() * 1.5) + return + +# 添加/删除 uengine 应用快捷方式 +class AddNewUengineDesktopLink(): + addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity +注意:如果是要删除只要输入包名即可''' + messageWindow = None + def ShowWindow(): + global activityName + global packageName + AddNewUengineDesktopLink.messageWindow = QtWidgets.QMainWindow() + message = QtWidgets.QWidget() + messageLayout = QtWidgets.QGridLayout() + + activityName = QtWidgets.QLineEdit() + packageName = QtWidgets.QLineEdit() + browser = QtWidgets.QPushButton("浏览……") + controlFrame = QtWidgets.QHBoxLayout() + open = QtWidgets.QPushButton("打开") + save = QtWidgets.QPushButton("保存") + delete = QtWidgets.QPushButton("删除") + + packageName.setPlaceholderText("APK 包名") + activityName.setPlaceholderText("APK 的 Activity") + + browser.clicked.connect(AddNewUengineDesktopLink.FindApk) + open.clicked.connect(AddNewUengineDesktopLink.TestOpen) + save.clicked.connect(AddNewUengineDesktopLink.SaveDesktopLink) + delete.clicked.connect(AddNewUengineDesktopLink.DelDesktopLink) + + messageLayout.addWidget(QtWidgets.QLabel(AddNewUengineDesktopLink.addTips), 0, 0, 1, 3) + messageLayout.addWidget(packageName, 1, 0, 1, 1) + messageLayout.addWidget(activityName, 1, 1, 1, 1) + messageLayout.addWidget(browser, 1, 2, 1, 1) + messageLayout.addLayout(controlFrame, 2, 0, 1, 3) + controlFrame.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) + controlFrame.addWidget(open) + controlFrame.addWidget(save) + controlFrame.addWidget(delete) + controlFrame.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) + + message.setLayout(messageLayout) + AddNewUengineDesktopLink.messageWindow.setCentralWidget(message) + AddNewUengineDesktopLink.messageWindow.setWindowTitle("添加/删除 UEngine 图标") + AddNewUengineDesktopLink.messageWindow.setWindowIcon(QtGui.QIcon(iconPath)) + AddNewUengineDesktopLink.messageWindow.show() + return + + # 添加快捷方式 + def SaveDesktopLink(): + try: + if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())): + if QtWidgets.QMessageBox.question(widget, "提示", "文件已存在,是否要覆盖?") == QtWidgets.QMessageBox.No: + return + if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())): + os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())) + global activityName + iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get()) + shutil.copy(programPath + "/defult.png", iconSavePath) + BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath, + "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())) + BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath, + "{}/{}.desktop".format(get_desktop_path(), packageName.get())) + AddNewUengineDesktopLink.SaveHistory() + QtWidgets.QMessageBox.information(widget, "提示", "创建完毕!") + except: + traceback.print_exc() + QtWidgets.QMessageBox.information(widget, "错误", traceback.format_exc()) + + + # 删除快捷方式 + def DelDesktopLink(): + try: + global packageName + if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())): + 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.get())) + AddNewUengineDesktopLink.SaveHistory() + QtWidgets.QMessageBox.information(widget, "提示", "已删除") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + + # 保存历史记录 + def SaveHistory(): + findApkNameHistory.append(packageName.text()) + findApkActivityHistory.append(activityName.text()) + write_txt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json", str(json.dumps(ListToDictionary(findApkNameHistory)))) # 将历史记录的数组转换为字典并写入 + write_txt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json", str(json.dumps(ListToDictionary(findApkActivityHistory)))) # 将历史记录的数组转换为字典并写入 + + # 打开测试 + def TestOpen(): + threading.Thread(target=os.system, args=["/usr/bin/uengine launch --package={} --component={}".format(packageName.text(), activityName.text())]).start() + AddNewUengineDesktopLink.SaveHistory() + + # 浏览文件 + def FindApk(): + path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择apk", "~", "APK 文件(*.apk);;所有文件(*.*)", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkName.json"))["path"])[0] + if path == "" or path == () or path == None: + return + packageName.setText(GetApkPackageName(path)) + activityName.setText(str(GetApkActivityName(path))) + write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 + +def UseProgram(): + global useProgram + useProgram = '''

1、UEngine:{}

+

2、python3:{}

+

3、PyQt:{}

+

4、aapt:{}

+

5、dpkg:{}

+

6、mkdir:{}

+

7、echo

+

8、chmod:{}

+

9、adb:{}

+

10、deepin 终端:{}

'''.format(subprocess.getoutput("uengine version"), + subprocess.getoutput("python3 --version"), + QtCore.qVersion, + subprocess.getoutput("aapt version"), + subprocess.getoutput("dpkg --version"), + subprocess.getoutput("mkdir --version"), + subprocess.getoutput("chmod --version"), + subprocess.getoutput("adb version"), + subprocess.getoutput("deepin-terminal -v")) + +def BackAPK(choice): + global choose + choose = choice + +########################### +# 程序信息 +########################### +lang = get_now_lang() +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +information = json.loads(readtxt(programPath + "/information.json")) +langFile = json.loads(readtxt(programPath + "/Language.json")) +if not lang in langFile.keys(): + lang = "en_US.UTF-8" +programUrl = information["Url"][0] +version = information["Version"] +goodRunSystem = information["System"] +aaptVersion = GetCommandReturn("aapt version") +SystemVersion = GetSystemVersion() +iconPath = "{}/runner.svg".format(os.path.split(os.path.realpath(__file__))[0]) +about = f'''

+

介绍 :一个基于 Python3 的 PyQt5 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。

+

版本 :{version}

+

适用平台 :{goodRunSystem}

+

Qt 版本 :{QtCore.qVersion()}

+

程序官网 :{programUrl}

+

系统版本 : {SystemVersion}

+

©2021-{time.strftime("%Y")}

''' +updateThingsString = "" +tips = "" +contribute = "" +for i in information["Tips"]: + tips += f"

{i}

" +for i in information["Update"]: + updateThingsString += f"

{i}

" +for i in information["Contribute"]: + contribute += f"

{i}

" +title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version) +updateTime = information["Time"] +updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) +desktop = programPath + "/UengineAndroidProgramList.desktop" +desktopName = "UengineAndroidProgramList.desktop" +useProgram = "" +threading.Thread(target=UseProgram).start() + +########################### +# 加载配置 +########################### +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(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹 + os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹 +if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkHistory.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", json.dumps({})) # 创建配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkNameHistory.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json", json.dumps({})) # 创建配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json", json.dumps({})) # 创建配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json", json.dumps({})) # 创建配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkName.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/FindApk.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/FindUninstallApk.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApkIcon.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApk.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/uengine-runner/setting.json"): + choosemsg = QtWidgets.QMessageBox() + choosemsg.setText("""在使用本程序前,请选择安装Apk包的设置以便更好的运行,下列选项的详细介绍: + +不备份Apk包直接安装:适用于Deepin(旧版UEngine),安装较快,不受/tmp大小所限,但Deepin23和UOS(新版UEngine)不推荐此选项,因为安装后会自动删除Apk安装包; +备份Apk包然后在安装后自动拷贝原先目录:适用于Deepin23和UOS(新版UEngine),安装较慢,受/tmp大小所限,安装后不会丢失Apk,Deepin(旧版UEngine)不推荐使用该选项; + + +后期可以在程序主界面的菜单栏的“程序”=>“设置”里进行修改, +如果不知道正在使用的系统是什么版本可以打开系统设置查看。 +""") + choosemsg.setWindowTitle("设置") + choose = None + choosemsg.addButton("不备份Apk包直接安装", QtWidgets.QMessageBox.ActionRole).clicked.connect(lambda: BackAPK(0)) + choosemsg.addButton("备份Apk包然后在安装后自动拷贝原先目录", QtWidgets.QMessageBox.ActionRole).clicked.connect(lambda: BackAPK(1)) + choosemsg.exec_() + if choose == None: + QtWidgets.QMessageBox.information(None, "提示", "必须选择一个选项!否则无法进入程序!") + sys.exit() + write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({"SaveApk": int(choose)})) +defultProgramList = { + "SaveApk": 1, + "AutoScreenConfig": False, + "ChooseProgramType": False, + "Theme": "" +} +try: + settingConf = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) + change = False + for i in defultProgramList.keys(): + if not i in settingConf: + change = True + settingConf[i] = defultProgramList[i] + if change: + write_txt(get_home() + "/.config/uengine-setting.json", json.dumps(settingConf)) +except: + traceback.print_exc() + app = QtWidgets.QApplication(sys.argv) + QtWidgets.QMessageBox.critical(None, "错误", f"无法读取配置,无法继续\n{traceback.format_exc()}") + sys.exit(1) + +########################### +# 设置变量 +########################### +findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkHistory.json")).values()) +fineUninstallApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json")).values()) +findApkNameHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json")).values()) +findApkActivityHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json")).values()) + +# add sub window +#添加窗口开启关闭开关,防止重复开启 +windowflag = "close" +def Egg(): + try: + lists = json.loads(requests.get("http://120.25.153.144/uengine-runner/VersionList.json").text) + data = [] + for i in lists: + data.append(int(requests.get("http://120.25.153.144/uengine-runner/{}/data.txt".format(i)).text)) + except: + QtWidgets.QMessageBox.critical(widget, "错误", "服务器出错!数据获取失败!") + return + fig = matplotlib.pylab.figure() + fig.canvas.set_window_title("“UEngine 运行器”安装数(数据只供参考)") + matplotlib.pylab.plot(lists, data) + index = numpy.arange(len(lists)) + fonts = matplotlib.font_manager.FontProperties(fname='/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc') # 用于支持中文显示,需要依赖fonts-noto-cjk + matplotlib.pylab.xlabel("版本号", fontproperties=fonts) + matplotlib.pylab.ylabel("安装数", fontproperties=fonts) + + matplotlib.pylab.title("“UEngine 运行器”安装数(数据只供参考)", fontproperties=fonts) + matplotlib.pylab.show() +helpWindow = None +def showhelp(): + global helpWindow + helpWindow = QtWidgets.QMainWindow() + helpWidget = QtWidgets.QWidget() + helpLayout = QtWidgets.QGridLayout() + + def ChgLog(): + HelpStr.setHtml(updateThingsString) + def ChgAbout(event): + HelpStr.setHtml(about) + def ChgDep(): + if useProgram == "": + BtnZujian.setDisabled(True) + return + HelpStr.setHtml(useProgram) + def ChgCon(): + HelpStr.setHtml(contribute) + def ChgTips(): + HelpStr.setHtml(tips) + + + BtnReadme = QtWidgets.QPushButton("使用说明") + BtnLog = QtWidgets.QPushButton("更新内容") + BtnZujian = QtWidgets.QPushButton("程序依赖的组件") + BtnGongxian = QtWidgets.QPushButton("谢明列表") + BtnAbout = QtWidgets.QPushButton("关于") + BtnDownN = QtWidgets.QPushButton("程序下载量") + HelpStr = QtWidgets.QTextBrowser() + BtnDownN.setEnabled("--彩蛋" in sys.argv) + BtnReadme.clicked.connect(ChgTips) + BtnLog.clicked.connect(ChgLog) + BtnZujian.clicked.connect(ChgDep) + BtnGongxian.clicked.connect(ChgCon) + BtnAbout.clicked.connect(ChgAbout) + BtnDownN.clicked.connect(Egg) + + ChgTips() + + helpLayout.addWidget(BtnReadme, 0, 0, 1, 1) + helpLayout.addWidget(BtnLog, 1, 0, 1, 1) + helpLayout.addWidget(BtnZujian, 2, 0, 1, 1) + helpLayout.addWidget(BtnGongxian, 3, 0, 1, 1) + helpLayout.addWidget(BtnAbout, 5, 0, 1, 1) + helpLayout.addWidget(BtnDownN, 4, 0, 1, 1) + helpLayout.addWidget(HelpStr, 0, 1, 7, 1) + + helpWidget.setLayout(helpLayout) + helpWindow.setCentralWidget(helpWidget) + helpWindow.setFixedSize(helpWindow.frameSize().width() * 0.9, helpWindow.frameSize().height() * 1.5) + helpWindow.setWindowTitle("帮助") + helpWindow.setWindowIcon(QtGui.QIcon(iconPath)) + helpWindow.show() + return + +########################### +# 检查 UEngine 是否安装 +########################### +if not os.path.exists("/usr/bin/uengine"): + # Deepin/UOS 用户 + if "deepin" in SystemVersion.lower() or "uos" in SystemVersion.lower(): + if QtWidgets.QMessageBox.question(None, "提示", "您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n安装完后重新启动该程序即可") == QtWidgets.QMessageBox.Yes: + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"pkexec apt install uengine -y\"") + sys.exit(0) + # 非 Deepin/UOS 用户 + else: + if QtWidgets.QMessageBox.question(None, "提示", "您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n这里将会使用 shenmo 提供的脚本进行安装\n安装完后重新启动该程序即可\n提示:无法保证此安装脚本安装的 UEngine 可以使用") == QtWidgets.QMessageBox.Yes: + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath}/uengine-installer'\"") + sys.exit(0) + +########################### +# 窗口创建 +########################### +window = QtWidgets.QMainWindow() +widget = QtWidgets.QWidget() +widgetLayout = QtWidgets.QGridLayout() +# 权重 +size = QtWidgets.QSizePolicy() +size.setHorizontalPolicy(0) +widgetSize = QtWidgets.QSizePolicy() +widgetSize.setVerticalPolicy(0) +# 创建控件 +LabApkPath = QtWidgets.QLabel(langFile[lang]["Main"]["MainWindow"]["LabApkPath"]) +ComboInstallPath = QtWidgets.QComboBox() +FrmInstallWidget = QtWidgets.QWidget() +FrmInstall = QtWidgets.QGridLayout() +BtnFindApk = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnFindApk"]) +BtnInstall = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnInstall"]) +BtnShowUengineApp = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnShowUengineApp"]) +BtnUninstall = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnUninstall"]) +Btngeticon = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["Btngeticon"]) +BtnSaveApk = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnSaveApk"]) +BtnApkInformation = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnApkInformation"]) +# 设置控件 +FrmInstallWidget.setLayout(FrmInstall) +FrmInstallWidget.setSizePolicy(size) +BtnShowUengineApp.setSizePolicy(size) +ComboInstallPath.setEditable(True) +ComboInstallPath.addItems(findApkHistory) +ComboInstallPath.setEditText("") +ComboInstallPath.setFixedSize(ComboInstallPath.frameSize().width() * 5, ComboInstallPath.frameSize().height()) +try: + if sys.argv[1] == "-i": + ComboInstallPath.setCurrentText(sys.argv[2]) + print("Install Path: " + sys.argv[2]) + elif sys.argv[1] == "-u": + ComboInstallPath.setCurrentText(sys.argv[2]) + print("Unstall Path: " + sys.argv[2]) + else: + print("Command Format Error") +except: + print("Not Command Or Command Format Error") +# 绑定信号 +BtnFindApk.clicked.connect(FindApk) +BtnInstall.clicked.connect(Button3Install) +BtnShowUengineApp.clicked.connect(Button5Click) +BtnUninstall.clicked.connect(ButtonClick8) +Btngeticon.clicked.connect(SaveIconToOtherPath) +BtnSaveApk.clicked.connect(SaveInstallUengineApp) +BtnApkInformation.clicked.connect(ApkInformation.ShowWindows) +# 布局控件 +widgetLayout.addWidget(LabApkPath, 0, 0, 1, 2) +widgetLayout.addWidget(ComboInstallPath, 1, 0, 1, 2) +widgetLayout.addWidget(BtnShowUengineApp, 2, 0, 1, 1) +widgetLayout.addWidget(FrmInstallWidget, 0, 2, 3, 1) +FrmInstall.addWidget(BtnFindApk, 0, 0, 1, 1) +FrmInstall.addWidget(BtnInstall, 0, 1, 1, 1) +FrmInstall.addWidget(BtnUninstall, 1, 0, 1, 1) +FrmInstall.addWidget(Btngeticon, 1, 1, 1, 1) +FrmInstall.addWidget(BtnSaveApk, 2, 0, 1, 1) +FrmInstall.addWidget(BtnApkInformation, 2, 1, 1, 1) +# 设置菜单栏 +menu = window.menuBar() +programmenu = menu.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Name"]) +adb = menu.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Name"]) +uengine = menu.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Name"]) +help = menu.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Name"]) + +cleanProgramHistory = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][0]) +settingWindow = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][2]) +exitProgram = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][1]) +programmenu.addAction(cleanProgramHistory) +programmenu.addAction(settingWindow) +programmenu.addSeparator() +programmenu.addAction(exitProgram) +# 绑定事件 +cleanProgramHistory.triggered.connect(CleanProgramHistory) +settingWindow.triggered.connect(SettingWindow.ShowWindow) +exitProgram.triggered.connect(window.close) + +adbUengineConnect = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][0]) +adbConnectDevice = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][2]) +adbChangeUengineDisplaySize = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][3]) +adbAndroidInstallAppList = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][4]) +adbTop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][5]) +adbShell = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][6]) +adbScrcpyConnectUengine = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][7]) +adb.addAction(adbUengineConnect) +adb.addSeparator() +adbServer = adb.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Name"]) +adb.addAction(adbConnectDevice) +adb.addSeparator() +adb.addAction(adbChangeUengineDisplaySize) +adb.addAction(adbAndroidInstallAppList) +adb.addAction(adbTop) +adb.addAction(adbShell) +adb.addAction(adbScrcpyConnectUengine) +adb.addSeparator() +uengineUseAdbm = adb.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Name"]) +adbStartServer = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][0]) +adbStopServer = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][1]) +adbKillAdbProgress = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2]) +uengineConnectAdb = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][0]) +uengineUseAdb = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][1]) +uengineDoNotUseAdb = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][2]) +# 绑定信号 +uengineConnectAdb.triggered.connect(UengineConnectAdb) +adbConnectDevice.triggered.connect(AdbConnectDeviceShow) +adbChangeUengineDisplaySize.triggered.connect(AdbChangeUengineDisplaySize.ShowWindows) +adbAndroidInstallAppList.triggered.connect(AdbAndroidInstallAppList) +adbTop.triggered.connect(AdbCPUAndRAWShowInTer) +adbShell.triggered.connect(AdbShellShowInTer) +adbScrcpyConnectUengine.triggered.connect(ScrcpyConnectUengine) + +adbServer.addAction(adbStartServer) +adbServer.addAction(adbStopServer) +adbServer.addAction(adbKillAdbProgress) +# 绑定信号 +adbStartServer.triggered.connect(AdbStartServer) +adbStopServer.triggered.connect(AdbStopServer) +adbKillAdbProgress.triggered.connect(AdbKillAdbProgress) + +uengineUseAdbm.addAction(uengineConnectAdb) +uengineUseAdbm.addAction(uengineUseAdb) +uengineUseAdbm.addSeparator() +uengineUseAdbm.addAction(uengineDoNotUseAdb) +# 绑定信号 +uengineConnectAdb.triggered.connect(UengineConnectAdb) +uengineUseAdb.triggered.connect(UengineUseAdb) +uengineDoNotUseAdb.triggered.connect(UengineDoNotUseAdb) + +uengineAllowOrDisallowUpdateAndroidApp = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][13]) +uengineSetHttpProxy = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][15]) +uengineOpenDebBuilder = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][1]) +uengineKeyboardToMouse = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][7]) +uengineCheckCpu = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][8]) +uengineUbuntuInstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][12]) +uengineDeleteUengineCheck = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][9]) +uengineReinstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][10]) +uengineUbuntuInstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][14]) +uengineWindowSizeSetting = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][16]) +uengine.addAction(uengineAllowOrDisallowUpdateAndroidApp) +uengine.addAction(uengineSetHttpProxy) +uengine.addAction(uengineOpenDebBuilder) +uengine.addAction(uengineKeyboardToMouse) +uengine.addAction(uengineCheckCpu) +uengine.addAction(uengineUbuntuInstall) +uengine.addAction(uengineWindowSizeSetting) +uengineService = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Name"]) +uengineInternet = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Name"]) +uengineIcon = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Name"]) +uengine.addMenu(uengineUseAdbm) +uengineData = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Name"]) +uengine.addAction(uengineDeleteUengineCheck) +uengine.addAction(uengineReinstall) +uengineRoot = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Name"]) +# 绑定信号 +uengineAllowOrDisallowUpdateAndroidApp.triggered.connect(AllowOrDisallowUpdateAndroidApp) +uengineSetHttpProxy.triggered.connect(SetHttpProxy) +uengineOpenDebBuilder.triggered.connect(OpenUengineDebBuilder) +uengineKeyboardToMouse.triggered.connect(KeyboardToMouse) +uengineCheckCpu.triggered.connect(UengineCheckCpu) +uengineUbuntuInstall.triggered.connect(UengineUbuntuInstall) +uengineDeleteUengineCheck.triggered.connect(DelUengineCheck) +uengineReinstall.triggered.connect(ReinstallUengine) +uengineWindowSizeSetting.triggered.connect(UengineWindowSizeSetting.ShowWindow) + +uengineStart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][0]) +uengineStop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][1]) +uengineRestart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][2]) +uengineService.addAction(uengineStart) +uengineService.addAction(uengineStop) +uengineService.addAction(uengineRestart) +# 绑定信号 +uengineStart.triggered.connect(StartUengine) +uengineStop.triggered.connect(StopUengine) +uengineRestart.triggered.connect(UengineRestart) + +uengineBridgeStart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][0]) +uengineBridgeStop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][1]) +uengineBridgeRestart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][2]) +uengineBridgeReload = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][3]) +uengineBridgeForceReload = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][4]) +uengineInternet.addAction(uengineBridgeStart) +uengineInternet.addAction(uengineBridgeStop) +uengineInternet.addAction(uengineReinstall) +uengineInternet.addAction(uengineBridgeReload) +uengineInternet.addAction(uengineBridgeForceReload) +# 绑定信号 +uengineBridgeStart.triggered.connect(UengineBridgeStart) +uengineBridgeStop.triggered.connect(UengineBridgeStop) +uengineBridgeRestart.triggered.connect(UengineBridgeRestart) +uengineBridgeReload.triggered.connect(UengineBridgeReload) +uengineBridgeForceReload.triggered.connect(UengineBridgeForceReload) + +uengineSendUengineAndroidListForDesktop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][0]) +uengineSendUengineAndroidListForLauncher = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][1]) +uengineAddNewUengineDesktopLink = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][2]) +uengineCleanAllUengineDesktopLink = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][3]) +uengineIcon.addAction(uengineSendUengineAndroidListForDesktop) +uengineIcon.addAction(uengineSendUengineAndroidListForLauncher) +uengineIcon.addSeparator() +uengineIcon.addAction(uengineAddNewUengineDesktopLink) +uengineIcon.addSeparator() +uengineIcon.addAction(uengineCleanAllUengineDesktopLink) +# 绑定信号 +uengineSendUengineAndroidListForDesktop.triggered.connect(SendUengineAndroidListForDesktop) +uengineSendUengineAndroidListForLauncher.triggered.connect(SendUengineAndroidListForLauncher) +uengineAddNewUengineDesktopLink.triggered.connect(AddNewUengineDesktopLink.ShowWindow) +uengineCleanAllUengineDesktopLink.triggered.connect(CleanAllUengineDesktopLink) + +#uengineData +uengineOpenRootData = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][0]) +uengineOpenUserData = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][1]) +uengineBackClean = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][2]) +uengineData.addAction(uengineOpenRootData) +uengineData.addAction(uengineOpenUserData) +uengineData.addSeparator() +uengineData.addAction(uengineBackClean) +# 绑定信号 +uengineOpenRootData.triggered.connect(OpenUengineRootData) +uengineOpenUserData.triggered.connect(OpenUengineUserData) +uengineBackClean.triggered.connect(BackUengineClean) + +#uengineRoot +uengineInstallRootUengineImage = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][0]) +uengineBuildRootUengineImage = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][1]) +uengineReinstallUengineImage = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][2]) +uengineRoot.addAction(uengineInstallRootUengineImage) +uengineRoot.addAction(uengineBuildRootUengineImage) +uengineRoot.addSeparator() +uengineRoot.addAction(uengineReinstallUengineImage) +# 绑定信号 +uengineInstallRootUengineImage.triggered.connect(InstallRootUengineImage) +uengineBuildRootUengineImage.triggered.connect(BuildRootUengineImage) +uengineReinstallUengineImage.triggered.connect(ReinstallUengineImage) + +helpOpenProgramUrl = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][0]) +helpUengineRunnerBugUpload = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][2]) +helpShowHelp = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][4]) +helpRunnerUpdate = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][3]) +helpAbout = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][1]) +helpAboutQt = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][5]) +help.addAction(helpOpenProgramUrl) +help.addAction(helpUengineRunnerBugUpload) +help.addAction(helpShowHelp) +help.addAction(helpRunnerUpdate) +help.addAction(helpAbout) +help.addAction(helpAboutQt) +hm1 = help.addMenu("更多生态适配应用") +hm1_1 = QtWidgets.QAction("运行 Windows 应用:Wine 运行器") +hm1.addAction(hm1_1) +hm1_1.triggered.connect(lambda: webbrowser.open_new_tab("https://gitee.com/gfdgd-xi/deep-wine-runner")) +# 绑定信号 +helpOpenProgramUrl.triggered.connect(OpenProgramURL) +helpUengineRunnerBugUpload.triggered.connect(UengineRunnerBugUpload) +helpShowHelp.triggered.connect(ShowHelp) +helpRunnerUpdate.triggered.connect(UpdateWindow.ShowWindow) +helpAbout.triggered.connect(showhelp) +helpAboutQt.triggered.connect(lambda: QtWidgets.QMessageBox.aboutQt(widget)) +# 设置窗口 +app.setStyle(QtWidgets.QStyleFactory.create(settingConf["Theme"])) +widget.setLayout(widgetLayout) +window.setCentralWidget(widget) +window.setWindowTitle(title) +window.show() +window.setWindowIcon(QtGui.QIcon(iconPath)) +window.setFixedSize(window.frameSize().width(), window.frameSize().height()) +sys.exit(app.exec_()) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/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/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about new file mode 100755 index 0000000..ea82964 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about @@ -0,0 +1,170 @@ +#!/usr/bin/env python3 +# 使用系统默认的 python3 运行 +########################################################################################### +# 作者:gfdgd xi +# 版本:1.4.3 +# 更新时间:2021年9月11日 +# 感谢:anbox、deepin 和 统信 +# 基于 Python3 的 tkinter 构建 +########################################################################################### +################# +# 引入所需的库 +################# +import os +import threading +import time +import json +import ttkthemes +import subprocess +import tkinter as tk +import tkinter.ttk as ttk + +# 读取文本文档 +def readtxt(path: "路径")->"读取文本文档": + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +########################### +# 程序信息 +########################### +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +information = json.loads(readtxt(programPath + "/information.json")) +programUrl = information["Url"][0] +version = information["Version"] +goodRunSystem = information["System"] +aaptVersion = subprocess.getoutput("aapt version") +about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。 + +版本 :{} + +适用平台 :{} + +程序官网 :{} + +©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y")) +tips = "\n".join(information["Tips"]) +updateThingsString = "\n".join(information["Update"]) +title = "UEngine 运行器 {}".format(version) +updateTime = information["Time"] +updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) +iconPath = "{}/runner.png".format(os.path.split(os.path.realpath(__file__))[0]) +desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop" +desktopName = "UengineAndroidProgramList.desktop" +contribute = "\n".join(information["Contribute"]) +useProgram = "" +threading.Thread(target=useProgram).start() + +# add sub window +#添加窗口开启关闭开关,防止重复开启 +windowflag = "close" + +def UseProgram(): + global useProgram + useProgram = '''1、UEngine:{} +2、python3:{} +3、tkinter:{} +4、aapt:{} +5、dpkg:{} +6、mkdir:{} +7、echo +8、chmod:{} +9、adb:{} +10、deepin 终端:{}'''.format(subprocess.getoutput("uengine version"), + subprocess.getoutput("python3 --version"), + tk.TkVersion, + subprocess.getoutput("aapt version"), + subprocess.getoutput("dpkg --version"), + subprocess.getoutput("mkdir --version"), + subprocess.getoutput("chmod --version"), + subprocess.getoutput("adb version"), + subprocess.getoutput("deepin-terminal -v")) + +def showhelp(): + + #define window and frame and button label + # + global windowflag + if windowflag == "close": + helpwindow=tk.Tk() + helpwindow.resizable(0, 0) + helpwindow.title("帮助") + + + # get screen width and height + screen_width = helpwindow.winfo_screenwidth() + screen_height = helpwindow.winfo_screenheight() + # calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。 + winwith=550 + winhigh=700 + x = (screen_width/2) - (winwith/2) + y = (screen_height/2) - (winhigh/2) + + helpwindow.geometry("550x700"+"+{:.0f}+{:.0f}".format(x, y)) + helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath)) + + style = ttkthemes.ThemedStyle(helpwindow) + style.set_theme("breeze") + + + + Frmroot=ttk.Frame(helpwindow) + FrmMenu = ttk.Frame(Frmroot) + FrmText = ttk.Frame(Frmroot) + + LabFrmText=ttk.LabelFrame(FrmText,text="帮助",height=800,borderwidth=3) + HelpStr = tk.StringVar() + HelpStr.set(tips) + LabText = ttk.Label(LabFrmText, textvariable=HelpStr,width=55) + LabText.config(wraplength=350) + + def on_closing(): + global windowflag + windowflag = "close" + print(windowflag) + helpwindow.destroy() + + + + # define button func + def ChgLog(): + HelpStr.set(updateThingsString) + def ChgAbout(): + HelpStr.set(about) + def ChgDep(): + if useProgram == "": + BtnZujian.configure(state=tk.DISABLED) + return + HelpStr.set(useProgram) + def ChgCon(): + HelpStr.set(contribute) + def ChgTips(): + HelpStr.set(tips) + LabText.config(wraplength=350) + + BtnReadme = ttk.Button(FrmMenu, text="使用说明",width=14,command=ChgTips) + BtnLog = ttk.Button(FrmMenu, text="更新内容",width=14,command=ChgLog) + BtnZujian = ttk.Button(FrmMenu, text="程序依赖的组件",width=14,command=ChgDep) + BtnGongxian = ttk.Button(FrmMenu, text="有贡献的开发者",width=14,command=ChgCon) + BtnAbout = ttk.Button(FrmMenu, text="关于",width=14,command=ChgAbout) + + + #layout + FrmMenu.grid(row=0,column=0,sticky=tk.NW) + BtnReadme.grid(row=0,column=0,sticky=tk.NW,padx=3) + BtnLog.grid(row=1,column=0,sticky=tk.NW,padx=3) + BtnZujian.grid(row=2,column=0,sticky=tk.NW,padx=3) + BtnGongxian.grid(row=3,column=0,sticky=tk.NW,padx=3) + BtnAbout.grid(row=4,column=0,sticky=tk.NW,padx=3) + + FrmText.grid(row=0,column=1,sticky=tk.NW) + LabFrmText.grid(row=0,column=0,sticky=tk.NW,padx=3,pady=3) + LabText.grid(row=0,column=0,sticky=tk.NW) + + Frmroot.pack() + windowflag = "open" + print(windowflag) + helpwindow.mainloop() + #helpwindow.protocol("WM_DELETE_WINDOW", on_closing) +showhelp() \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh new file mode 100755 index 0000000..c2901f1 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh @@ -0,0 +1,27 @@ +#!/bin/bash +cd `dirname $0` +dir=`pwd` +FILE=/usr/bin/uengine +if [ -f "$FILE" ]; then + echo "$FILE 存在,正常打开菜单" + /usr/bin/uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity +else + echo "$FILE 不存在,没有安装 UEngine,询问是否安装 UEngine" + # 读取系统版本 + version=`sed -n '/^NAME/s/NAME="//Ip' /etc/os-release | sed -n 's/\"//Ip'` + declare -l versionLower=$version + echo "系统:$version" + if [ "$versionLower" = "deepin" ] || [ "$versionLower" = "uos" ]; then + echo "此系统为 Deepin/UOS,使用 apt 安装" + zenity --question --text="您还未安装 UEngine,是否现在安装?" --no-wrap + if [[ $? = 0 ]]; then + "$dir/uengine-runner-applist-launch.sh" deepin-terminal -C "pkexec apt install uengine -y" + fi + else + echo "非 Deepin/UOS 系统,使用 shenmo 提供的脚本安装\n暂未保证此安装脚本一定安装成功" + zenity --question --text="您还未安装 UEngine,是否现在安装?\n将会使用 shenmo 提供的脚本进行安装\n暂未保证此安装脚本一定安装成功" --no-wrap + if [[ $? = 0 ]]; then + deepin-terminal -C "bash /opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer" + fi + fi +fi diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-launch.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-launch.sh new file mode 100755 index 0000000..3e09ebd --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-launch.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# 忽略社区版检测 + +pkgRunCnt=`ps -ef |grep "uengine launch" |grep -v grep |grep "$pkg" |wc -l` +if [ $pkgRunCnt -ge 1 ]; then + #防止短时间内多次打开同一应用,如果应用正在启动中,此次忽略 + exit 0 +fi + +#等Session服务启动完全 +wscont=0 +isReady=`busctl --user get-property org.anbox /org/anbox org.anbox.ApplicationManager Ready` +if [ "$isReady" != "b true" ] ;then + sleep 2 +fi +while [ "$isReady" = "b false" -a $wscont -lt 10 ] +do + sleep 1 + isReady=`busctl --user get-property org.anbox /org/anbox org.anbox.ApplicationManager Ready` + let wscont++ +done + +uengine launch $* diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug new file mode 100755 index 0000000..a5ac2a9 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +import os +import sys +import json +import base64 +import requests +import traceback +import webbrowser +import urllib.parse as parse +import PyQt5.QtGui as QtGui +import PyQt5.QtWidgets as QtWidgets + +# 读取文本文档 +def readtxt(path: "路径")->"读取文本文档": + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +def Update(name, stars, contact, things, version): + # post 内容 + data = { + "Name": name, + "Starts": stars, + "Contact": contact, + "Things": things, + "Version": version + } + try: + QtWidgets.QMessageBox.information(widget, "提示", requests.post(parse.unquote(base64.b64decode("aHR0cCUzQS8vMTIwLjI1LjE1My4xNDQvdWVuZ2luZS1ydW5uZXIvYnVnL3VwbG9hZC5waHA=").decode("utf-8")), data=data).text) + print(data) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", f"服务器疑似出现错误,可以进行以下尝试:①多尝试几次;②使用其他反馈途径\n错误信息:{traceback.format_exc()}") + +def UpdateButtonClick(): + #判断是否为空 + if nameThings.text() == "" or starMenu.currentText() == "" or contactThings.text() == "" or updateThings.toPlainText().replace(" ", "").replace("\n", "") == "": + QtWidgets.QMessageBox.critical(widget, "错误", "反馈信息未填写完整!") + return + Update(name=nameThings.text(), stars=starMenu.currentText(), contact=contactThings.text(), things=updateThings.toPlainText(), version=version) + +def OpenGiteeIssues(): + webbrowser.open_new_tab("https://gitee.com/gfdgd-xi/uengine-runner/issues") + +def OpenGithubIssues(): + webbrowser.open_new_tab("https://github.com/gfdgd-xi/uengine-runner/issues") + +def OpenGitlinkIssues(): + webbrowser.open_new_tab("https://www.gitlink.org.cn/gfdgd_xi/uengine-runner/issues") + +# 获取用户主目录 +def get_home()->"获取用户主目录": + return os.path.expanduser('~') + +########################### +# 程序信息 +########################### +iconPath = "{}/runner.svg".format(os.path.split(os.path.realpath(__file__))[0]) +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +information = json.loads(readtxt(programPath + "/information.json")) +version = information["Version"] + +########################### +# 窗口创建 +########################### +app = QtWidgets.QApplication(sys.argv) +window = QtWidgets.QMainWindow() +widget = QtWidgets.QWidget() +widgetLayout = QtWidgets.QGridLayout() +nameThings = QtWidgets.QLineEdit() +contactThings = QtWidgets.QLineEdit() +starMenu = QtWidgets.QComboBox() +updateThings = QtWidgets.QTextEdit() +updateButton = QtWidgets.QPushButton("提交") +otherUpload = QtWidgets.QHBoxLayout() +giteeButton = QtWidgets.QPushButton("Gitee Issues") +githubButton = QtWidgets.QPushButton("Github Issues") +gitlinkButton = QtWidgets.QPushButton("Gitlink Issues") +otherUpload.addWidget(QtWidgets.QLabel("如果无法正常反馈,可以用其他方式反馈:")) +otherUpload.addWidget(giteeButton) +otherUpload.addWidget(githubButton) +otherUpload.addWidget(gitlinkButton) +otherUpload.addSpacerItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) +starMenu.addItems(["5分", "4分", "3分", "2分", "1分"]) +widgetLayout.addWidget(QtWidgets.QLabel("你的昵称:"), 0, 0, 1, 1) +widgetLayout.addWidget(QtWidgets.QLabel("联系方式(电子邮箱):"), 0, 2, 1, 1) +widgetLayout.addWidget(QtWidgets.QLabel("评分:"), 0, 4, 1, 1) +widgetLayout.addWidget(QtWidgets.QLabel("反馈内容(支持 Markdown 格式):"), 1, 0, 1, 2) +widgetLayout.addWidget(nameThings, 0, 1, 1, 1) +widgetLayout.addWidget(contactThings, 0, 3, 1, 1) +widgetLayout.addWidget(starMenu, 0, 5, 1, 1) +widgetLayout.addWidget(updateThings, 2, 0, 1, 6) +widgetLayout.addLayout(otherUpload, 3, 0, 1, 5) +widgetLayout.addWidget(updateButton, 3, 5, 1, 1) +giteeButton.clicked.connect(OpenGiteeIssues) +githubButton.clicked.connect(OpenGithubIssues) +gitlinkButton.clicked.connect(OpenGitlinkIssues) +updateButton.clicked.connect(UpdateButtonClick) +widget.setLayout(widgetLayout) +window.setCentralWidget(widget) +window.setWindowTitle(f"UEngine 运行器 {version} 问题/建议反馈") +window.setWindowIcon(QtGui.QIcon(iconPath)) +window.show() +sys.exit(app.exec_()) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb new file mode 100755 index 0000000..85fe2be --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +######################################### +# 版本:1.8.0 +# 更新时间:2022年07月23日 +######################################### +import os +import sys +import traceback +import PyQt5.QtWidgets as QtWidgets +######################## +# +######################## +# 写入文本文档 +def write_txt(path: "路径", things: "内容")->"写入文本文档": + file = open(path, 'w', encoding='UTF-8') # 设置文件对象 + file.write(things) # 写入文本 + file.close() # 关闭文本对象 + +# 读取文本文档 +def readtxt(path: "路径")->"读取文本文档": + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +################### +# 判断是不是 root +################### +app = QtWidgets.QApplication(sys.argv) +if os.geteuid() != 0: + print("不是以 root 权限运行本程序!") + QtWidgets.QMessageBox.critical(None, "错误", "不是以 root 权限运行本程序!") + sys.exit(1) + +################### +# +################### +try: + if sys.argv[1] == "1" and QtWidgets.QMessageBox.question(None, "提示", "你确定要删除吗?", QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Ok: + os.remove("/data/uengine/data/data/misc/adb/adb_keys") + QtWidgets.QMessageBox.information(None, "提示", "完成") +except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(None, "错误", traceback.format_exc()) + sys.exit(2) +if sys.argv[1] == "1": + sys.exit(0) + +if QtWidgets.QMessageBox.question(None, "提示", '''请阅读以下提示然后确定是否继续: +1、安装后即可使用 adb 连接 UEngine; +2、重置 UEngine 或 adb 就需要重新设置该支持补丁; +3、需要 root 权限;''') == QtWidgets.QMessageBox.No: + sys.exit(0) +# 写入(需要 root) +if not os.path.exists("/data/uengine/data/data/misc/adb"): + QtWidgets.QMessageBox.critical(None, "错误", "无法读取 UEngine 数据!") + sys.exit(1) +try: + things = readtxt(sys.argv[2]) + adbKey = [] + # 提取内容 + for i in things.split('\n'): + adbKey.append(i[0: i.find(" ")]) + old = "" + if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"): + old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n" + write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey)) + QtWidgets.QMessageBox.information(None, "提示", "完成") +except: + traceback.print_exc() + QtWidgets.QMessageBox.information(None, "错误", traceback.format_exc()) + sys.exit(2) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py new file mode 100755 index 0000000..28e8136 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +import os +import sys +import shutil +import traceback + +def Add(): + try: + shutil.copy(f"/tmp/{sys.argv[2]}.txt", f"/usr/share/uengine/appetc/{sys.argv[2]}.txt") + except: + traceback.print_exc() + sys.exit(1) + +def Del(): + try: + os.remove(f"/usr/share/uengine/appetc/{sys.argv[2]}.txt") + except: + traceback.print_exc() + sys.exit(1) + +def Help(): + print("帮助:") + print("-?/--help 查看程序帮助") + print("-a/--add 设置程序显示配置(参数后面要加包名,配置需要先保存到 /tmp 下,文件名为“APK包名.txt”,需要 Root 权限)") + print("-d/--del 删除程序显示配置(参数后面要加包名,需要 Root 权限)") + +if __name__ == "__main__": + if len(sys.argv) < 3: + print("至少要三个参数,输入 --help 获取帮助") + sys.exit(0) + if "-?" in sys.argv[1] or "--help" in sys.argv: + Help() + sys.exit(0) + if os.geteuid() != 0: + print("不是以 root 权限运行本程序!") + sys.exit(1) + if sys.argv[1] == "-a" or sys.argv[1] == "--add": + Add() + sys.exit(0) + if sys.argv[1] == "-d" or sys.argv[1] == "--del": + Del() + sys.exit(0) + print("参数错误!") + sys.exit(1) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine_logo.svg b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine_logo.svg new file mode 100644 index 0000000..c77d1fe --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine_logo.svg @@ -0,0 +1,153 @@ + + + APPS_安卓容器_bonund256pt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/update-console.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/update-console.py new file mode 100755 index 0000000..a22ed64 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/update-console.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +import os +import sys +import json +import shutil +import requests +import traceback + +# 读取文本文档 +def read_txt(path): + f = open(path,"r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +def GetPackageUpdateInformation(): + global setting + global package + for i in allJson['Program']: + if i['Package'] == package: + return i + +try: + setting = json.loads(read_txt("{}/setting.json".format(os.path.split(os.path.realpath(__file__))[0]))) +except: + traceback.print_exc() + print("配置文件无法访问!") +package = setting['Package'] +nowVersion = setting['Version'] +try: + jsons = requests.get(setting["Url"]) +except: + traceback.print_exc() + print("服务器出现错误!") + sys.exit(1) +allJson = json.loads(jsons.text) +updateInformation = GetPackageUpdateInformation() +name = updateInformation['Name'] +newVersion = updateInformation['Version'] +print("更新程序:{}".format(name)) +print("最新版本:{}".format(newVersion)) +print("目前版本:{}".format(nowVersion)) +if nowVersion == newVersion: + print("目前是最新版本,无需更新!") + quit() +print("更新内容:") +print(updateInformation['New Things']) +choose = input("更新?[Y/N]") +if choose.upper() == "N": + quit() +if os.path.exists("/tmp/update-console-{}".format(package)): + shutil.rmtree("/tmp/update-console-{}".format(package)) +os.mkdir("/tmp/update-console-{}".format(package)) +if updateInformation["Linux App Url"][0] == None: + print("没有可用包源") + quit() +os.system("wget '{}' -P '/tmp/update-console-{}'".format(updateInformation["Linux App Url"][0], package)) +os.system("sudo dpkg -i /tmp/update-console-{}/*".format(package)) +os.system("sudo apt install -f -y") \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/info b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/info new file mode 100644 index 0000000..0e3caee --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/info @@ -0,0 +1,17 @@ +{ + "appid": "com.gitee.uengine.runner.spark", + "name": "com.gitee.uengine.runner.spark", + "version": "1.3.2", + "arch": ["all"], + "permissions": { + "autostart": false, + "notification": false, + "trayicon": false, + "clipboard": false, + "account": false, + "bluetooth": false, + "camera": false, + "audio_record": false, + "installed_apps": false + } +} diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/runner.png b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/runner.png deleted file mode 100644 index 0b0f47a..0000000 Binary files a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/runner.png and /dev/null differ 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 6389a9b..89bd788 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 @@ -3,7 +3,7 @@ ########################################################################################### # 作者:gfdgd xi # 版本:1.7.0 -# 更新时间:2022年07月08日(暑假了) +# 更新时间:2022年07月23日 # 感谢:anbox、deepin 和 统信 # 基于 Python3 的 tkinter 构建 ########################################################################################### @@ -19,78 +19,88 @@ import zipfile import traceback import threading import subprocess -import ttkthemes -import tkinter as tk -import tkinter.ttk as ttk -import tkinter.messagebox as messagebox -import tkinter.filedialog as filedialog +import PyQt5.QtGui as QtGui +import PyQt5.QtCore as QtCore +import PyQt5.QtWidgets as QtWidgets from getxmlimg import getsavexml def FindApk(): - path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"]) + path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 APK", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"], "APK 可执行文件(*.apk);;所有文件(*.*)") if path != "" and path != "()": try: - combobox1.set(path) - write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 + combobox1.setEditText(path[0]) + write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path[0])})) # 写入配置文件 except: - pass + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + +class QT: + run = None def BuildDeb(): - if combobox1.get() == "": - messagebox.showerror(title="提示", message="信息没有填写完整,无法继续打包 APK") + if combobox1.currentText() == "": + QtWidgets.QMessageBox.critical(None, "提示", "信息没有填写完整,无法继续打包 APK") return - if not os.path.exists(combobox1.get()): - messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK") + if not os.path.exists(combobox1.currentText()): + QtWidgets.QMessageBox.critical(None, "提示", "信息填写错误,无法继续打包 APK") return DisabledAndEnbled(True) - threading.Thread(target=GetBuildApkDebError, args=(combobox1.get(),)).start() + QT.run = BuildApkDeb(combobox1.currentText()) + QT.run.signal.connect(TextboxAddText1) + QT.run.labelChange.connect(ChangeItems) + QT.run.tips.connect(TipsMessagebox) + QT.run.start() -def RunCommandShow(command): - TextboxAddText1("$> {}".format(command) + "\n") - res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - # 实时读取程序返回 - while res.poll() is None: - try: - texts = res.stdout.readline().decode("utf8") - except: - texts = "" - print(texts, end="") - TextboxAddText1(texts) +class BuildApkDeb(QtCore.QThread): + signal = QtCore.pyqtSignal(str) + labelChange = QtCore.pyqtSignal(str) + tips = QtCore.pyqtSignal(str) + + def __init__(self, apkPath) -> None: + self.apkPath = apkPath + super().__init__() + + def RunCommandShow(self, command): + if command.replace(" ", "").replace("\n", "") == "": + return + self.signal.emit("$> {}".format(command)) + res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 实时读取程序返回 + while res.poll() is None: + try: + texts = res.stdout.readline().decode("utf8") + except: + texts = "" + print(texts, end="") + self.signal.emit(texts) # 已废弃 # TextboxAddText1(GetCommandReturn(command)) -def GetBuildApkDebError(apkPath): - try: - BuildApkDeb(apkPath) - except: - traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) - DisabledAndEnbled(False) - -def BuildApkDeb(apkPath): - textbox1.delete("1.0","end") - tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024))) - RunCommandShow("echo '======================================New===================================='") - RunCommandShow("echo '创建目录'") - RunCommandShow("mkdir -pv '{}/DEBIAN'".format(tempPath)) - RunCommandShow("mkdir -pv '{}/usr/share/applications'".format(tempPath)) - RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath)) - RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath)) - RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'") - apkPackageName = GetApkPackageName(apkPath, False) - if qianZhui.get(): - apkPackageNameNew = GetApkPackageName(apkPath, True).lower() - else: - apkPackageNameNew = GetApkPackageName(apkPath, False).lower() - apkPackageVersion = GetApkVersion(apkPath) - if apkPackageVersion[0].upper() == "V": - package = list(apkPackageVersion) - package.pop(0) - apkPackageVersion = "".join(package) - apkChineseLabel = GetApkChineseLabel(apkPath) - apkActivityName = GetApkActivityName(apkPath) - iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew) - debControl = '''Package: {} + def run(self): + try: + apkPath = self.apkPath + tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024))) + self.RunCommandShow("echo '======================================New===================================='") + self.RunCommandShow("echo '创建目录'") + self.RunCommandShow("mkdir -pv '{}/DEBIAN'".format(tempPath)) + self.RunCommandShow("mkdir -pv '{}/usr/share/applications'".format(tempPath)) + self.RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath)) + self.RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath)) + self.RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'") + apkPackageName = GetApkPackageName(apkPath, False) + if check.isChecked(): + apkPackageNameNew = GetApkPackageName(apkPath, True).lower() + else: + apkPackageNameNew = GetApkPackageName(apkPath, False).lower() + apkPackageVersion = GetApkVersion(apkPath) + if apkPackageVersion[0].upper() == "V": + package = list(apkPackageVersion) + package.pop(0) + apkPackageVersion = "".join(package) + apkChineseLabel = GetApkChineseLabel(apkPath) + apkActivityName = GetApkActivityName(apkPath) + iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew) + debControl = '''Package: {} Version: {} Architecture: all Maintainer: {} @@ -98,7 +108,7 @@ Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1) Section: utils Priority: optional Description: {}\n'''.format(apkPackageNameNew, apkPackageVersion, apkChineseLabel, apkChineseLabel) - debPostinst = '''#!/bin/sh + debPostinst = '''#!/bin/sh APK_DIR="/usr/share/uengine/apk" APK_NAME="{}" @@ -135,7 +145,7 @@ fi /usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH" exit 0'''.format(apkPackageNameNew + ".apk", "/usr/share/applications/{}.desktop".format(apkPackageNameNew)) - debPrerm = '''#!/bin/sh + debPrerm = '''#!/bin/sh APP_NAME="{}" DESKTOP_FILE="{}" @@ -157,7 +167,7 @@ echo "Uninstalling $APP_NAME" /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME" exit 0'''.format(apkPackageName, "/usr/share/applications/{}.desktop".format(apkPackageNameNew)) - desktopFile = '''[Desktop Entry] + desktopFile = '''[Desktop Entry] Categories=Other; Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} Icon=/usr/share/uengine/icons/{}.png @@ -166,54 +176,63 @@ Type=Application GenericName={} Name={} ''' - #RunCommandShow("echo '{}' > '{}/DEBIAN/control'".format(debControl, tempPath)) - RunCommandShow("echo 正在写入文件:'{}/DEBIAN/control'".format(tempPath)) - write_txt("{}/DEBIAN/control".format(tempPath), debControl) - RunCommandShow("echo 正在写入文件:'{}/DEBIAN/postinst'".format(tempPath)) - write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst) - RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath)) - write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm) - RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageNameNew)) - #write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), desktopFile) - BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew), + #self.RunCommandShow("echo '{}' > '{}/DEBIAN/control'".format(debControl, tempPath)) + self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/control'".format(tempPath)) + write_txt("{}/DEBIAN/control".format(tempPath), debControl) + self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/postinst'".format(tempPath)) + write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst) + self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath)) + write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm) + self.RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageNameNew)) + #write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), desktopFile) + BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew), "{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew)) - RunCommandShow("echo '复制文件'") - RunCommandShow("echo '写入 APK 软件图标'") - SaveApkIcon(apkPath, iconSavePath) - RunCommandShow("echo '复制 APK 文件'") - RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew)) - RunCommandShow("echo '正在设置文件权限……'") - RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath)) - RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath)) - RunCommandShow("echo '打包 deb 到桌面……'") - RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, apkPackageVersion)) - RunCommandShow("echo '正在删除临时目录……'") - RunCommandShow("rm -rfv '{}'".format(tempPath)) - RunCommandShow("echo '完成!'") - findApkHistory.append(apkPath) - combobox1['value'] = findApkHistory - write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 - messagebox.showinfo(title="提示", message="打包完成") - DisabledAndEnbled(False) + self.RunCommandShow("echo '复制文件'") + self.RunCommandShow("echo '写入 APK 软件图标'") + SaveApkIcon(apkPath, iconSavePath) + self.RunCommandShow("echo '复制 APK 文件'") + self.RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew)) + self.RunCommandShow("echo '正在设置文件权限……'") + self.RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath)) + self.RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath)) + self.RunCommandShow("echo '打包 deb 到桌面……'") + self.RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, apkPackageVersion)) + self.RunCommandShow("echo '正在删除临时目录……'") + self.RunCommandShow("rm -rfv '{}'".format(tempPath)) + self.RunCommandShow("echo '完成!'") + findApkHistory.append(apkPath) + self.labelChange.emit("") + write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + DisabledAndEnbled(False) + self.tips.emit("打包完成") + + except: + DisabledAndEnbled(False) + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + +def TipsMessagebox(tips): + QtWidgets.QMessageBox.information(widget, "提示", tips) + +def ChangeItems(self): + combobox1.clear() + combobox1.addItems(findApkHistory) + #combobox1.setEditText("") def DisabledAndEnbled(choose): - userChoose = {True: tk.DISABLED, False: tk.NORMAL} - a = userChoose[choose] - combobox1.configure(state=a) - check.configure(state=a) - button2.configure(state=a) - button3.configure(state=a) - -# 需引入 subprocess -def GetCommandReturn(cmd): - # cmd 是要获取输出的命令 - return subprocess.getoutput(cmd) + combobox1.setDisabled(choose) + check.setDisabled(choose) + button2.setDisabled(choose) + button3.setDisabled(choose) # 重启本应用程序 def ReStartProgram(): python = sys.executable os.execl(python, python, * sys.argv) +def GetCommandReturn(command): + return subprocess.getoutput(command) + # 获取用户主目录 def get_home(): return os.path.expanduser('~') @@ -354,9 +373,7 @@ def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": def TextboxAddText1(message): global textbox1 - textbox1.configure(state=tk.NORMAL) - textbox1.insert(tk.END,message) - textbox1.configure(state=tk.DISABLED) + textbox1.append(message) # 获取用户桌面目录 def get_desktop_path(): @@ -388,7 +405,7 @@ if not lang in langFile.keys(): information = json.loads(readtxt(programPath + "/information.json")) version = information["Version"] title = "{} {}".format(langFile[lang]["Uengine Apk Builder"]["Title"], version) -iconPath = "{}/builer.png".format(os.path.split(os.path.realpath(__file__))[0]) +iconPath = "{}/builer.svg".format(os.path.split(os.path.realpath(__file__))[0]) ########################### # 加载配置 @@ -408,6 +425,53 @@ findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/F ########################### # 窗口创建 ########################### +app = QtWidgets.QApplication(sys.argv) +# 权重 +size = QtWidgets.QSizePolicy() +size.setHorizontalPolicy(0) +widgetSize = QtWidgets.QSizePolicy() +widgetSize.setVerticalPolicy(0) +# +window = QtWidgets.QMainWindow() +widget = QtWidgets.QWidget() +widgetLayout = QtWidgets.QGridLayout() +combobox1 = QtWidgets.QComboBox() +label1 = QtWidgets.QLabel(langFile[lang]["Uengine Apk Builder"]["label1"]) +button2 = QtWidgets.QPushButton(langFile[lang]["Uengine Apk Builder"]["button2"]) +button3 = QtWidgets.QPushButton(langFile[lang]["Uengine Apk Builder"]["button3"]) +textbox1 = QtWidgets.QTextBrowser() +frame2 = QtWidgets.QHBoxLayout() +check = QtWidgets.QCheckBox(langFile[lang]["Uengine Apk Builder"]["check"]) +label1.setSizePolicy(size) +button2.setSizePolicy(size) +check.setSizePolicy(size) +button3.setSizePolicy(size) +combobox1.setEditable(True) +combobox1.addItems(findApkHistory) +combobox1.setEditText("") +button2.clicked.connect(FindApk) +button3.clicked.connect(BuildDeb) +widgetLayout.addWidget(label1, 0, 0, 1, 1) +widgetLayout.addWidget(combobox1, 0, 1, 1, 1) +widgetLayout.addWidget(button2, 0, 2, 1, 1) +widgetLayout.addLayout(frame2, 1, 0, 1, 3) +widgetLayout.addWidget(textbox1, 2, 0, 1, 3) +# 菜单栏 +menu = window.menuBar() +programmenu = menu.addMenu(langFile[lang]["Uengine Apk Builder"]["Menu"][0]["Name"]) +exitProgram = QtWidgets.QAction(langFile[lang]["Uengine Apk Builder"]["Menu"][0]["Menu"][0]) +exitProgram.triggered.connect(window.close) +programmenu.addAction(exitProgram) +# +frame2.addWidget(check) +frame2.addWidget(button3) +widget.setLayout(widgetLayout) +window.setWindowTitle(title) +window.setCentralWidget(widget) +window.setWindowIcon(QtGui.QIcon(iconPath)) +window.resize(window.frameSize().width() * 1.3, window.frameSize().height() * 1.1) +window.show() +sys.exit(app.exec_()) # 读取主题 try: theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0")) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-setting.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-setting.py new file mode 100644 index 0000000..2fca036 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-setting.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +from modulefinder import packagePathMap +import sys +import ttkthemes +import tkinter as tk +import tkinter.ttk as ttk + +def main(): + window = tk.Tk() + ttk.Label(window, text="程序包名:").grid(row=0, column=0) + packageName = ttk.Combobox(window) + packageName.grid(row=0, column=1) + settingFrame = ttk.Frame(window) + readButton = ttk.Button(window, text="确定").grid(row=0, column=2) + settingFrame.grid(row=1, column=0, columnspan=3) + hScreenSize = ttk.Labelframe(settingFrame, text="竖屏默认分辨率") + vScreenSize = ttk.Labelframe(settingFrame, text="横屏默认分辨率") + hScreenSizeWidthValue = ttk.Entry(hScreenSize) + hScreenSizeHeightValue = ttk.Entry(hScreenSize) + hScreenSizeWidthValue.grid(row=0, column=0) + ttk.Label(hScreenSize, text="×").grid(row=0, column=1) + hScreenSizeHeightValue.grid(row=0, column=2) + vScreenSizeWidthValue = ttk.Entry(vScreenSize) + vScreenSizeHeightValue = ttk.Entry(vScreenSize) + vScreenSizeWidthValue.grid(row=0, column=0) + ttk.Label(vScreenSize, text="×").grid(row=0, column=1) + vScreenSizeHeightValue.grid(row=0, column=2) + hScreenSize.grid(row=0, column=0) + vScreenSize.grid(row=1, column=0) + window.mainloop() + return 0 + +if __name__ == "__main__": + sys.exit(main()) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard index 5ec0b70..eaf54a7 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard @@ -1,9 +1,9 @@ #!/usr/bin/env python3 -######################################### -# 版本:1.6.1 -# 更新时间:2022年10月06日 +############################################################### +# 版本:1.8.0 +# 更新时间:2022年07月26日 # Need: unix, python3-tk, python3-pip, pymouse, keyboard -######################################### +############################################################### import os import sys import time @@ -18,8 +18,6 @@ import tkinter as tk import tkinter.ttk as ttk import tkinter.messagebox as messagebox import tkinter.filedialog as filedialog -import Xlib.threaded as threaded -#import pymouse.unix as pymouse ######################## # ######################## @@ -30,7 +28,6 @@ def Inputt(key): Setting(key) else: Mouse(key) - #Mouse(key) def Open(): path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]]) @@ -56,13 +53,12 @@ def Mouse(key): if keybo.__contains__(key.name): print(keybo[key.name]["MousePlace"]) pyautogui.FAILSAFE = False - #os.system(programPath + "/mouse.py {} {}".format(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])) try: + print((keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])) pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]) + except: - pass - #pyautogui.click(1500, 800) - #m.click(keybo[key.name]["MousePlace"][0],keybo[key.name]["MousePlace"][1]) + traceback.print_exc() def Setting(key): if key.event_type == 'up': @@ -105,11 +101,8 @@ def ShowTips(): def Closing(): global close close = True - window.destroy() - #key.close() - #stop_thread(keys) - keyboard.unhook(Inputt) - sys.exit(0) + # 偷懒了,直接强制关闭进程 + os.system(f"kill {os.getpid()}") def Key(): @@ -145,6 +138,20 @@ def Clean(): def About(): threading.Thread(target=os.system, args=["{}/uengine-runner-about".format(programPath)]).start() +lock = False +def ThreadCheck(): + global lock + lock = True + pyautogui.position() + lock = False + +def RestartProgramTimer(): + threading.Thread(target=ThreadCheck).start() + time.sleep(0.1) + if lock: + ReStartProgram() + RestartProgramTimer() + ################### # ################### @@ -226,16 +233,9 @@ settingMouseToKeyboard.grid(row=0, column=0) settingButton.grid(row=0, column=1) win.pack(fill="both", expand="yes") -#threaded.lock.allocate_lock() keys = threading.Thread(target=Key) keys.start() threading.Thread(target=ShowTips).start() pyautogui.FAILSAFE = False -'''def B(key): - if key.event_type == "up": - print(pyautogui.position()) - print(key.name) - pyautogui.click(1500, 800) -keyboard.hook(B) -keyboard.wait()''' +threading.Thread(target=RestartProgramTimer).start() window.mainloop() \ No newline at end of file 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 7086ad6..bde5c2b 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 @@ -2,10 +2,10 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi<3025613752@qq.com> -# 版本:1.7.0 -# 更新时间:2022年07月08日(暑假了) +# 版本:1.8.0 +# 更新时间:2022年07月25日 # 感谢:anbox、deepin 和 UOS -# 基于 Python3 的 tkinter 构建 +# 基于 Python3 的 PyQt5 构建 # 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>、为什么您不喜欢熊出没和阿布呢 ########################################################################################### ################# @@ -16,157 +16,246 @@ import api import sys import time import json +import numpy import shutil import zipfile +import requests import traceback import threading -import easygui -import ttkthemes import webbrowser import subprocess import matplotlib -import requests -import numpy import matplotlib.figure import matplotlib.pylab import matplotlib.font_manager -import PIL.Image as Image -import PIL.ImageTk as ImageTk -import tkinter as tk -import tkinter.ttk as ttk -import tkinter.messagebox as messagebox -import tkinter.filedialog as filedialog -import tkinter.simpledialog as simpledialog +import PyQt5.QtGui as QtGui +import PyQt5.QtCore as QtCore +import PyQt5.QtWidgets as QtWidgets from getxmlimg import getsavexml +class UninstallProgram(QtCore.QThread): + info = QtCore.pyqtSignal(str) + error = QtCore.pyqtSignal(str) + combo = QtCore.pyqtSignal(int) + def __init__(self, package) -> None: + self.package = package + super().__init__() + + def run(self): + package = self.package + try: + global fineUninstallApkHistory + Return = os.system("uengine uninstall --pkg='{}'".format(package)) + print(Return) + if Return != 0: + 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(get_desktop_path(), package)): + os.remove("{}/{}.desktop".format(get_desktop_path(), package)) + findApkHistory.append(ComboInstallPath.currentText()) + self.combo.emit(0) + write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + self.info.emit("操作执行完毕!") + DisabledAndEnbled(False) + except: + traceback.print_exc() + self.error.emit(traceback.format_exc()) + DisabledAndEnbled(False) # 卸载程序 -def UninstallProgram(package: "apk 包名")->"卸载程序": - try: - global fineUninstallApkHistory - Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package)) - print(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(get_desktop_path(), package)): - os.remove("{}/{}.desktop".format(get_desktop_path(), package)) - findApkHistory.append(ComboInstallPath.get()) - ComboInstallPath['value'] = findApkHistory - write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 - messagebox.showinfo(message="操作执行完毕!", title="提示") - DisabledAndEnbled(False) - return Return - except: - traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) - DisabledAndEnbled(False) +#def UninstallProgram(package: "apk 包名")->"卸载程序": +# pass # 卸载按钮事件 def ButtonClick8(): - if ComboInstallPath.get() is "": - messagebox.showerror(title="提示", message=langFile[lang]["Main"]["MainWindow"]["Error"]["UninstallError"]) - + if ComboInstallPath.currentText() is "": + QtWidgets.QMessageBox.information(widget, "提示", langFile[lang]["Main"]["MainWindow"]["Error"]["UninstallError"]) return DisabledAndEnbled(True) - if os.path.exists(ComboInstallPath.get()): - path = GetApkPackageName(ComboInstallPath.get()) + if os.path.exists(ComboInstallPath.currentText()): + path = GetApkPackageName(ComboInstallPath.currentText()) else: - path = ComboInstallPath.get() + path = ComboInstallPath.currentText() print(path) - threading.Thread(target=UninstallProgram, args=[path]).start() + QT.installRun = UninstallProgram(path) + QT.installRun.error.connect(ErrorBox) + QT.installRun.info.connect(InformationBox) + QT.installRun.combo.connect(UpdateCombobox) + QT.installRun.start() + #threading.Thread(target=UninstallProgram, args=[path]).start() # 浏览窗口 temppath="" def FindApk()->"浏览窗口": - path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApk.json"))["path"]) + path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 Apk", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApk.json"))["path"], "APK 文件(*.apk);;所有文件(*.*)")[0] global temppath temppath = path print("apk path is find:" + path) if path != "" and path != "()": try: - ComboInstallPath.set(path) + ComboInstallPath.setEditText(path) write_txt(get_home() + "/.config/uengine-runner/FindApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 except: pass +class QT: + installRun = None + # 安装按钮事件 def Button3Install(): - if ComboInstallPath.get() is "" or not os.path.exists(ComboInstallPath.get()): - messagebox.showerror(title="提示", message=langFile[lang]["Main"]["MainWindow"]["Error"]["InstallError"]) + if ComboInstallPath.currentText() is "" or not os.path.exists(ComboInstallPath.currentText()): + QtWidgets.QMessageBox.information(widget, "提示", langFile[lang]["Main"]["MainWindow"]["Error"]["InstallError"]) return DisabledAndEnbled(True) - threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start() + #threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start() + QT.installRun = InstallApk(ComboInstallPath.currentText()) + QT.installRun.infor.connect(InformationBox) + QT.installRun.error.connect(ErrorBox) + QT.installRun.combo.connect(UpdateCombobox) + QT.installRun.make.connect(InstallBuildDesktop) + QT.installRun.start() # 安装应用 -def InstallApk(path: "apk 路径", quit: "是否静默安装" = False): - 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())): - print("Mkdir") - os.makedirs("{}/.local/share/applications/uengine/".format(get_home())) - # 读取设置 - setting = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) - # 安装应用 - print("start install apk") - global findApkHistory - print("start install apk12") - iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path)) - tempstr1 = iconSavePath - print("start install apk1") - iconSaveDir = os.path.dirname(iconSavePath) - if not os.path.exists(iconSaveDir): - os.makedirs(iconSaveDir,exist_ok=True) - SaveApkIcon(path, iconSavePath) +class InstallApk(QtCore.QThread): + infor = QtCore.pyqtSignal(str) + error = QtCore.pyqtSignal(str) + combo = QtCore.pyqtSignal(int) + make = QtCore.pyqtSignal(str) + + def __init__(self, path, quit = False) -> None: + self.path = path + self.quit = quit + super().__init__() + + def run(self): + path = self.path + quit = self.quit try: - if setting["SaveApk"]: - shutil.copy(path, "/tmp/uengine-runner/bak.apk") - except: - if not messagebox.askyesno(title="错误", message="无法备份安装包,是否不备份安装包继续安装?\n提示:新版UEngine安装后会自动删除安装包"): + 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())): + print("Mkdir") + os.makedirs("{}/.local/share/applications/uengine/".format(get_home())) + # 读取设置 + setting = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) + # 安装应用 + print("start install apk") + global findApkHistory + print("start install apk12") + iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path)) + tempstr1 = iconSavePath + print("start install apk1") + iconSaveDir = os.path.dirname(iconSavePath) + if not os.path.exists(iconSaveDir): + os.makedirs(iconSaveDir,exist_ok=True) + SaveApkIcon(path, iconSavePath) + try: + if setting["SaveApk"]: + shutil.copy(path, "/tmp/uengine-runner/bak.apk") + except: + if QtWidgets.QMessageBox.critical(widget, "错误", "无法备份安装包,是否不备份安装包继续安装?\n提示:新版UEngine安装后会自动删除安装包") == QtWidgets.QMessageBox.No: + DisabledAndEnbled(False) + return + setting["SaveApk"] = False + print("start install apk2") + commandReturn = os.system("uengine install --apk='{}'".format(path)) + try: + if setting["SaveApk"]: + shutil.copy("/tmp/uengine-runner/bak.apk", path) + except: + self.error.emit(langFile[lang]["Main"]["MainWindow"]["Error"]["BackApkError"]) + if commandReturn != 0: + self.error.emit("疑似 APK 安装失败,请检查 UEngine 是否正常安装、运行以及 APK 文件是否正确、完整") DisabledAndEnbled(False) return - setting["SaveApk"] = False - print("start install apk2") - BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, + if settingConf["AutoScreenConfig"]: + # 计算最合适的大小 + # 竖屏 + screen = QtGui.QGuiApplication.primaryScreen() + mm = screen.availableGeometry() + verticalHeighe = int(mm.height() * 0.9) # 竖屏高 + verticalWidth = int(verticalHeighe / 16 * 9) # 竖屏宽 + horizontaltWidth = int(mm.width() * 0.8) # 横屏宽 + horizontaltHeighe = int(horizontaltWidth / 16 * 9) # 横屏高 + + #verticalHeighe = + write_txt(f"/tmp/{GetApkPackageName(path)}.txt", f"""verticalWidth {verticalWidth} //竖屏宽 +verticalHeighe {verticalHeighe} //竖屏高 +horizontaltWidth {horizontaltWidth} //横屏宽,备选为1280 +horizontaltHeighe {horizontaltHeighe} //横屏高 ,备选为720 +verticalScreen 1 //设置默认横屏还是竖屏,1为竖屏,0为横屏 +allowFullScreen 1 //设置是否允许全屏,1为允许,0为不允许 +allowScreenSwitching 1 //设置是否允许横竖屏切换,1为允许,0为不允许 +defaultFullScreen 0 //设置是否默认显示最大化,1为默认最大化,0为不是 + +logicalDensityDpi 160 +physicalDpi 72 +appWidth {verticalWidth} +appHeight {verticalHeighe} +logicalWidth {verticalWidth} +logicalHeight {verticalHeighe} +""") + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -a {GetApkPackageName(path)}"): + self.error.emit("屏幕配置设置失败") + DisabledAndEnbled(False) + return + if settingConf["ChooseProgramType"]: + self.make.emit(iconSavePath) + else: + BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, "{}/{}.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))) - commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path)) - print(commandReturn) - try: - if setting["SaveApk"]: - shutil.copy("/tmp/uengine-runner/bak.apk", path) + print("start install apk3") + BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, + "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path))) + print("\nprint install complete") + if quit: + return + findApkHistory.append(ComboInstallPath.currentText()) + self.combo.emit(0) + write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 + self.infor.emit("操作完成!") except: - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["BackApkError"]) - print("\nprint install complete") - if quit: - print(commandReturn) - return - messagebox.showinfo(title="提示", message="操作完成!") - findApkHistory.append(ComboInstallPath.get()) - ComboInstallPath['value'] = findApkHistory - write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 - except: - traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) - DisabledAndEnbled(False) + traceback.print_exc() + self.error.emit(traceback.format_exc()) + DisabledAndEnbled(False) + +def InstallBuildDesktop(iconSavePath): + choose = QtWidgets.QInputDialog.getItem(widget, "提示", "请选择分类,如果点击取消,将会设置为默认的分类", ["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility"])[0] + path = ComboInstallPath.currentText() + BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), 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) + print("\nprint install complete") + +def UpdateCombobox(tmp): + ComboInstallPath.clear() + ComboInstallPath.addItems(findApkHistory) + ComboInstallPath.setEditText(findApkHistory[-1]) + +def ErrorBox(error): + QtWidgets.QMessageBox.critical(widget, "错误", error) + +def InformationBox(info): + QtWidgets.QMessageBox.information(widget, "提示", info) # 禁用或启动所有控件 def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控件": - userChoose = {True: tk.DISABLED, False: tk.NORMAL} - a = userChoose[choose] - ComboInstallPath.configure(state=a) + ComboInstallPath.setDisabled(choose) #ComboUninstallPath.configure(state=a) - BtnFindApk.configure(state=a) - BtnInstall.configure(state=a) - BtnShowUengineApp.configure(state=a) + BtnFindApk.setDisabled(choose) + BtnInstall.setDisabled(choose) + BtnShowUengineApp.setDisabled(choose) #BtnUninstallApkBrowser.configure(state=a) - BtnUninstall.configure(state=a) - Btngeticon.configure(state=a) - BtnSaveApk.configure(state=a) - BtnApkInformation.configure(state=a) - LabApkPath.configure(state=a) + BtnUninstall.setDisabled(choose) + Btngeticon.setDisabled(choose) + BtnSaveApk.setDisabled(choose) + BtnApkInformation.setDisabled(choose) + LabApkPath.setDisabled(choose) # 需引入 subprocess # 运行系统命令并获取返回值 @@ -188,15 +277,6 @@ def Button5Click(): def OpenUengineProgramList()->"打开“uengine 所有程序列表”": os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") -# 显示“提示”窗口 -def helps()->"显示“提示”窗口": - global tips - messagebox.showinfo(title="提示", message=tips) - -# 显示更新内容窗口 -def UpdateThings()->"显示更新内容窗口": - messagebox.showinfo(title="更新内容", message=updateThings) - # 打开程序官网 def OpenProgramURL()->"打开程序官网": webbrowser.open_new_tab(programUrl) @@ -209,12 +289,12 @@ def ReStartProgram()->"重启本应用程序": # 清理历史记录 def CleanProgramHistory()->"清理历史记录": try: - if messagebox.askokcancel(title="警告", message="删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。"): + if QtWidgets.QMessageBox.warning(widget, "警告", "删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Ok: shutil.rmtree(get_home() + "/.config/uengine-runner") ReStartProgram() except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) # 获取用户主目录 def get_home()->"获取用户主目录": @@ -231,14 +311,14 @@ def SendUengineAndroidListForDesktop()->"发送“启动 uengine 所有程序” DisabledAndEnbled(True) try: if os.path.exists("{}/{}".format(get_desktop_path(), desktopName)): - if not messagebox.askokcancel(title="提示", message="桌面已经存在快捷方式,你确定要覆盖吗?"): + if QtWidgets.QMessageBox.question(widget, "提示", "桌面已经存在快捷方式,你确定要覆盖吗?") == QtWidgets.QMessageBox.No: DisabledAndEnbled(False) return shutil.copy(desktop, get_desktop_path()) - messagebox.showinfo(title="提示", message="发送成功!") + QtWidgets.QMessageBox.critical(widget, "提示", "发送成功!") except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) DisabledAndEnbled(False) # 获取用户桌面目录 @@ -261,17 +341,17 @@ def SendUengineAndroidListForLauncher()->"发送“启动 uengine 所有程序 DisabledAndEnbled(True) try: if os.path.exists("{}/.local/share/applications/{}".format(get_home(), desktopName)): - if not messagebox.askokcancel(title="提示", message="启动器已经存在快捷方式,你确定要覆盖吗?"): + if QtWidgets.QMessageBox.question(widget, "提示", "启动器已经存在快捷方式,你确定要覆盖吗?") == QtWidgets.QMessageBox.No: DisabledAndEnbled(False) return if not os.path.exists("{}/.local/share/applications/".format(get_home())): os.makedirs("{}/.local/share/applications/".format(get_home())) shutil.copy(desktop, "{}/.local/share/applications/{}".format(get_home(), desktopName)) os.system("chmod 755 {}/.local/share/applications/{}".format(get_home(), desktopName)) - messagebox.showinfo(title="提示", message="发送成功!") + QtWidgets.QMessageBox.critical(widget, "提示", "发送成功!") except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) DisabledAndEnbled(False) # 数组转字典 @@ -341,27 +421,41 @@ def UbuntuInstallUengine(): threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath + '/uengine-installer'}'\""]).start() def BuildRootUengineImage(): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath + '/root-uengine.sh'}'\""]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath}/root-uengine.sh'\""]).start() def ReinstallUengineImage(): threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e ''pkexec apt reinstall uengine-android-image -y"]).start() # 生成 uengine 启动文件到桌面 -def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径")->"生成 uengine 启动文件到桌面": +def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径", choose="")->"生成 uengine 启动文件到桌面": if showName == "" or showName == None: showName = "未知应用" - things = '''[Desktop Entry] -Categories=app; + if choose != "": + things = f'''[Desktop Entry] Encoding=UTF-8 -Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} -GenericName={} -Icon={} +Exec=uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName} +GenericName={showName} +Icon={iconPath} MimeType= -Name={} -StartupWMClass={} +Name={showName} +StartupWMClass={showName} +Categories={choose}; Terminal=false Type=Application -'''.format(packageName, activityName, showName, iconPath, showName, showName) +''' + else: + things = f'''[Desktop Entry] +Categories=app; +Encoding=UTF-8 +Exec=uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName} +GenericName={showName} +Icon={iconPath} +MimeType= +Name={showName} +StartupWMClass={showName} +Terminal=false +Type=Application +''' write_txt(savePath, things) # 获取软件的中文名称 @@ -410,38 +504,38 @@ def saveicon(): def KeyboardToMouse(): threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-keyboard".format(programPath)]).start() -# 用户自行保存APK +# 用户自行保存 def SaveIconToOtherPath(): - apkPath = ComboInstallPath.get() + apkPath = ComboInstallPath.currentText() if apkPath == "": - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ChooseApkError"]) + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ChooseApkError"]) return - path = filedialog.asksaveasfilename(title="保存图标", filetypes=[("PNG 图片", "*.png"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApkIcon.json"))["path"]) + path = QtWidgets.QFileDialog.getSaveFileName(widget, "保存图标", "icon.png", "PNG 图片(*.png);;所有文件(*.*)", json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApkIcon.json"))["path"])[0] if not path == "": try: SaveApkIcon(apkPath, path) except: traceback.print_exc() - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["SaveApkIconError"]) + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SaveApkIconError"]) return write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 - findApkHistory.append(ComboInstallPath.get()) - ComboInstallPath['value'] = findApkHistory + findApkHistory.append(ComboInstallPath.currentText()) + UpdateCombobox(0) write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入 - messagebox.showinfo(title="提示", message="保存成功!") + QtWidgets.QMessageBox.information(widget, "提示", "保存成功!") # 清空 uengine 数据 def BackUengineClean()->"清空 uengine 数据": print("Choose") - if messagebox.askokcancel(title="警告", message="清空后数据将会完全丢失,确定要继续吗?"): + 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())) except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) - InstallWindow.ShowWindows("pkexec rm -rfv /data/uengine") + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"pkexec rm -rfv /data/uengine\"") return print("Choose False") @@ -497,14 +591,14 @@ def ScrcpyConnectUengine(): if os.path.exists("/snap/bin/scrcpy"): threading.Thread(target=os.system, args=["/snap/bin/scrcpy -s '192.168.250.2:5555'"]).start() return - if messagebox.askyesno(title="提示", message="你没有安装Scrcpy(指使用Snap安装),\n如果你使用了其他方法安装了Scrcpy,可以输入命令“scrcpy -s '192.168.250.2:5555'”,\n是否现在要使用Snap安装Scrcpy?"): + if QtWidgets.QMessageBox.question(widget, "提示", "你没有安装Scrcpy(指使用Snap安装),\n如果你使用了其他方法安装了Scrcpy,可以输入命令“scrcpy -s '192.168.250.2:5555'”,\n是否现在要使用Snap安装Scrcpy?") == QtWidgets.QMessageBox.Yes: if not os.path.exists("/tmp/uengine-runner"): os.makedirs("/tmp/uengine-runner") write_txt("/tmp/uengine-runner/InstallScrcpy.sh", '''#!/bin/bash sudo apt install snapd -y sudo snap refresh sudo snap install scrcpy''') - threading.Thread(target=InstallWindow.ShowWindows, args=["chmod 777 /tmp/uengine-runner/InstallScrcpy.sh -Rv && pkexec /tmp/uengine-runner/InstallScrcpy.sh"]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"chmod 777 /tmp/uengine-runner/InstallScrcpy.sh -Rv && pkexec /tmp/uengine-runner/InstallScrcpy.sh\""]).start() return # 获取用户桌面目录 @@ -525,26 +619,27 @@ def get_desktop_path()->"获取用户桌面目录": # 提取已安装程序的apk def SaveInstallUengineApp(): while True: - result = simpledialog.askstring(title="输入apk包名", prompt="请输入要获取的apk包名以便进行下一步操作") - if result == "" or result == None: + result = QtWidgets.QInputDialog.getText(widget, "输入 APK 包名", "请输入要获取的apk包名以便进行下一步操作") + if result[1] == False: return + result = result[0] if os.path.exists("/data/uengine/data/data/app/{}-1".format(result)): break - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["PathError"]) - path = filedialog.asksaveasfilename(title="保存apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApk.json"))["path"]) + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["PathError"]) + path = QtWidgets.QFileDialog.getSaveFileName(widget, "保存apk", "~", "APK 文件(*.apk);;所有文件(*.*)", json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApk.json"))["path"])[0] if path == "" or path == (): return try: shutil.copy("/data/uengine/data/data/app/{}-1/base.apk".format(result), path) write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": os.path.dirname(path)})) - messagebox.showinfo(title="提示", message="提取完成!") + QtWidgets.QMessageBox.information(widget, "提示", "提取完成!") except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) def UengineCheckCpu(): english = GetCommandReturn("uengine check-features") - messagebox.showinfo(title="提示", message="{}".format(english)) + QtWidgets.QMessageBox.information(widget, "提示", english) # 获取用户主目录 def get_home()->"获取用户主目录": @@ -552,14 +647,14 @@ def get_home()->"获取用户主目录": # 删除所有的 uengine 应用快捷方式 def CleanAllUengineDesktopLink(): - if messagebox.askokcancel(title="提示", message="你确定要删除所有的 UEngine 应用快捷方式吗?"): + if QtWidgets.QMessageBox.question(widget, "提示", "你是否要删除所有的 UEngine 应用快捷方式?") == QtWidgets.QMessageBox.No: try: shutil.rmtree("{}/.local/share/applications/uengine".format(get_home())) os.makedirs("{}/.local/share/applications/uengine".format(get_home())) - messagebox.showinfo(title="提示", message="删除完毕!") + QtWidgets.QMessageBox.information(widget, "提示", "删除完毕!") except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) # 打开 uengine 应用打包器 def OpenUengineDebBuilder(): @@ -589,44 +684,44 @@ def UengineSettingShow(): # 杀死 adb 进程 def AdbKillAdbProgress(): os.system("killall adb") - messagebox.showinfo(title="提示", message="完成!") + QtWidgets.QMessageBox.information(widget, "提示", "完成!") # 关闭 adb 服务 def AdbStopServer(): os.system("adb kill-server") - messagebox.showinfo(title="提示", message="完成!") + QtWidgets.QMessageBox.information(widget, "提示", "完成!") # 开启 adb 服务 def AdbStartServer(): os.system("adb start-server") - messagebox.showinfo(title="提示", message="完成!") + QtWidgets.QMessageBox.information(widget, "提示", "完成!") def ReinstallUengine(): threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt reinstall uengine uengine-android-image uengine-modules-dkms -y && notify-send -i uengine \"安装完毕!\"'"]).start() def DelUengineCheck(): if not os.path.exists("/usr/share/uengine/uengine-check-runnable.sh"): - messagebox.showinfo(title="提示", message="本功能已经被删除,无法重复删除!") + QtWidgets.QMessageBox.information(widget, "提示", "本功能已经被删除,无法重复删除!") return - if messagebox.askokcancel(title="警告", message="删除后将无法使用本软件恢复\n如果需要恢复本功能,请重新安装 UEngine!"): - threading.Thread(target=InstallWindow.ShowWindows, args=["pkexec rm -v /usr/share/uengine/uengine-check-runnable.sh"]).start() + if QtWidgets.QMessageBox.warning(widget, "警告", "删除后将无法使用本软件恢复\n如果需要恢复本功能,请重新安装 UEngine!", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Ok) == QtWidgets.QMessageBox.Ok: + threading.Thread(target=os.system, args=["'{programPath}/launch.sh' deepin-terminal -C 'pkexec rm -v /usr/share/uengine/uengine-check-runnable.sh'"]).start() # 使用 adb 连接 uengine def UengineConnectAdb(): - messagebox.showinfo(title="提示", message=subprocess.getoutput("adb connect 192.168.250.2:5555")) + QtWidgets.QMessageBox.information(widget, "提示", subprocess.getoutput("adb connect 192.168.250.2:5555")) # 允许用户使用 adb def UengineUseAdb(): # 因为需要 root,所以需要开二号程序 os.system("adb start-server") # 保证有生成文件 os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath, "{}/.android/adbkey.pub".format(get_home()))) # 写入配置 - if messagebox.askyesno(title="提示", message="是否要连接到 UEngine?"): + if QtWidgets.QMessageBox.question(widget, "提示", "是否要连接到 UEngine?") == QtWidgets.QMessageBox.Yes: UengineConnectAdb() def UengineDoNotUseAdb(): # 因为需要 root,所以需要开二号程序 if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"): - messagebox.showinfo(title="提示", message="你的 uengine 在设置前已经禁用 adb 连接,无需重复设置") + QtWidgets.QMessageBox.critical(widget, "提示", "你的 uengine 在设置前已经禁用 adb 连接,无需重复设置") return threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 1".format(programPath)]).start() @@ -668,180 +763,423 @@ def ShowHelp(): def AllowOrDisallowUpdateAndroidApp(): if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"): - if not messagebox.askyesno(title=langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["UseAdbPackageAnswer"]): + if QtWidgets.QMessageBox.question(widget, langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], langFile[lang]["Main"]["MainWindow"]["Answer"]["UseAdbPackageAnswer"]) == QtWidgets.QMessageBox.No: return os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath,"{}/.android/adbkey.pub".format(get_home()))) # 写入配 adb = api.Adb("192.168.250.2:5555") adb.Service.Close() adb.connect() - if messagebox.askyesno(title=langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["AllowOrDisallowUpdateAndroidAppAnswer"][int(adb.boolAndroidInstallOtherAppSetting())]): + if QtWidgets.QMessageBox.question(widget, langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["AllowOrDisallowUpdateAndroidAppAnswer"][int(adb.boolAndroidInstallOtherAppSetting())]) == QtWidgets.QMessageBox.Yes: adb.setAndroidInstallOtherAppSetting(not adb.boolAndroidInstallOtherAppSetting()) - messagebox.showinfo(title=langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"]) + QtWidgets.QMessageBox.information(widget, langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"]) def SetHttpProxy(): adb = api.Adb("192.168.250.2:5555") adb.Service.Close() adb.connect() - if not messagebox.askokcancel(title="提示", message="此功能需要安装 adb 补丁,请保证已经安装然后按下“OK”"): + if QtWidgets.QMessageBox.question(widget, "提示", "此功能需要安装 adb 补丁,请保证已经安装然后按下“Yes”") == QtWidgets.QMessageBox.No: return - proxy = easygui.enterbox(title="输入代理", msg="请输入要设置的代理(为空代表不设置代理)") - if proxy == None: + proxy = QtWidgets.QInputDialog.getText(widget, "输入代理", "请输入要设置的代理(为空代表不设置代理)") + if proxy[1] == False: return - if proxy == "": + if proxy[0] == "": os.system("adb -s 192.168.250.2:5555 shell settings delete global http_proxy") os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_host") os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_port") - messagebox.showinfo(title="提示", message="设置成功!") + QtWidgets.QMessageBox.information(widget, "提示", "设置成功!") else: - os.system(f"adb -s 192.168.250.2:5555 shell settings put global http_proxy \"{proxy}\"") - messagebox.showinfo(title="提示", message="设置成功!") - + os.system(f"adb -s 192.168.250.2:5555 shell settings put global http_proxy \"{proxy[0]}\"") + QtWidgets.QMessageBox.information(widget, "提示", "设置成功!") +class UengineWindowSizeSetting: + setting = None + package = "com.nuts.extremspeedup" + verticalWidth = None + verticalHeighe = None + horizontaltWidth = None + horizontaltHeighe = None + verticalScreen = None + allowFullScreen = None + allowScreenSwitching = None + defaultFullScreen = None + logicalDensityDpi = None + physicalDpi = None + appWidth = None + appHeight = None + logicalWidth = None + logicalHeight = None + lineEdit = { + "verticalWidth": verticalWidth, + "verticalHeighe": verticalHeighe, + "horizontaltWidth": horizontaltWidth, + "horizontaltHeighe": horizontaltHeighe, + "logicalDensityDpi": logicalDensityDpi, + "physicalDpi": physicalDpi, + "appWidth": appWidth, + "appHeight": appHeight, + "logicalWidth": logicalWidth, + "logicalHeight": logicalHeight + } + checkbox = { + "verticalScreen": verticalScreen, + "allowFullScreen": allowFullScreen, + "allowScreenSwitching": allowScreenSwitching, + "defaultFullScreen": defaultFullScreen + } + def ShowWindow(): + unfound = False + while True: + if ComboInstallPath.currentText() == "": + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名") + else: + if GetApkPackageName(ComboInstallPath.currentText()) == None: + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名", text=ComboInstallPath.currentText()) + else: + choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名", text=GetApkPackageName(ComboInstallPath.currentText())) + if not choose[1]: + return + if choose[0] == "": + QtWidgets.QMessageBox.information(widget, "提示", "包名不能为空") + continue + if not os.path.exists(f"/usr/share/uengine/appetc/{choose[0]}.txt"): + if QtWidgets.QMessageBox.question(widget, "提示", "未找到这个包名对应的配置文件,是否要创建一个?") == QtWidgets.QMessageBox.No: + continue + unfound = True + UengineWindowSizeSetting.package = choose[0] + break + UengineWindowSizeSetting.setting = QtWidgets.QMainWindow() + settingWidget = QtWidgets.QWidget() + settingLayout = QtWidgets.QGridLayout() + + UengineWindowSizeSetting.verticalWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.verticalHeighe = QtWidgets.QLineEdit() + UengineWindowSizeSetting.horizontaltWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.horizontaltHeighe = QtWidgets.QLineEdit() + UengineWindowSizeSetting.verticalScreen = QtWidgets.QCheckBox("默认为竖屏") + UengineWindowSizeSetting.allowFullScreen = QtWidgets.QCheckBox("允许全屏") + UengineWindowSizeSetting.allowScreenSwitching = QtWidgets.QCheckBox("允许横竖屏切换") + UengineWindowSizeSetting.defaultFullScreen = QtWidgets.QCheckBox("默认显示最大化") + UengineWindowSizeSetting.logicalDensityDpi = QtWidgets.QLineEdit() + UengineWindowSizeSetting.physicalDpi = QtWidgets.QLineEdit() + UengineWindowSizeSetting.appWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.appHeight = QtWidgets.QLineEdit() + UengineWindowSizeSetting.logicalWidth = QtWidgets.QLineEdit() + UengineWindowSizeSetting.logicalHeight = QtWidgets.QLineEdit() + saveButton = QtWidgets.QPushButton("保存设置") + deleButton = QtWidgets.QPushButton("删除设置") + saveButton.clicked.connect(UengineWindowSizeSetting.SaveSetting) + deleButton.clicked.connect(UengineWindowSizeSetting.DeleteSetting) + settingLayout.addWidget(QtWidgets.QLabel("竖屏宽:"), 0, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalWidth, 0, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("竖屏高:"), 1, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalHeighe, 1, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("横屏宽,备选为1280:"), 2, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.horizontaltWidth, 2, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("横屏高,备选为720:"), 3, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.horizontaltHeighe, 3, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置默认横屏还是竖屏:"), 4, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.verticalScreen, 4, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否允许全屏:"), 5, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.allowFullScreen, 5, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否允许横竖屏切换:"), 6, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.allowScreenSwitching, 6, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("设置是否默认显示最大化:"), 7, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.defaultFullScreen, 7, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("
"), 8, 0, 1, 3) + settingLayout.addWidget(QtWidgets.QLabel("屏幕缩放,数值大则大:"), 9, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalDensityDpi, 9, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("physicalDpi:"), 10, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.physicalDpi, 10, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("appWidth:"), 11, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.appWidth, 11, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("appHeight:"), 12, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.appHeight, 12, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("logicalWidth:"), 13, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalWidth, 13, 1, 1, 2) + settingLayout.addWidget(QtWidgets.QLabel("logicalHeight:"), 14, 0, 1, 1) + settingLayout.addWidget(UengineWindowSizeSetting.logicalHeight, 14, 1, 1, 2) + settingLayout.addWidget(saveButton, 15, 1, 1, 1) + settingLayout.addWidget(deleButton, 15, 2, 1, 1) + UengineWindowSizeSetting.lineEdit = { + "verticalWidth": UengineWindowSizeSetting.verticalWidth, + "verticalHeighe": UengineWindowSizeSetting.verticalHeighe, + "horizontaltWidth": UengineWindowSizeSetting.horizontaltWidth, + "horizontaltHeighe": UengineWindowSizeSetting.horizontaltHeighe, + "logicalDensityDpi": UengineWindowSizeSetting.logicalDensityDpi, + "physicalDpi": UengineWindowSizeSetting.physicalDpi, + "appWidth": UengineWindowSizeSetting.appWidth, + "appHeight": UengineWindowSizeSetting.appHeight, + "logicalWidth": UengineWindowSizeSetting.logicalWidth, + "logicalHeight": UengineWindowSizeSetting.logicalHeight + } + UengineWindowSizeSetting.checkbox = { + "verticalScreen": UengineWindowSizeSetting.verticalScreen, + "allowFullScreen": UengineWindowSizeSetting.allowFullScreen, + "allowScreenSwitching": UengineWindowSizeSetting.allowScreenSwitching, + "defaultFullScreen": UengineWindowSizeSetting.defaultFullScreen + } + settingWidget.setLayout(settingLayout) + UengineWindowSizeSetting.setting.setCentralWidget(settingWidget) + if not unfound: + UengineWindowSizeSetting.ReadSetting() + else: + for i in UengineWindowSizeSetting.checkbox.values(): + i.setChecked(True) + UengineWindowSizeSetting.setting.setWindowTitle(f"设置 Android 应用的窗口大小缩放设置") + UengineWindowSizeSetting.setting.show() + UengineWindowSizeSetting.setting.resize(UengineWindowSizeSetting.setting.frameSize().width() * 1.3, UengineWindowSizeSetting.setting.frameSize().height()) + + def ReadSetting(): + file = open(f"/usr/share/uengine/appetc/{UengineWindowSizeSetting.package}.txt") + while True: + line = file.readline() + if not line: + break + line = line.strip() + print(line) + if "//" in line: + line = line[:line.index("//")] + try: + if line[:line.index(" ")].strip() in UengineWindowSizeSetting.lineEdit.keys(): + UengineWindowSizeSetting.lineEdit[line[:line.index(" ")].strip()].setText(line[line.index(" "):].strip()) + if line[:line.index(" ")].strip() in UengineWindowSizeSetting.checkbox.keys(): + UengineWindowSizeSetting.checkbox[line[:line.index(" ")].strip()].setChecked(bool(line[line.index(" "):].strip())) + except: # 错误行,忽略 + pass + file.close() + + def SaveSetting(): + file = open(f"/tmp/{UengineWindowSizeSetting.package}.txt", "w") + for i in UengineWindowSizeSetting.lineEdit.keys(): + if UengineWindowSizeSetting.lineEdit[i].text() == "": # 空选项,不写入 + continue + try: + file.write(f"{i} {int(UengineWindowSizeSetting.lineEdit[i].text())}\n") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", "格式输入错误") + return + for i in UengineWindowSizeSetting.checkbox.keys(): + try: + file.write(f"{i} {int(UengineWindowSizeSetting.checkbox[i].isChecked())}\n") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + return + file.close() + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -a {UengineWindowSizeSetting.package}"): + QtWidgets.QMessageBox.critical(widget, "错误", "保存失败") + return + QtWidgets.QMessageBox.information(widget, "提示", "保存完成!") + + def DeleteSetting(): + if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -d {UengineWindowSizeSetting.package}"): + QtWidgets.QMessageBox.critical(widget, "错误", "删除失败") + return + QtWidgets.QMessageBox.information(widget, "提示", "删除完成!") + class SettingWindow(): saveApkOption = None + settingWindow = None + autoScreenConfig = None + chooseProgramType = None + theme = None def ShowWindow(): - setting = tk.Toplevel() - setting.resizable(0, 0) - setting.iconphoto(False, tk.PhotoImage(file=iconPath)) - setting.title("设置 UEngine 运行器" + version) - saveApkFrame = ttk.LabelFrame(setting, text="Apk 安装设置") + SettingWindow.settingWindow = QtWidgets.QMainWindow() + setting = QtWidgets.QWidget() + settingLayout = QtWidgets.QGridLayout() + + SettingWindow.saveApkOption = QtWidgets.QComboBox() + SettingWindow.autoScreenConfig = QtWidgets.QCheckBox("安装APK时自动根据系统分辨率设置,卸载时自动移除") + SettingWindow.chooseProgramType = QtWidgets.QCheckBox("安装APK时手动选择程序分类") + SettingWindow.theme = QtWidgets.QComboBox() + themeTry = QtWidgets.QPushButton("测试(重启后变回设置的主题)") + SettingWindow.theme.addItems(QtWidgets.QStyleFactory.keys()) + controlFrame = QtWidgets.QHBoxLayout() + cancalButton = QtWidgets.QPushButton("取消") + okButton = QtWidgets.QPushButton("保存") + + settingLayout.addWidget(QtWidgets.QLabel("APK 安装模式:"), 0, 0, 1, 1) + settingLayout.addWidget(SettingWindow.saveApkOption, 0, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("窗口大小策略:"), 1, 0, 1, 1) + settingLayout.addWidget(SettingWindow.autoScreenConfig, 1, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("程序分类策略:"), 2, 0, 1, 1) + settingLayout.addWidget(SettingWindow.chooseProgramType, 2, 1, 1, 1) + settingLayout.addWidget(QtWidgets.QLabel("程序分类策略:"), 2, 0, 1, 1) + settingLayout.addWidget(SettingWindow.theme, 2, 1, 1, 1) + settingLayout.addWidget(themeTry, 2, 2, 1, 1) + settingLayout.addLayout(controlFrame, 4, 1, 1, 2) + controlFrame.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) + controlFrame.addWidget(cancalButton) + controlFrame.addWidget(okButton) + + SettingWindow.saveApkOption.addItems(["不备份Apk包直接安装", "备份Apk包然后在安装后自动拷贝原先目录"]) try: data = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) except: - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["SettingReadError"]) - setting.destroy() - SettingWindow.saveApkOption = tk.IntVar() - SettingWindow.saveApkOption.set(int(data["SaveApk"])) - ttk.Radiobutton(saveApkFrame, text="不备份Apk包直接安装", value=0, variable=SettingWindow.saveApkOption).pack(anchor=tk.W) - ttk.Radiobutton(saveApkFrame, text="备份Apk包然后在安装后自动拷贝原先目录", value=1, variable=SettingWindow.saveApkOption).pack(anchor=tk.W) - controlFrame = ttk.Frame(setting) - ttk.Button(controlFrame, text="取消", command=setting.destroy).grid(row=0, column=0) - ttk.Button(controlFrame, text="保存", command=SettingWindow.SaveSetting).grid(row=0, column=1) - saveApkFrame.pack() - controlFrame.pack(anchor=tk.E) + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SettingReadError"]) + SettingWindow.settingWindow.close() + return + SettingWindow.autoScreenConfig.setChecked(settingConf["AutoScreenConfig"]) + SettingWindow.saveApkOption.setCurrentIndex(int(data["SaveApk"])) + SettingWindow.chooseProgramType.setChecked(settingConf["ChooseProgramType"]) + SettingWindow.theme.setCurrentText(settingConf["Theme"]) + themeTry.clicked.connect(SettingWindow.Try) + cancalButton.clicked.connect(SettingWindow.settingWindow.close) + okButton.clicked.connect(SettingWindow.SaveSetting) + + setting.setLayout(settingLayout) + SettingWindow.settingWindow.setWindowTitle(f"设置 UEngine 运行器 {version}") + SettingWindow.settingWindow.setWindowIcon(QtGui.QIcon(iconPath)) + SettingWindow.settingWindow.setCentralWidget(setting) + SettingWindow.settingWindow.show() + SettingWindow.settingWindow.setFixedSize(SettingWindow.settingWindow.frameSize().width(), SettingWindow.settingWindow.frameSize().height()) + + def Try(): + app.setStyle(QtWidgets.QStyleFactory.create(SettingWindow.theme.currentText())) + def SaveSetting(): + global settingConf try: - write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({"SaveApk": bool(SettingWindow.saveApkOption.get())})) + write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({ + "SaveApk": bool(SettingWindow.saveApkOption.currentIndex()), + "AutoScreenConfig": SettingWindow.autoScreenConfig.isChecked(), + "ChooseProgramType": SettingWindow.chooseProgramType.isChecked(), + "Theme": SettingWindow.theme.currentText() + })) + settingConf = { + "SaveApk": bool(SettingWindow.saveApkOption.currentIndex()), + "AutoScreenConfig": SettingWindow.autoScreenConfig.isChecked(), + "ChooseProgramType": SettingWindow.chooseProgramType.isChecked(), + "Theme": SettingWindow.theme.currentText() + } + app.setStyle(QtWidgets.QStyleFactory.create(SettingWindow.theme.currentText())) except: traceback.print_exc() - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["SettingSaveError"]) + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SettingSaveError"]) return - messagebox.showinfo(title="提示", message="设置保存完毕!") + QtWidgets.QMessageBox.information(widget, "提示", "设置保存完毕!") class UpdateWindow(): data = {} + update = None def ShowWindow(): - update = tk.Toplevel() - update.title("检查更新") - update.resizable(0, 0) - update.iconphoto(False, tk.PhotoImage(file=iconPath)) - versionLabel = ttk.Label(update, text="当前版本:{}\n最新版本:未知\n更新内容:".format(version)) - updateText = tk.Text(update) - controlFrame = ttk.Frame(update) - ok = ttk.Button(controlFrame, text="更新(更新过程中会关闭所有Python应用,包括这个应用)", command=UpdateWindow.Update) - cancel = ttk.Button(controlFrame, text="取消", command=update.destroy) + UpdateWindow.update = QtWidgets.QMainWindow() + updateWidget = QtWidgets.QWidget() + updateWidgetLayout = QtWidgets.QGridLayout() + versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:未知\n更新内容:") + updateText = QtWidgets.QTextBrowser() + ok = QtWidgets.QPushButton("更新(更新过程中会关闭所有Python应用,包括这个应用)") + ok.clicked.connect(UpdateWindow.Update) + cancel = QtWidgets.QPushButton("取消") + cancel.clicked.connect(UpdateWindow.update.close) try: UpdateWindow.data = json.loads(requests.get("http://120.25.153.144/uengine-runner/update.json").text) - versionLabel = ttk.Label(update, text="当前版本:{}\n最新版本:{}\n更新内容:".format(version, UpdateWindow.data["Version"])) + versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:{UpdateWindow.data['Version']}\n更新内容:") if UpdateWindow.data["Version"] == version: - updateText.insert("0.0", "此为最新版本,无需更新") - ok.configure(state=tk.DISABLED) + updateText.setText("此为最新版本,无需更新") + ok.setDisabled(True) else: - updateText.insert("0.0", UpdateWindow.data["New"].replace("\\n", "\n")) + updateText.setText(UpdateWindow.data["New"].replace("\\n", "\n")) except: traceback.print_exc() - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ConnectServerError"]) - updateText.configure(state=tk.DISABLED) - versionLabel.pack(anchor=tk.W) - updateText.pack() - controlFrame.pack(anchor=tk.E) - cancel.grid(row=0, column=0) - ok.grid(row=0, column=1) - update.mainloop() + QtWidgets.QMessageBox.critical(updateWidget, "错误", "无法连接服务器!") + updateWidgetLayout.addWidget(versionLabel, 0, 0, 1, 1) + updateWidgetLayout.addWidget(updateText, 1, 0, 1, 3) + updateWidgetLayout.addWidget(ok, 2, 2, 1, 1) + updateWidgetLayout.addWidget(cancel, 2, 1, 1, 1) + updateWidget.setLayout(updateWidgetLayout) + UpdateWindow.update.setCentralWidget(updateWidget) + UpdateWindow.update.setWindowTitle("检查更新") + UpdateWindow.update.setWindowIcon(QtGui.QIcon(iconPath)) + UpdateWindow.update.resize(updateWidget.frameGeometry().width(), int(updateWidget.frameGeometry().height() * 1.5)) + UpdateWindow.update.show() + def Update(): - if not os.path.exists("/tmp/uengine-runner/update"): - os.makedirs("/tmp/uengine-runner/update") + if os.path.exists("/tmp/uengine-runner/update"): + shutil.rmtree("/tmp/uengine-runner/update") + os.makedirs("/tmp/uengine-runner/update") try: - write_txt("/tmp/uengine-runner/update.sh", """#!/bin/bash + print(UpdateWindow.data["Url"]) + write_txt("/tmp/uengine-runner/update.sh", f"""#!/bin/bash echo 删除多余的安装包 rm -rfv /tmp/uengine-runner/update/* echo 关闭“UEngine 运行器”以及其它“Python 应用” killall python3 echo 下载安装包 -wget -P /tmp/uengine-runner/update {} +wget -P /tmp/uengine-runner/update {UpdateWindow.data["Url"][0]} echo 安装安装包 -dpkg -i /tmp/uengine-runner/update/*.deb +dpkg -i /tmp/uengine-runner/update/* echo 修复依赖关系 apt install -f -y -notify-send -i uengine "更新完毕!" +notify-send -i "{iconPath}" "更新完毕!" zenity --info --text=\"更新完毕!\" --ellipsize -""".format(UpdateWindow.data["Url"][int(information["Package"] == "com.gitee.uengine.runner.spark")], iconPath)) +""") except: traceback.print_exc() - easygui.textbox(title="错误", msg="更新出现错误,无法继续更新!", text=traceback.format_exc()) + QtWidgets.QMessageBox.critical(widget, "错误,无法继续更新", traceback.format_exc()) os.system(f"'{programPath}/launch.sh' deepin-terminal -e pkexec bash /tmp/uengine-runner/update.sh") image = None class ApkInformation(): + message = None def ShowWindows(): global fullInformation global path global tab1 - path = ComboInstallPath.get() + path = ComboInstallPath.currentText() package = GetApkPackageName(path) if package == None or package == "": - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ApkFileError"]) + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ApkFileError"]) return - message = tk.Toplevel() - message.title("“{}“的Apk信息".format(GetApkChineseLabel(path))) - message.iconphoto(False, tk.PhotoImage(file=iconPath)) - - tab = ttk.Notebook(message) + ApkInformation.message = QtWidgets.QMainWindow() + messageWidget = QtWidgets.QWidget() + messageLayout = QtWidgets.QVBoxLayout() + ApkInformation.message.setWindowTitle("“{}“的Apk信息".format(GetApkChineseLabel(path))) + tab = QtWidgets.QTabWidget() - tab1 = ttk.Frame(message) - tab2 = ttk.Frame(message) + tab1 = QtWidgets.QWidget() + tab2 = QtWidgets.QWidget() - fullInformation = tk.Text(tab2) - - tab.add(tab1, text="简化版") - tab.add(tab2, text="完整版") - - fullInformation.pack(expand="yes", fill="both") - - tab.pack(expand="yes", fill="both") - - threading.Thread(target=ApkInformation.GetInformation).start() - - message.mainloop() - - def GetInformation(): - # 获取详细信息 - fullInformation.configure(state=tk.NORMAL) - fullInformation.insert("1.0", GetApkInformation(path)) - fullInformation.configure(state=tk.DISABLED) - # 获取图标 + tab.addTab(tab1, "简化版") + tab1Layout = QtWidgets.QGridLayout() SaveApkIcon(path, "/tmp/uengine-runner-android-app-icon.png") - # 读取图标 - global image - image = Image.open("/tmp/uengine-runner-android-app-icon.png") - if image.size[0] + image.size[1] <= 512: - ttk.Label(tab1, image=ImageTk.PhotoImage(Image.open("/tmp/uengine-runner-android-app-icon.png"))).pack() - else: - ttk.Label(tab1, image=ImageTk.PhotoImage(Image.open("/tmp/uengine-runner-android-app-icon.png").resize((256, 256), Image.ANTIALIAS))).pack() - image.close() - info = '''包名:{} -中文名:{} -Activity:{} -版本:{}'''.format(GetApkPackageName(path), GetApkChineseLabel(path), GetApkActivityName(path), GetApkVersion(path)) - ttk.Label(tab1, text=info).pack() - ttk.Button(tab1, text="查看程序评分情况", command=ApkInformation.ShowMap).pack() - ttk.Button(tab1, text="上传程序评分情况", command=ApkInformation.UpdateMark).pack() + simpleInformation = QtWidgets.QLabel(f""" +

+

包名:{GetApkPackageName(path)}

+

中文名:{GetApkChineseLabel(path)}

+

Activity:{GetApkActivityName(path)}

+

版本:{GetApkVersion(path)}

""") + + seeFen = QtWidgets.QPushButton("查看程序评分情况") + updFen = QtWidgets.QPushButton("上传程序评分情况") + seeFen.clicked.connect(ApkInformation.ShowMap) + updFen.clicked.connect(ApkInformation.UpdateMark) + tab1Layout.addWidget(simpleInformation, 0, 0, 1, 3) + tab1Layout.addWidget(seeFen, 1, 1, 1, 1) + tab1Layout.addWidget(updFen, 2, 1, 1, 1) + tab1.setLayout(tab1Layout) + + tab.addTab(tab2, "完整版") + tab2Layout = QtWidgets.QVBoxLayout() + fullInformation = QtWidgets.QTextBrowser() + fullInformation.setText(GetApkInformation(path)) + tab2Layout.addWidget(fullInformation) + tab2.setLayout(tab2Layout) + + messageLayout.addWidget(tab) + messageWidget.setLayout(messageLayout) + ApkInformation.message.setCentralWidget(messageWidget) + ApkInformation.message.setWindowIcon(QtGui.QIcon(iconPath)) + ApkInformation.message.setWindowTitle("APK 信息") + ApkInformation.message.show() + return def UpdateMark(): - #message = tk.Toplevel() - #message.iconphoto(False, tk.PhotoImage(file=iconPath)) - choose = easygui.indexbox(title="选择评分", choices=["含有不良信息", "0分", "1分", "2分", "3分", "4分", "5分", "取消"], msg="""选择应用“{}”的使用评分。建议参考如下规范进行评分: + chooseWindow = QtWidgets.QMessageBox() + chooseWindow.setWindowTitle("选择评分") + chooseWindow.setText(f"""选择应用“{GetApkChineseLabel(path)}”的使用评分。建议参考如下规范进行评分: 含有不良信息(-1分):含有违法违规信息(如果有就不要选择其它选项了) 0星:完全无法使用,连安装都有问题 1星:完全无法使用,但是能正常安装 @@ -849,26 +1187,48 @@ Activity:{} 3星:勉强能使用,运行也不大流畅 4星:大部分功能正常,运行流畅(可能会有点小卡) 5星:完全正常且非常流畅,没有任何功能和性能问题,就和直接在手机上用一样 -""".format(GetApkChineseLabel(path))) +""") + choices=["含有不良信息", "0分", "1分", "2分", "3分", "4分", "5分", "取消"] + button0 = chooseWindow.addButton(choices[0], QtWidgets.QMessageBox.ActionRole) + button1 = chooseWindow.addButton(choices[1], QtWidgets.QMessageBox.ActionRole) + button2 = chooseWindow.addButton(choices[2], QtWidgets.QMessageBox.ActionRole) + button3 = chooseWindow.addButton(choices[3], QtWidgets.QMessageBox.ActionRole) + button4 = chooseWindow.addButton(choices[4], QtWidgets.QMessageBox.ActionRole) + button5 = chooseWindow.addButton(choices[5], QtWidgets.QMessageBox.ActionRole) + button6 = chooseWindow.addButton(choices[6], QtWidgets.QMessageBox.ActionRole) + button7 = chooseWindow.addButton(choices[7], QtWidgets.QMessageBox.ActionRole) + button0.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(0))) + button1.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(1))) + button2.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(2))) + button3.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(3))) + button4.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(4))) + button5.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(5))) + button6.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(6))) + button7.clicked.connect(lambda: ApkInformation.UpdateMarkInternet(int(7))) + chooseWindow.exec_() + return + + def UpdateMarkInternet(choose): print(choose) if choose == None or choose == 7: return try: - messagebox.showinfo(title="提示", message=requests.post("http://120.25.153.144/uengine-runner/app/check/add.php", {"Package": GetApkPackageName(path), "Type": choose}).text) + QtWidgets.QMessageBox.critical(widget, "提示", requests.post("http://120.25.153.144/uengine-runner/app/check/add.php", {"Package": GetApkPackageName(path), "Type": choose}).text) except: - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ConnectServerStarError"]) + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ConnectServerStarError"]) def ShowMap(): package = GetApkPackageName(path) if package == None or package == "": - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ApkFileError"]) + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ApkFileError"]) return try: data = json.loads(requests.get("http://120.25.153.144/uengine-runner/app/check/" + package +"/data.json").text) print(data) except: - messagebox.showinfo(title="错误", message="此程序暂时没有评分,欢迎您贡献第一个评分!") + QtWidgets.QMessageBox.information(widget, "提示", "此程序暂时没有评分,欢迎您贡献第一个评分!") return index = numpy.arange(len(data)) print(index) @@ -881,204 +1241,130 @@ Activity:{} matplotlib.pylab.xlabel("用户评分数", fontproperties=fonts) matplotlib.pylab.ylabel("等级", fontproperties=fonts) matplotlib.pylab.title("“" + chinese + "”的用户评分(数据只供参考)", fontproperties=fonts) - matplotlib.pylab.show() + matplotlib.pylab.show(block=True) class AdbChangeUengineDisplaySize(): + messageWindow = None def ShowWindows(): global displayX global displayY global displaySize - message = tk.Toplevel() - message.iconphoto(False, tk.PhotoImage(file=iconPath)) - messageFrame = ttk.Frame(message) + AdbChangeUengineDisplaySize.messageWindow = QtWidgets.QMainWindow() + message = QtWidgets.QWidget() + messageLayout = QtWidgets.QGridLayout() - displaySize = tk.StringVar() - displaySize.set("当前 UEngine 屏幕分辨率:正在获取") + displaySize = QtWidgets.QLabel("当前 UEngine 屏幕分辨率:\n" + subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size")) + displayX = QtWidgets.QLineEdit() + displayY = QtWidgets.QLineEdit() + setButton = QtWidgets.QPushButton("设置分辨率") + setButton.setSizePolicy(size) + setButton.clicked.connect(AdbChangeUengineDisplaySize.SettingDisplaySize) + messageLayout.addWidget(displaySize, 0, 0, 1, 3) + messageLayout.addWidget(displayX, 1, 0, 1, 1) + messageLayout.addWidget(QtWidgets.QLabel("×")) + messageLayout.addWidget(displayY, 1, 2, 1, 1) + messageLayout.addWidget(setButton, 2, 0, 1, 3, QtCore.Qt.AlignCenter) - displaySizeLabel = ttk.Label(messageFrame, textvariable=displaySize) - input = ttk.Frame(messageFrame) - displayX = ttk.Entry(input) - displayY = ttk.Entry(input) - - settingBUtton = ttk.Button(messageFrame, text="设置分辨率", command=AdbChangeUengineDisplaySize.SettingDisplaySize) - - message.title("修改 UEngine 分辨率") - message.resizable(0, 0) - message.iconphoto(False, tk.PhotoImage(file=iconPath)) - # get screen width and height - screen_width = message.winfo_screenwidth() - screen_height = message.winfo_screenheight() - # calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。 - winwith=570 - winhigh=236 - x = (screen_width/2) - (winwith/2) - y = (screen_height/2) - (winhigh/2) - message.geometry("+{}+{}".format(int(x), int(y))) - - displayX.grid(row=0, column=0) - displayY.grid(row=0, column=1) - - displaySizeLabel.grid(row=0, column=0) - input.grid(row=1, column=0) - settingBUtton.grid(row=2, column=0) - - messageFrame.pack() - threading.Thread(target=AdbChangeUengineDisplaySize.GetUengineDisplaySize).start() - message.mainloop() + message.setLayout(messageLayout) + AdbChangeUengineDisplaySize.messageWindow.setCentralWidget(message) + AdbChangeUengineDisplaySize.messageWindow.setWindowTitle("修改 UEngine 分辨率") + AdbChangeUengineDisplaySize.messageWindow.setWindowIcon(QtGui.QIcon(iconPath)) + AdbChangeUengineDisplaySize.messageWindow.show() + return def GetUengineDisplaySize(): global displaySize - displaySize.set("当前 UEngine 屏幕分辨率:\n" + subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size")) - #displaySize.set(subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size")) + displaySize.setText("当前 UEngine 屏幕分辨率:\n" + subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size")) def SettingDisplaySize(): global displayX global displayY try: - int(displayX.get()) - int(displayY.get()) + int(displayX.text()) + int(displayY.text()) except: - messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["InputDataError"]) + QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["InputDataError"]) return - os.system("adb -s '192.168.250.2:5555' shell wm size {}x{}".format(displayX.get(), displayY.get())) + os.system("adb -s '192.168.250.2:5555' shell wm size {}x{}".format(displayX.text(), displayY.text())) AdbChangeUengineDisplaySize.GetUengineDisplaySize() - messagebox.showinfo(title="提示", message="执行完毕!") - -# 运行命令的窗口 -class InstallWindow(): - # 显示窗口 - def ShowWindows(command): - global message - global text - global installTipsText - global progressbar - global runCommand - message = tk.Toplevel() - message.title("执行命令") - message.iconphoto(False, tk.PhotoImage(file=iconPath)) - messageFrame = ttk.Frame(message) - installTipsText = tk.StringVar() - message.title("正在操作……") - installTipsText.set("正在操作……") - installTips = ttk.Label(messageFrame, textvariable=installTipsText) - progressbar = ttk.Progressbar(messageFrame, length=500, mode='indeterminate') - text = tk.Text(messageFrame) - text.config(background="black", foreground="white") - installTips.pack() - progressbar.pack(fill="x") - text.pack(expand='yes', fill='both') - messageFrame.pack(expand='yes', fill='both') - print("Run!") - threading.Thread(target=InstallWindow.RunCommand, args=[command]).start() - message.mainloop() - - # 运行命令并显示 - def RunCommand(command): - global message - global text - global progressbar - global installTipsText - InstallWindow.AddText("$>" + command + "\n") - progressbar.start() - res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - # 实时读取程序返回 - while res.poll() is None: - try: - texts = res.stdout.readline().decode("utf8") - except: - texts = "" - print(texts, end="") - InstallWindow.AddText(texts) - messagebox.showinfo(title="提示", message="操作完毕!") - installTipsText.set("操作完毕!") - message.title("操作完毕!") - progressbar.stop() - progressbar["value"] = 100 - # 特意添加! - DisabledAndEnbled(False) - if command == "pkexec rm -rfv /data/uengine": - print("Clean!") - if messagebox.askyesno(title="提示", message="清空完毕,将会在重启后生效,是否要重启?"): - print("reboot") - os.system("reboot") - - # 添加文本 - def AddText(things): - global text - text.configure(state=tk.NORMAL) - text.insert("end", things) - text.configure(state=tk.DISABLED) + QtWidgets.QMessageBox.information(widget, "提示", "执行完毕!") class ShowTextTipsWindow(): + messageWindow = None def ShowWindow(things): - message = tk.Toplevel() + ShowTextTipsWindow.messageWindow = QtWidgets.QMainWindow() + message = QtWidgets.QWidget() + messageLayout = QtWidgets.QVBoxLayout() - message.title("提示") - message.iconphoto(False, tk.PhotoImage(file=iconPath)) + text = QtWidgets.QTextBrowser() + text.setText(things) + ok = QtWidgets.QPushButton("确定") + ok.clicked.connect(ShowTextTipsWindow.messageWindow.close) + #ok.setSizePolicy(size) - text = tk.Text(message) - quitButton = ttk.Button(message, text="确定", command=message.destroy) + messageLayout.addWidget(text) + messageLayout.addWidget(ok) - text.insert("end", things) - text.configure(state=tk.DISABLED) - - text.pack(fill="both", expand="yes") - quitButton.pack() - - message.mainloop() + message.setLayout(messageLayout) + ShowTextTipsWindow.messageWindow.setCentralWidget(message) + ShowTextTipsWindow.messageWindow.setWindowTitle("提示") + ShowTextTipsWindow.messageWindow.setWindowIcon(QtGui.QIcon(iconPath)) + ShowTextTipsWindow.messageWindow.show() + ShowTextTipsWindow.messageWindow.resize(ShowTextTipsWindow.messageWindow.frameSize().width() * 2, ShowTextTipsWindow.messageWindow.frameSize().height() * 1.5) + return # 添加/删除 uengine 应用快捷方式 class AddNewUengineDesktopLink(): addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity 注意:如果是要删除只要输入包名即可''' + messageWindow = None def ShowWindow(): global activityName global packageName - message = tk.Toplevel() - message.iconphoto(False, tk.PhotoImage(file=iconPath)) + AddNewUengineDesktopLink.messageWindow = QtWidgets.QMainWindow() + message = QtWidgets.QWidget() + messageLayout = QtWidgets.QGridLayout() - tipsLabel = ttk.Label(message, text=AddNewUengineDesktopLink.addTips) - packageName = ttk.Combobox(message, width=30) - activityName = ttk.Combobox(message, width=30) - findApk = ttk.Button(message, text="浏览", command=AddNewUengineDesktopLink.FindApk) - controlFrame = ttk.Frame(message) - testOpen = ttk.Button(controlFrame, text="打开", command=AddNewUengineDesktopLink.TestOpen) - saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink) - delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink) + activityName = QtWidgets.QLineEdit() + packageName = QtWidgets.QLineEdit() + browser = QtWidgets.QPushButton("浏览……") + controlFrame = QtWidgets.QHBoxLayout() + open = QtWidgets.QPushButton("打开") + save = QtWidgets.QPushButton("保存") + delete = QtWidgets.QPushButton("删除") - message.title("添加/删除 UEngine 图标") - message.resizable(0, 0) - message.iconphoto(False, tk.PhotoImage(file=iconPath)) - # get screen width and height - screen_width = message.winfo_screenwidth() - screen_height = message.winfo_screenheight() - # calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。 - winwith=570 - winhigh=236 - x = (screen_width/2) - (winwith/2) - y = (screen_height/2) - (winhigh/2) - message.geometry("+{}+{}".format(int(x), int(y))) - - packageName["value"] = findApkNameHistory - activityName["value"] = findApkActivityHistory + packageName.setPlaceholderText("APK 包名") + activityName.setPlaceholderText("APK 的 Activity") - tipsLabel.grid(row=0, column=0, columnspan=3) - packageName.grid(row=1, column=0) - activityName.grid(row=1, column=1) - findApk.grid(row=1, column=2) - controlFrame.grid(row=2, column=0, columnspan=3) - testOpen.grid(row=0, column=0) - saveButton.grid(row=0, column=1) - delButton.grid(row=0, column=2) + browser.clicked.connect(AddNewUengineDesktopLink.FindApk) + open.clicked.connect(AddNewUengineDesktopLink.TestOpen) + save.clicked.connect(AddNewUengineDesktopLink.SaveDesktopLink) + delete.clicked.connect(AddNewUengineDesktopLink.DelDesktopLink) - message.mainloop() + messageLayout.addWidget(QtWidgets.QLabel(AddNewUengineDesktopLink.addTips), 0, 0, 1, 3) + messageLayout.addWidget(packageName, 1, 0, 1, 1) + messageLayout.addWidget(activityName, 1, 1, 1, 1) + messageLayout.addWidget(browser, 1, 2, 1, 1) + messageLayout.addLayout(controlFrame, 2, 0, 1, 3) + controlFrame.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) + controlFrame.addWidget(open) + controlFrame.addWidget(save) + controlFrame.addWidget(delete) + controlFrame.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) + + message.setLayout(messageLayout) + AddNewUengineDesktopLink.messageWindow.setCentralWidget(message) + AddNewUengineDesktopLink.messageWindow.setWindowTitle("添加/删除 UEngine 图标") + AddNewUengineDesktopLink.messageWindow.setWindowIcon(QtGui.QIcon(iconPath)) + AddNewUengineDesktopLink.messageWindow.show() + return # 添加快捷方式 def SaveDesktopLink(): try: if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())): - if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"): + if QtWidgets.QMessageBox.question(widget, "提示", "文件已存在,是否要覆盖?") == QtWidgets.QMessageBox.No: return if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())): os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())) @@ -1090,10 +1376,10 @@ class AddNewUengineDesktopLink(): BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath, "{}/{}.desktop".format(get_desktop_path(), packageName.get())) AddNewUengineDesktopLink.SaveHistory() - messagebox.showinfo(title="提示", message="创建完毕!") + QtWidgets.QMessageBox.information(widget, "提示", "创建完毕!") except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.information(widget, "错误", traceback.format_exc()) # 删除快捷方式 @@ -1101,58 +1387,56 @@ class AddNewUengineDesktopLink(): try: global packageName if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())): - messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!") + QtWidgets.QMessageBox.critical(widget, "错误", "此包名对应的 UEngine 桌面快捷方式不存在!") return - if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"): + 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.get())) AddNewUengineDesktopLink.SaveHistory() - messagebox.showinfo(title="提示", message="已删除") + QtWidgets.QMessageBox.information(widget, "提示", "已删除") except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) # 保存历史记录 def SaveHistory(): - findApkNameHistory.append(packageName.get()) - findApkActivityHistory.append(activityName.get()) - packageName['value'] = findApkNameHistory - activityName['value'] = findApkActivityHistory + findApkNameHistory.append(packageName.text()) + findApkActivityHistory.append(activityName.text()) write_txt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json", str(json.dumps(ListToDictionary(findApkNameHistory)))) # 将历史记录的数组转换为字典并写入 write_txt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json", str(json.dumps(ListToDictionary(findApkActivityHistory)))) # 将历史记录的数组转换为字典并写入 # 打开测试 def TestOpen(): - threading.Thread(target=os.system, args=["/usr/bin/uengine launch --package={} --component={}".format(packageName.get(), activityName.get())]).start() + threading.Thread(target=os.system, args=["/usr/bin/uengine launch --package={} --component={}".format(packageName.text(), activityName.text())]).start() AddNewUengineDesktopLink.SaveHistory() # 浏览文件 def FindApk(): - path = filedialog.askopenfilename(title="选择apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkName.json"))["path"]) - if path == "" or path == (): + path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择apk", "~", "APK 文件(*.apk);;所有文件(*.*)", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkName.json"))["path"])[0] + if path == "" or path == () or path == None: return - packageName.set(GetApkPackageName(path)) - activityName.set(str(GetApkActivityName(path))) + packageName.setText(GetApkPackageName(path)) + activityName.setText(str(GetApkActivityName(path))) write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 def UseProgram(): global useProgram - useProgram = '''1、UEngine:{} -2、python3:{} -3、tkinter:{} -4、aapt:{} -5、dpkg:{} -6、mkdir:{} -7、echo -8、chmod:{} -9、adb:{} -10、deepin 终端:{}'''.format(subprocess.getoutput("uengine version"), + useProgram = '''

1、UEngine:{}

+

2、python3:{}

+

3、PyQt:{}

+

4、aapt:{}

+

5、dpkg:{}

+

6、mkdir:{}

+

7、echo

+

8、chmod:{}

+

9、adb:{}

+

10、deepin 终端:{}

'''.format(subprocess.getoutput("uengine version"), subprocess.getoutput("python3 --version"), - tk.TkVersion, + QtCore.qVersion, subprocess.getoutput("aapt version"), subprocess.getoutput("dpkg --version"), subprocess.getoutput("mkdir --version"), @@ -1160,6 +1444,10 @@ def UseProgram(): subprocess.getoutput("adb version"), subprocess.getoutput("deepin-terminal -v")) +def BackAPK(choice): + global choose + choose = choice + ########################### # 程序信息 ########################### @@ -1174,34 +1462,36 @@ version = information["Version"] goodRunSystem = information["System"] aaptVersion = GetCommandReturn("aapt version") SystemVersion = GetSystemVersion() -about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。 - -版本 :{} - -适用平台 :{} - -Tk 版本 :{} - -程序官网 :{} - -系统版本 : {} - -©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y")) -tips = "\n".join(information["Tips"]) -updateThingsString = "\n".join(information["Update"]) +iconPath = "{}/runner.svg".format(os.path.split(os.path.realpath(__file__))[0]) +about = f'''

+

介绍 :一个基于 Python3 的 PyQt5 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。

+

版本 :{version}

+

适用平台 :{goodRunSystem}

+

Qt 版本 :{QtCore.qVersion()}

+

程序官网 :{programUrl}

+

系统版本 : {SystemVersion}

+

©2021-{time.strftime("%Y")}

''' +updateThingsString = "" +tips = "" +contribute = "" +for i in information["Tips"]: + tips += f"

{i}

" +for i in information["Update"]: + updateThingsString += f"

{i}

" +for i in information["Contribute"]: + contribute += f"

{i}

" title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version) updateTime = information["Time"] updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) -iconPath = "{}/runner.png".format(os.path.split(os.path.realpath(__file__))[0]) desktop = programPath + "/UengineAndroidProgramList.desktop" desktopName = "UengineAndroidProgramList.desktop" -contribute = "\n".join(information["Contribute"]) useProgram = "" threading.Thread(target=UseProgram).start() ########################### # 加载配置 ########################### +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(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹 @@ -1225,8 +1515,8 @@ if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApkIcon.json"): if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApk.json"): # 如果没有配置文件 write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 if not os.path.exists(get_home() + "/.config/uengine-runner/setting.json"): - choose = None - choose = easygui.indexbox(msg="""在使用本程序前,请选择安装Apk包的设置以便更好的运行,下列选项的详细介绍: + choosemsg = QtWidgets.QMessageBox() + choosemsg.setText("""在使用本程序前,请选择安装Apk包的设置以便更好的运行,下列选项的详细介绍: 不备份Apk包直接安装:适用于Deepin(旧版UEngine),安装较快,不受/tmp大小所限,但Deepin23和UOS(新版UEngine)不推荐此选项,因为安装后会自动删除Apk安装包; 备份Apk包然后在安装后自动拷贝原先目录:适用于Deepin23和UOS(新版UEngine),安装较慢,受/tmp大小所限,安装后不会丢失Apk,Deepin(旧版UEngine)不推荐使用该选项; @@ -1234,14 +1524,36 @@ if not os.path.exists(get_home() + "/.config/uengine-runner/setting.json"): 后期可以在程序主界面的菜单栏的“程序”=>“设置”里进行修改, 如果不知道正在使用的系统是什么版本可以打开系统设置查看。 -""", title="设置", choices=["不备份Apk包直接安装", "备份Apk包然后在安装后自动拷贝原先目录"]) +""") + choosemsg.setWindowTitle("设置") + choose = None + choosemsg.addButton("不备份Apk包直接安装", QtWidgets.QMessageBox.ActionRole).clicked.connect(lambda: BackAPK(0)) + choosemsg.addButton("备份Apk包然后在安装后自动拷贝原先目录", QtWidgets.QMessageBox.ActionRole).clicked.connect(lambda: BackAPK(1)) + choosemsg.exec_() if choose == None: - root = tk.Tk() - root.withdraw() - messagebox.showinfo(title="提示", message="必须选择一个选项!否则无法进入程序!") + QtWidgets.QMessageBox.information(None, "提示", "必须选择一个选项!否则无法进入程序!") sys.exit() write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({"SaveApk": int(choose)})) - +defultProgramList = { + "SaveApk": 1, + "AutoScreenConfig": False, + "ChooseProgramType": False, + "Theme": "" +} +try: + settingConf = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json")) + change = False + for i in defultProgramList.keys(): + if not i in settingConf: + change = True + settingConf[i] = defultProgramList[i] + if change: + write_txt(get_home() + "/.config/uengine-setting.json", json.dumps(settingConf)) +except: + traceback.print_exc() + app = QtWidgets.QApplication(sys.argv) + QtWidgets.QMessageBox.critical(None, "错误", f"无法读取配置,无法继续\n{traceback.format_exc()}") + sys.exit(1) ########################### # 设置变量 @@ -1254,325 +1566,361 @@ findApkActivityHistory = list(json.loads(readtxt(get_home() + "/.config/uengine- # add sub window #添加窗口开启关闭开关,防止重复开启 windowflag = "close" - -def showhelp(): - - #define window and frame and button label - # - global windowflag - if windowflag == "close": - helpwindow=tk.Toplevel() - helpwindow.resizable(0, 0) - helpwindow.title("帮助") - helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath)) - - # get screen width and height - screen_width = helpwindow.winfo_screenwidth() - screen_height = helpwindow.winfo_screenheight() - # calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。 - - - winwith=550 - winhigh=700 - x = (screen_width/2) - (winwith/2) - y = (screen_height/2) - (winhigh/2) - if not helpwindow.winfo_screenheight() > 1080: - helpwindow.geometry(f"{winwith}x{winhigh}"+"+{:.0f}+{:.0f}".format(x, y)) - - - Frmroot=ttk.Frame(helpwindow) - FrmMenu = ttk.Frame(Frmroot) - FrmText = ttk.Frame(Frmroot) - - LabFrmText=ttk.LabelFrame(FrmText,text="帮助",height=800,borderwidth=3) - HelpStr = tk.StringVar() - HelpStr.set(tips) - LabText = ttk.Label(LabFrmText, textvariable=HelpStr,width=55) - LabText.config(wraplength=350) - - def on_closing(): - global windowflag - windowflag = "close" - print(windowflag) - helpwindow.destroy() - - - - # define button func - def ChgLog(): - HelpStr.set(updateThingsString) - def ChgAbout(): - HelpStr.set(about) - def ChgDep(): - if useProgram == "": - BtnZujian.configure(state=tk.DISABLED) - return - HelpStr.set(useProgram) - def ChgCon(): - HelpStr.set(contribute) - def ChgTips(): - HelpStr.set(tips) - LabText.config(wraplength=350) - def Egg(event): - try: - lists = json.loads(requests.get("http://120.25.153.144/uengine-runner/VersionList.json").text) - data = [] - for i in lists: - data.append(int(requests.get("http://120.25.153.144/uengine-runner/{}/data.txt".format(i)).text)) - except: - messagebox.showerror(title="错误", message="服务器出错!数据获取失败!") - return - fig = matplotlib.pylab.figure() - fig.canvas.set_window_title("“UEngine 运行器”安装数(数据只供参考)") - matplotlib.pylab.plot(lists, data) - index = numpy.arange(len(lists)) - fonts = matplotlib.font_manager.FontProperties(fname='/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc') # 用于支持中文显示,需要依赖fonts-noto-cjk - matplotlib.pylab.xlabel("版本号", fontproperties=fonts) - matplotlib.pylab.ylabel("安装数", fontproperties=fonts) +def Egg(): + try: + lists = json.loads(requests.get("http://120.25.153.144/uengine-runner/VersionList.json").text) + data = [] + for i in lists: + data.append(int(requests.get("http://120.25.153.144/uengine-runner/{}/data.txt".format(i)).text)) + except: + QtWidgets.QMessageBox.critical(widget, "错误", "服务器出错!数据获取失败!") + return + fig = matplotlib.pylab.figure() + fig.canvas.set_window_title("“UEngine 运行器”安装数(数据只供参考)") + matplotlib.pylab.plot(lists, data) + index = numpy.arange(len(lists)) + fonts = matplotlib.font_manager.FontProperties(fname='/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc') # 用于支持中文显示,需要依赖fonts-noto-cjk + matplotlib.pylab.xlabel("版本号", fontproperties=fonts) + matplotlib.pylab.ylabel("安装数", fontproperties=fonts) - matplotlib.pylab.title("“UEngine 运行器”安装数(数据只供参考)", fontproperties=fonts) - matplotlib.pylab.show() + matplotlib.pylab.title("“UEngine 运行器”安装数(数据只供参考)", fontproperties=fonts) + matplotlib.pylab.show() +helpWindow = None +def showhelp(): + global helpWindow + helpWindow = QtWidgets.QMainWindow() + helpWidget = QtWidgets.QWidget() + helpLayout = QtWidgets.QGridLayout() - BtnReadme = ttk.Button(FrmMenu, text="使用说明",width=14,command=ChgTips) - BtnLog = ttk.Button(FrmMenu, text="更新内容",width=14,command=ChgLog) - BtnZujian = ttk.Button(FrmMenu, text="程序依赖的组件",width=14,command=ChgDep) - BtnGongxian = ttk.Button(FrmMenu, text="有贡献的开发者",width=14,command=ChgCon) - BtnAbout = ttk.Button(FrmMenu, text="关于",width=14,command=ChgAbout) - BtnAbout.bind("", Egg) + def ChgLog(): + HelpStr.setHtml(updateThingsString) + def ChgAbout(event): + HelpStr.setHtml(about) + def ChgDep(): + if useProgram == "": + BtnZujian.setDisabled(True) + return + HelpStr.setHtml(useProgram) + def ChgCon(): + HelpStr.setHtml(contribute) + def ChgTips(): + HelpStr.setHtml(tips) + + + BtnReadme = QtWidgets.QPushButton("使用说明") + BtnLog = QtWidgets.QPushButton("更新内容") + BtnZujian = QtWidgets.QPushButton("程序依赖的组件") + BtnGongxian = QtWidgets.QPushButton("谢明列表") + BtnAbout = QtWidgets.QPushButton("关于") + BtnDownN = QtWidgets.QPushButton("程序下载量") + HelpStr = QtWidgets.QTextBrowser() + BtnDownN.setEnabled("--彩蛋" in sys.argv) + BtnReadme.clicked.connect(ChgTips) + BtnLog.clicked.connect(ChgLog) + BtnZujian.clicked.connect(ChgDep) + BtnGongxian.clicked.connect(ChgCon) + BtnAbout.clicked.connect(ChgAbout) + BtnDownN.clicked.connect(Egg) + ChgTips() - #layout - FrmMenu.grid(row=0,column=0,sticky=tk.NW) - BtnReadme.grid(row=0,column=0,sticky=tk.NW,padx=3) - BtnLog.grid(row=1,column=0,sticky=tk.NW,padx=3) - BtnZujian.grid(row=2,column=0,sticky=tk.NW,padx=3) - BtnGongxian.grid(row=3,column=0,sticky=tk.NW,padx=3) - BtnAbout.grid(row=4,column=0,sticky=tk.NW,padx=3) + helpLayout.addWidget(BtnReadme, 0, 0, 1, 1) + helpLayout.addWidget(BtnLog, 1, 0, 1, 1) + helpLayout.addWidget(BtnZujian, 2, 0, 1, 1) + helpLayout.addWidget(BtnGongxian, 3, 0, 1, 1) + helpLayout.addWidget(BtnAbout, 5, 0, 1, 1) + helpLayout.addWidget(BtnDownN, 4, 0, 1, 1) + helpLayout.addWidget(HelpStr, 0, 1, 7, 1) + + helpWidget.setLayout(helpLayout) + helpWindow.setCentralWidget(helpWidget) + helpWindow.setFixedSize(helpWindow.frameSize().width() * 0.9, helpWindow.frameSize().height() * 1.5) + helpWindow.setWindowTitle("帮助") + helpWindow.setWindowIcon(QtGui.QIcon(iconPath)) + helpWindow.show() + return - FrmText.grid(row=0,column=1,sticky=tk.NW) - LabFrmText.grid(row=0,column=0,sticky=tk.NW,padx=3,pady=3) - LabText.grid(row=0,column=0,sticky=tk.NW) - - Frmroot.pack() - windowflag = "open" - print(windowflag) - #helpwindow.mainloop() - helpwindow.protocol("WM_DELETE_WINDOW", on_closing) -# 读取主题 -try: - theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0")) -except: - print("主题读取错误,默认使用浅色主题") - theme = True -if theme: - win = tk.Tk() - themes = ttkthemes.ThemedStyle(win) - themes.set_theme("breeze") -else: - import ttkbootstrap - style = ttkbootstrap.Style(theme="darkly") - win = style.master # 创建窗口 ########################### # 检查 UEngine 是否安装 ########################### if not os.path.exists("/usr/bin/uengine"): - # 不渲染窗口 - style = ttkthemes.ThemedStyle(win) - style.set_theme("breeze") - win.withdraw() # Deepin/UOS 用户 if "deepin" in SystemVersion.lower() or "uos" in SystemVersion.lower(): - if messagebox.askyesno(title="提示", message="您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n安装完后重新启动该程序即可"): + if QtWidgets.QMessageBox.question(None, "提示", "您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n安装完后重新启动该程序即可") == QtWidgets.QMessageBox.Yes: os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"pkexec apt install uengine -y\"") sys.exit(0) # 非 Deepin/UOS 用户 else: - if messagebox.askyesno(title="提示", message="您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n这里将会使用 shenmo 提供的脚本进行安装\n安装完后重新启动该程序即可\n提示:无法保证此安装脚本安装的 UEngine 可以使用"): + if QtWidgets.QMessageBox.question(None, "提示", "您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n这里将会使用 shenmo 提供的脚本进行安装\n安装完后重新启动该程序即可\n提示:无法保证此安装脚本安装的 UEngine 可以使用") == QtWidgets.QMessageBox.Yes: os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath}/uengine-installer'\"") sys.exit(0) - # 重新显示窗口 - win.wm_deiconify() ########################### # 窗口创建 ########################### - - -# 设置窗口 -#style = ttkthemes.ThemedStyle(win) -#style.set_theme("breeze") -window = ttk.Frame(win) -win.title(title) -win.resizable(0, 0) -win.iconphoto(False, tk.PhotoImage(file=iconPath)) - -# get screen width and height -screen_width = win.winfo_screenwidth() -screen_height = win.winfo_screenheight() -# calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。 -winwith=570 -winhigh=236 -x = (screen_width/2) - (winwith/2) -y = (screen_height/2) - (winhigh/2) - -win.geometry(""+"+{:.0f}+{:.0f}".format(x, y)) - +window = QtWidgets.QMainWindow() +widget = QtWidgets.QWidget() +widgetLayout = QtWidgets.QGridLayout() +# 权重 +size = QtWidgets.QSizePolicy() +size.setHorizontalPolicy(0) +widgetSize = QtWidgets.QSizePolicy() +widgetSize.setVerticalPolicy(0) # 创建控件 -FrmInstall = ttk.Frame(window) -#FrmUninstall = ttk.Frame(window) -LabApkPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabApkPath"]) -ComboInstallPath = ttk.Combobox(window, width=50) -BtnFindApk = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnFindApk"], command=FindApk) -BtnInstall = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnInstall"], command=Button3Install) -BtnShowUengineApp = ttk.Button(window, text=langFile[lang]["Main"]["MainWindow"]["BtnShowUengineApp"], command=Button5Click) -BtnUninstall = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstall"], command=ButtonClick8) -Btngeticon = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["Btngeticon"], command=SaveIconToOtherPath) -BtnSaveApk = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnSaveApk"], command=SaveInstallUengineApp) -BtnApkInformation = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnApkInformation"], command=ApkInformation.ShowWindows) -# 设置菜单栏 -menu = tk.Menu(window, background="white") - -programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏 -adb = tk.Menu(menu, tearoff=0, background="white") -uengine = tk.Menu(menu, tearoff=0, background="white") -help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏 - -adbServer = tk.Menu(adb, tearoff=0, background="white") - -uengineService = tk.Menu(uengine, tearoff=0, background="white") -uengineInternet = tk.Menu(uengine, tearoff=0, background="white") -uengineIcon = tk.Menu(uengine, tearoff=0, background="white") -uengineUseAdb = tk.Menu(uengine, tearoff=0, background="white") -uengineData = tk.Menu(uengine, tearoff=0, background="white") -uengineRoot = tk.Menu(uengine, tearoff=0, background="white") - -menu.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Name"], menu=programmenu) -menu.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Name"], menu=adb) -menu.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Name"], menu=uengine) -menu.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Name"], menu=help) - -programmenu.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][0], command=CleanProgramHistory) -programmenu.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][2], command=SettingWindow.ShowWindow) -programmenu.add_separator() # 设置分界线 -programmenu.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][1], command=window.quit) # 设置“退出程序” - -adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][0], command=UengineConnectAdb) -adb.add_separator() -adb.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Name"], menu=adbServer) -adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][2], command=AdbConnectDeviceShow) -adb.add_separator() -adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][3], command=AdbChangeUengineDisplaySize.ShowWindows) -adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][4], command=AdbAndroidInstallAppList) -adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][5], command=AdbCPUAndRAWShowInTer) -adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][6], command=AdbShellShowInTer) -adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][7], command=ScrcpyConnectUengine) -adb.add_separator() -adb.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Name"], menu=uengineUseAdb) - -adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][0], command=AdbStartServer) -adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][1], command=AdbStopServer) -adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2], command=AdbKillAdbProgress) - -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][13], command=AllowOrDisallowUpdateAndroidApp) -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][15], command=SetHttpProxy) -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][1], command=OpenUengineDebBuilder) -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][7], command=KeyboardToMouse) -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][8], command=UengineCheckCpu) -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][12], command=UengineUbuntuInstall) -uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Name"], menu=uengineService) -uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Name"], menu=uengineInternet) -uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Name"], menu=uengineIcon) -uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][5]["Name"], menu=uengineUseAdb) -uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Name"], menu=uengineData) -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][9], command=DelUengineCheck) -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][10], command=ReinstallUengine) -uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Name"], menu=uengineRoot) -uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][14], command=UbuntuInstallUengine) - -help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][0], command=OpenProgramURL) # 设置“程序官网”项 -help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][2], command=UengineRunnerBugUpload) # 设置“传bug”项 -help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][4], command=ShowHelp) # 设置“更多帮助”项 -help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][3], command=UpdateWindow.ShowWindow) -help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][1], command=showhelp) # 设置“关于这个程序”项 - -uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][0], command=StartUengine) -uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][1], command=StopUengine) -uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][2], command=UengineRestart) - -uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][0], command=UengineBridgeStart) -uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][1], command=UengineBridgeStop) -uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][2], command=UengineBridgeRestart) -uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][3], command=UengineBridgeReload) -uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][4], command=UengineBridgeForceReload) - -uengineIcon.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][0], command=SendUengineAndroidListForDesktop) -uengineIcon.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][1], command=SendUengineAndroidListForLauncher) -uengineIcon.add_separator() -uengineIcon.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][2], command=AddNewUengineDesktopLink.ShowWindow) -uengineIcon.add_separator() -uengineIcon.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][3], command=CleanAllUengineDesktopLink) - -uengineUseAdb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][0], command=UengineConnectAdb) -uengineUseAdb.add_separator() -uengineUseAdb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][1], command=UengineUseAdb) -uengineUseAdb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][2], command=UengineDoNotUseAdb) - -uengineData.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][0], command=OpenUengineRootData) -uengineData.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][1], command=OpenUengineUserData) -uengineData.add_separator() -uengineData.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][2], command=BackUengineClean) - -uengineRoot.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][0], command=InstallRootUengineImage) -uengineRoot.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][1], command=BuildRootUengineImage) -uengineRoot.add_separator() -uengineRoot.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][2], command=ReinstallUengineImage) - -menu.configure(activebackground="dodgerblue") -help.configure(activebackground="dodgerblue") -adb.configure(activebackground="dodgerblue") -uengine.configure(activebackground="dodgerblue") -programmenu.configure(activebackground="dodgerblue") -uengineService.configure(activebackground="dodgerblue") -uengineInternet.configure(activebackground="dodgerblue") -uengineIcon.configure(activebackground="dodgerblue") -uengineUseAdb.configure(activebackground="dodgerblue") -uengineData.configure(activebackground="dodgerblue") - +LabApkPath = QtWidgets.QLabel(langFile[lang]["Main"]["MainWindow"]["LabApkPath"]) +ComboInstallPath = QtWidgets.QComboBox() +FrmInstallWidget = QtWidgets.QWidget() +FrmInstall = QtWidgets.QGridLayout() +BtnFindApk = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnFindApk"]) +BtnInstall = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnInstall"]) +BtnShowUengineApp = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnShowUengineApp"]) +BtnUninstall = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnUninstall"]) +Btngeticon = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["Btngeticon"]) +BtnSaveApk = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnSaveApk"]) +BtnApkInformation = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnApkInformation"]) # 设置控件 -ComboInstallPath['value'] = findApkHistory +FrmInstallWidget.setLayout(FrmInstall) +FrmInstallWidget.setSizePolicy(size) +BtnShowUengineApp.setSizePolicy(size) +ComboInstallPath.setEditable(True) +ComboInstallPath.addItems(findApkHistory) +ComboInstallPath.setEditText("") +ComboInstallPath.setFixedSize(ComboInstallPath.frameSize().width() * 5, ComboInstallPath.frameSize().height()) try: if sys.argv[1] == "-i": - ComboInstallPath.set(sys.argv[2]) + ComboInstallPath.setCurrentText(sys.argv[2]) print("Install Path: " + sys.argv[2]) elif sys.argv[1] == "-u": - #ComboUninstallPath.set(sys.argv[2]) - ComboInstallPath.set(sys.argv[2]) + ComboInstallPath.setCurrentText(sys.argv[2]) print("Unstall Path: " + sys.argv[2]) else: print("Command Format Error") except: print("Not Command Or Command Format Error") -# 显示控件 -win.config(menu=menu) # 显示菜单栏 +# 绑定信号 +BtnFindApk.clicked.connect(FindApk) +BtnInstall.clicked.connect(Button3Install) +BtnShowUengineApp.clicked.connect(Button5Click) +BtnUninstall.clicked.connect(ButtonClick8) +Btngeticon.clicked.connect(SaveIconToOtherPath) +BtnSaveApk.clicked.connect(SaveInstallUengineApp) +BtnApkInformation.clicked.connect(ApkInformation.ShowWindows) +# 布局控件 +widgetLayout.addWidget(LabApkPath, 0, 0, 1, 2) +widgetLayout.addWidget(ComboInstallPath, 1, 0, 1, 2) +widgetLayout.addWidget(BtnShowUengineApp, 2, 0, 1, 1) +widgetLayout.addWidget(FrmInstallWidget, 0, 2, 3, 1) +FrmInstall.addWidget(BtnFindApk, 0, 0, 1, 1) +FrmInstall.addWidget(BtnInstall, 0, 1, 1, 1) +FrmInstall.addWidget(BtnUninstall, 1, 0, 1, 1) +FrmInstall.addWidget(Btngeticon, 1, 1, 1, 1) +FrmInstall.addWidget(BtnSaveApk, 2, 0, 1, 1) +FrmInstall.addWidget(BtnApkInformation, 2, 1, 1, 1) +# 设置菜单栏 +menu = window.menuBar() +programmenu = menu.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Name"]) +adb = menu.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Name"]) +uengine = menu.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Name"]) +help = menu.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Name"]) +cleanProgramHistory = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][0]) +settingWindow = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][2]) +exitProgram = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][1]) +programmenu.addAction(cleanProgramHistory) +programmenu.addAction(settingWindow) +programmenu.addSeparator() +programmenu.addAction(exitProgram) +# 绑定事件 +cleanProgramHistory.triggered.connect(CleanProgramHistory) +settingWindow.triggered.connect(SettingWindow.ShowWindow) +exitProgram.triggered.connect(window.close) +adbUengineConnect = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][0]) +adbConnectDevice = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][2]) +adbChangeUengineDisplaySize = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][3]) +adbAndroidInstallAppList = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][4]) +adbTop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][5]) +adbShell = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][6]) +adbScrcpyConnectUengine = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][7]) +adb.addAction(adbUengineConnect) +adb.addSeparator() +adbServer = adb.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Name"]) +adb.addAction(adbConnectDevice) +adb.addSeparator() +adb.addAction(adbChangeUengineDisplaySize) +adb.addAction(adbAndroidInstallAppList) +adb.addAction(adbTop) +adb.addAction(adbShell) +adb.addAction(adbScrcpyConnectUengine) +adb.addSeparator() +uengineUseAdbm = adb.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Name"]) +adbStartServer = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][0]) +adbStopServer = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][1]) +adbKillAdbProgress = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2]) +uengineConnectAdb = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][0]) +uengineUseAdb = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][1]) +uengineDoNotUseAdb = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][2]) +# 绑定信号 +uengineConnectAdb.triggered.connect(UengineConnectAdb) +adbConnectDevice.triggered.connect(AdbConnectDeviceShow) +adbChangeUengineDisplaySize.triggered.connect(AdbChangeUengineDisplaySize.ShowWindows) +adbAndroidInstallAppList.triggered.connect(AdbAndroidInstallAppList) +adbTop.triggered.connect(AdbCPUAndRAWShowInTer) +adbShell.triggered.connect(AdbShellShowInTer) +adbScrcpyConnectUengine.triggered.connect(ScrcpyConnectUengine) -LabApkPath.grid(row=0, column=0,sticky= tk.W,padx=3) -ComboInstallPath.grid(row=1, column=0,padx=3) +adbServer.addAction(adbStartServer) +adbServer.addAction(adbStopServer) +adbServer.addAction(adbKillAdbProgress) +# 绑定信号 +adbStartServer.triggered.connect(AdbStartServer) +adbStopServer.triggered.connect(AdbStopServer) +adbKillAdbProgress.triggered.connect(AdbKillAdbProgress) +uengineUseAdbm.addAction(uengineConnectAdb) +uengineUseAdbm.addAction(uengineUseAdb) +uengineUseAdbm.addSeparator() +uengineUseAdbm.addAction(uengineDoNotUseAdb) +# 绑定信号 +uengineConnectAdb.triggered.connect(UengineConnectAdb) +uengineUseAdb.triggered.connect(UengineUseAdb) +uengineDoNotUseAdb.triggered.connect(UengineDoNotUseAdb) -FrmInstall.grid(row=0, column=1,padx=3, rowspan=3) -BtnFindApk.grid(row=0, column=0) -BtnInstall.grid(row=0, column=1) +uengineAllowOrDisallowUpdateAndroidApp = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][13]) +uengineSetHttpProxy = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][15]) +uengineOpenDebBuilder = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][1]) +uengineKeyboardToMouse = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][7]) +uengineCheckCpu = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][8]) +uengineUbuntuInstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][12]) +uengineDeleteUengineCheck = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][9]) +uengineReinstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][10]) +uengineUbuntuInstall = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][14]) +uengineWindowSizeSetting = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][16]) +uengine.addAction(uengineAllowOrDisallowUpdateAndroidApp) +uengine.addAction(uengineSetHttpProxy) +uengine.addAction(uengineOpenDebBuilder) +uengine.addAction(uengineKeyboardToMouse) +uengine.addAction(uengineCheckCpu) +uengine.addAction(uengineUbuntuInstall) +uengine.addAction(uengineWindowSizeSetting) +uengineService = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Name"]) +uengineInternet = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Name"]) +uengineIcon = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Name"]) +uengine.addMenu(uengineUseAdbm) +uengineData = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Name"]) +uengine.addAction(uengineDeleteUengineCheck) +uengine.addAction(uengineReinstall) +uengineRoot = uengine.addMenu(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Name"]) +# 绑定信号 +uengineAllowOrDisallowUpdateAndroidApp.triggered.connect(AllowOrDisallowUpdateAndroidApp) +uengineSetHttpProxy.triggered.connect(SetHttpProxy) +uengineOpenDebBuilder.triggered.connect(OpenUengineDebBuilder) +uengineKeyboardToMouse.triggered.connect(KeyboardToMouse) +uengineCheckCpu.triggered.connect(UengineCheckCpu) +uengineUbuntuInstall.triggered.connect(UengineUbuntuInstall) +uengineDeleteUengineCheck.triggered.connect(DelUengineCheck) +uengineReinstall.triggered.connect(ReinstallUengine) +uengineWindowSizeSetting.triggered.connect(UengineWindowSizeSetting.ShowWindow) -BtnUninstall.grid(row=1, column=0) +uengineStart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][0]) +uengineStop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][1]) +uengineRestart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][2]) +uengineService.addAction(uengineStart) +uengineService.addAction(uengineStop) +uengineService.addAction(uengineRestart) +# 绑定信号 +uengineStart.triggered.connect(StartUengine) +uengineStop.triggered.connect(StopUengine) +uengineRestart.triggered.connect(UengineRestart) -BtnShowUengineApp.grid(row=2, column=0,sticky= tk.W,padx=3,pady=2) +uengineBridgeStart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][0]) +uengineBridgeStop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][1]) +uengineBridgeRestart = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][2]) +uengineBridgeReload = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][3]) +uengineBridgeForceReload = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][4]) +uengineInternet.addAction(uengineBridgeStart) +uengineInternet.addAction(uengineBridgeStop) +uengineInternet.addAction(uengineReinstall) +uengineInternet.addAction(uengineBridgeReload) +uengineInternet.addAction(uengineBridgeForceReload) +# 绑定信号 +uengineBridgeStart.triggered.connect(UengineBridgeStart) +uengineBridgeStop.triggered.connect(UengineBridgeStop) +uengineBridgeRestart.triggered.connect(UengineBridgeRestart) +uengineBridgeReload.triggered.connect(UengineBridgeReload) +uengineBridgeForceReload.triggered.connect(UengineBridgeForceReload) -BtnApkInformation.grid(row=2, column=1,sticky= tk.W,padx=3,pady=2) -Btngeticon.grid(row=1, column=1,sticky= tk.W,padx=3,pady=2) -BtnSaveApk.grid(row=2, column=0,sticky= tk.W,padx=3,pady=2) +uengineSendUengineAndroidListForDesktop = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][0]) +uengineSendUengineAndroidListForLauncher = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][1]) +uengineAddNewUengineDesktopLink = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][2]) +uengineCleanAllUengineDesktopLink = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][3]) +uengineIcon.addAction(uengineSendUengineAndroidListForDesktop) +uengineIcon.addAction(uengineSendUengineAndroidListForLauncher) +uengineIcon.addSeparator() +uengineIcon.addAction(uengineAddNewUengineDesktopLink) +uengineIcon.addSeparator() +uengineIcon.addAction(uengineCleanAllUengineDesktopLink) +# 绑定信号 +uengineSendUengineAndroidListForDesktop.triggered.connect(SendUengineAndroidListForDesktop) +uengineSendUengineAndroidListForLauncher.triggered.connect(SendUengineAndroidListForLauncher) +uengineAddNewUengineDesktopLink.triggered.connect(AddNewUengineDesktopLink.ShowWindow) +uengineCleanAllUengineDesktopLink.triggered.connect(CleanAllUengineDesktopLink) -window.pack() +#uengineData +uengineOpenRootData = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][0]) +uengineOpenUserData = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][1]) +uengineBackClean = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][2]) +uengineData.addAction(uengineOpenRootData) +uengineData.addAction(uengineOpenUserData) +uengineData.addSeparator() +uengineData.addAction(uengineBackClean) +# 绑定信号 +uengineOpenRootData.triggered.connect(OpenUengineRootData) +uengineOpenUserData.triggered.connect(OpenUengineUserData) +uengineBackClean.triggered.connect(BackUengineClean) -win.mainloop() +#uengineRoot +uengineInstallRootUengineImage = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][0]) +uengineBuildRootUengineImage = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][1]) +uengineReinstallUengineImage = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][2]) +uengineRoot.addAction(uengineInstallRootUengineImage) +uengineRoot.addAction(uengineBuildRootUengineImage) +uengineRoot.addSeparator() +uengineRoot.addAction(uengineReinstallUengineImage) +# 绑定信号 +uengineInstallRootUengineImage.triggered.connect(InstallRootUengineImage) +uengineBuildRootUengineImage.triggered.connect(BuildRootUengineImage) +uengineReinstallUengineImage.triggered.connect(ReinstallUengineImage) + +helpOpenProgramUrl = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][0]) +helpUengineRunnerBugUpload = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][2]) +helpShowHelp = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][4]) +helpRunnerUpdate = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][3]) +helpAbout = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][1]) +helpAboutQt = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][5]) +help.addAction(helpOpenProgramUrl) +help.addAction(helpUengineRunnerBugUpload) +help.addAction(helpShowHelp) +help.addAction(helpRunnerUpdate) +help.addAction(helpAbout) +help.addAction(helpAboutQt) +hm1 = help.addMenu("更多生态适配应用") +hm1_1 = QtWidgets.QAction("运行 Windows 应用:Wine 运行器") +hm1.addAction(hm1_1) +hm1_1.triggered.connect(lambda: webbrowser.open_new_tab("https://gitee.com/gfdgd-xi/deep-wine-runner")) +# 绑定信号 +helpOpenProgramUrl.triggered.connect(OpenProgramURL) +helpUengineRunnerBugUpload.triggered.connect(UengineRunnerBugUpload) +helpShowHelp.triggered.connect(ShowHelp) +helpRunnerUpdate.triggered.connect(UpdateWindow.ShowWindow) +helpAbout.triggered.connect(showhelp) +helpAboutQt.triggered.connect(lambda: QtWidgets.QMessageBox.aboutQt(widget)) +# 设置窗口 +app.setStyle(QtWidgets.QStyleFactory.create(settingConf["Theme"])) +widget.setLayout(widgetLayout) +window.setCentralWidget(widget) +window.setWindowTitle(title) +window.show() +window.setWindowIcon(QtGui.QIcon(iconPath)) +window.setFixedSize(window.frameSize().width(), window.frameSize().height()) +sys.exit(app.exec_()) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug index e4e742b..a5ac2a9 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug @@ -1,15 +1,14 @@ #!/usr/bin/env python3 import os +import sys import json import base64 import requests -import ttkthemes import traceback import webbrowser -import tkinter as tk -import tkinter.ttk as ttk -import tkinter.messagebox as messagebox import urllib.parse as parse +import PyQt5.QtGui as QtGui +import PyQt5.QtWidgets as QtWidgets # 读取文本文档 def readtxt(path: "路径")->"读取文本文档": @@ -28,17 +27,18 @@ def Update(name, stars, contact, things, version): "Version": version } try: - messagebox.showinfo(message=requests.post(parse.unquote(base64.b64decode("aHR0cCUzQS8vMTIwLjI1LjE1My4xNDQvdWVuZ2luZS1ydW5uZXIvYnVnL3VwbG9hZC5waHA=").decode("utf-8")), data=data).text) + QtWidgets.QMessageBox.information(widget, "提示", requests.post(parse.unquote(base64.b64decode("aHR0cCUzQS8vMTIwLjI1LjE1My4xNDQvdWVuZ2luZS1ydW5uZXIvYnVnL3VwbG9hZC5waHA=").decode("utf-8")), data=data).text) + print(data) except: traceback.print_exc() - messagebox.showerror(title="错误", message="服务器疑似出现错误,可以进行以下尝试:①多尝试几次;②使用其他反馈途径\n错误信息:{}".format(traceback.format_exc())) + QtWidgets.QMessageBox.critical(widget, "错误", f"服务器疑似出现错误,可以进行以下尝试:①多尝试几次;②使用其他反馈途径\n错误信息:{traceback.format_exc()}") def UpdateButtonClick(): #判断是否为空 - if nameThings.get() == "" or starValue.get() == "" or contactThings.get() == "" or updateThings.get(1.0, "end").replace(" ", "").replace("\n", "") == "": - messagebox.showerror(title="错误", message="反馈信息未填写完整!") + if nameThings.text() == "" or starMenu.currentText() == "" or contactThings.text() == "" or updateThings.toPlainText().replace(" ", "").replace("\n", "") == "": + QtWidgets.QMessageBox.critical(widget, "错误", "反馈信息未填写完整!") return - Update(name=nameThings.get(), stars=starValue.get(), contact=contactThings.get(), things=updateThings.get(1.0, "end"), version=version) + Update(name=nameThings.text(), stars=starMenu.currentText(), contact=contactThings.text(), things=updateThings.toPlainText(), version=version) def OpenGiteeIssues(): webbrowser.open_new_tab("https://gitee.com/gfdgd-xi/uengine-runner/issues") @@ -46,6 +46,9 @@ def OpenGiteeIssues(): def OpenGithubIssues(): webbrowser.open_new_tab("https://github.com/gfdgd-xi/uengine-runner/issues") +def OpenGitlinkIssues(): + webbrowser.open_new_tab("https://www.gitlink.org.cn/gfdgd_xi/uengine-runner/issues") + # 获取用户主目录 def get_home()->"获取用户主目录": return os.path.expanduser('~') @@ -53,7 +56,7 @@ def get_home()->"获取用户主目录": ########################### # 程序信息 ########################### -iconPath = "{}/runner.png".format(os.path.split(os.path.realpath(__file__))[0]) +iconPath = "{}/runner.svg".format(os.path.split(os.path.realpath(__file__))[0]) programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string information = json.loads(readtxt(programPath + "/information.json")) version = information["Version"] @@ -61,68 +64,42 @@ version = information["Version"] ########################### # 窗口创建 ########################### -# 读取主题 -try: - theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0")) -except: - print("主题读取错误,默认使用浅色主题") - theme = True -if theme: - window = tk.Tk() - themes = ttkthemes.ThemedStyle(window) - themes.set_theme("breeze") -else: - import ttkbootstrap - style = ttkbootstrap.Style(theme="darkly") - window = style.master # 创建窗口 -win = ttk.Frame() - -starValue = tk.StringVar() -starValue.set("5分") - -name = ttk.Label(win, text="你的昵称:") -nameThings = ttk.Entry(win, width=25) - -contact = ttk.Label(win, text="联系方式(电子邮箱):") -contactThings = ttk.Entry(win, width=25) - -star = ttk.Label(win, text="评分:") -starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分") - -updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):") -updateThings = tk.Text(win, width=100) - -otherUpload = ttk.Frame(win) -# 所属内容 -tips = ttk.Label(otherUpload, text="如果无法正常反馈,可以用其他方式反馈:") -giteeButton = ttk.Button(otherUpload, text="Gitee Issues", command=OpenGiteeIssues) -githubButton = ttk.Button(otherUpload, text="Github Issues", command=OpenGithubIssues) - -updateButton = ttk.Button(win, text="提交", command=UpdateButtonClick) - -# 设置窗口 -window.title("UEngine 运行器 {} 问题/建议反馈".format(version)) -window.resizable(0, 0) -window.iconphoto(False, tk.PhotoImage(file=iconPath)) - -tips.grid(row=0, column=0) -giteeButton.grid(row=0, column=1) -githubButton.grid(row=0, column=2) - -name.grid(row=0, column=0) -nameThings.grid(row=0, column=1) - -contact.grid(row=0, column=2) -contactThings.grid(row=0, column=3) - -star.grid(row=0, column=4) -starMenu.grid(row=0, column=5) - -updateThingsTips.grid(row=1, column=0, columnspan=2) -updateThings.grid(row=2, column=0, columnspan=6) - -otherUpload.grid(row=3, column=0, columnspan=4, sticky=tk.W) -updateButton.grid(row=3, column=5) - -win.pack(expand="yes", fill="both") -window.mainloop() \ No newline at end of file +app = QtWidgets.QApplication(sys.argv) +window = QtWidgets.QMainWindow() +widget = QtWidgets.QWidget() +widgetLayout = QtWidgets.QGridLayout() +nameThings = QtWidgets.QLineEdit() +contactThings = QtWidgets.QLineEdit() +starMenu = QtWidgets.QComboBox() +updateThings = QtWidgets.QTextEdit() +updateButton = QtWidgets.QPushButton("提交") +otherUpload = QtWidgets.QHBoxLayout() +giteeButton = QtWidgets.QPushButton("Gitee Issues") +githubButton = QtWidgets.QPushButton("Github Issues") +gitlinkButton = QtWidgets.QPushButton("Gitlink Issues") +otherUpload.addWidget(QtWidgets.QLabel("如果无法正常反馈,可以用其他方式反馈:")) +otherUpload.addWidget(giteeButton) +otherUpload.addWidget(githubButton) +otherUpload.addWidget(gitlinkButton) +otherUpload.addSpacerItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) +starMenu.addItems(["5分", "4分", "3分", "2分", "1分"]) +widgetLayout.addWidget(QtWidgets.QLabel("你的昵称:"), 0, 0, 1, 1) +widgetLayout.addWidget(QtWidgets.QLabel("联系方式(电子邮箱):"), 0, 2, 1, 1) +widgetLayout.addWidget(QtWidgets.QLabel("评分:"), 0, 4, 1, 1) +widgetLayout.addWidget(QtWidgets.QLabel("反馈内容(支持 Markdown 格式):"), 1, 0, 1, 2) +widgetLayout.addWidget(nameThings, 0, 1, 1, 1) +widgetLayout.addWidget(contactThings, 0, 3, 1, 1) +widgetLayout.addWidget(starMenu, 0, 5, 1, 1) +widgetLayout.addWidget(updateThings, 2, 0, 1, 6) +widgetLayout.addLayout(otherUpload, 3, 0, 1, 5) +widgetLayout.addWidget(updateButton, 3, 5, 1, 1) +giteeButton.clicked.connect(OpenGiteeIssues) +githubButton.clicked.connect(OpenGithubIssues) +gitlinkButton.clicked.connect(OpenGitlinkIssues) +updateButton.clicked.connect(UpdateButtonClick) +widget.setLayout(widgetLayout) +window.setCentralWidget(widget) +window.setWindowTitle(f"UEngine 运行器 {version} 问题/建议反馈") +window.setWindowIcon(QtGui.QIcon(iconPath)) +window.show() +sys.exit(app.exec_()) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb index 2c36d77..85fe2be 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb @@ -1,15 +1,12 @@ #!/usr/bin/env python3 ######################################### -# 版本:1.6.2 -# 更新时间:2022年06月19日 +# 版本:1.8.0 +# 更新时间:2022年07月23日 ######################################### import os import sys import traceback -import ttkthemes -import tkinter as tk -import tkinter.ttk as ttk -import tkinter.messagebox as messagebox +import PyQt5.QtWidgets as QtWidgets ######################## # ######################## @@ -29,40 +26,34 @@ def readtxt(path: "路径")->"读取文本文档": ################### # 判断是不是 root ################### +app = QtWidgets.QApplication(sys.argv) if os.geteuid() != 0: print("不是以 root 权限运行本程序!") - root = tk.Tk() - root.overrideredirect(1) - root.withdraw() - messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!") + QtWidgets.QMessageBox.critical(None, "错误", "不是以 root 权限运行本程序!") sys.exit(1) ################### # ################### -window = tk.Tk() -style = ttkthemes.ThemedStyle(window) -style.set_theme("breeze") -window.withdraw() try: - if sys.argv[1] == "1" and messagebox.askokcancel(title="提示", message="你确定要删除吗?"): + if sys.argv[1] == "1" and QtWidgets.QMessageBox.question(None, "提示", "你确定要删除吗?", QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Ok: os.remove("/data/uengine/data/data/misc/adb/adb_keys") - messagebox.showinfo(title="提示", message="完成") + QtWidgets.QMessageBox.information(None, "提示", "完成") except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.critical(None, "错误", traceback.format_exc()) sys.exit(2) if sys.argv[1] == "1": sys.exit(0) -if not messagebox.askyesno(title="提示", message='''请阅读以下提示然后确定是否继续: +if QtWidgets.QMessageBox.question(None, "提示", '''请阅读以下提示然后确定是否继续: 1、安装后即可使用 adb 连接 UEngine; 2、重置 UEngine 或 adb 就需要重新设置该支持补丁; -3、需要 root 权限;'''): +3、需要 root 权限;''') == QtWidgets.QMessageBox.No: sys.exit(0) # 写入(需要 root) if not os.path.exists("/data/uengine/data/data/misc/adb"): - messagebox.showerror(title="错误", message="无法读取 UEngine 数据!") + QtWidgets.QMessageBox.critical(None, "错误", "无法读取 UEngine 数据!") sys.exit(1) try: things = readtxt(sys.argv[2]) @@ -74,8 +65,8 @@ try: if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"): old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n" write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey)) - messagebox.showinfo(title="提示", message="完成") + QtWidgets.QMessageBox.information(None, "提示", "完成") except: traceback.print_exc() - messagebox.showerror(title="错误", message=traceback.format_exc()) + QtWidgets.QMessageBox.information(None, "错误", traceback.format_exc()) sys.exit(2) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py new file mode 100755 index 0000000..28e8136 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +import os +import sys +import shutil +import traceback + +def Add(): + try: + shutil.copy(f"/tmp/{sys.argv[2]}.txt", f"/usr/share/uengine/appetc/{sys.argv[2]}.txt") + except: + traceback.print_exc() + sys.exit(1) + +def Del(): + try: + os.remove(f"/usr/share/uengine/appetc/{sys.argv[2]}.txt") + except: + traceback.print_exc() + sys.exit(1) + +def Help(): + print("帮助:") + print("-?/--help 查看程序帮助") + print("-a/--add 设置程序显示配置(参数后面要加包名,配置需要先保存到 /tmp 下,文件名为“APK包名.txt”,需要 Root 权限)") + print("-d/--del 删除程序显示配置(参数后面要加包名,需要 Root 权限)") + +if __name__ == "__main__": + if len(sys.argv) < 3: + print("至少要三个参数,输入 --help 获取帮助") + sys.exit(0) + if "-?" in sys.argv[1] or "--help" in sys.argv: + Help() + sys.exit(0) + if os.geteuid() != 0: + print("不是以 root 权限运行本程序!") + sys.exit(1) + if sys.argv[1] == "-a" or sys.argv[1] == "--add": + Add() + sys.exit(0) + if sys.argv[1] == "-d" or sys.argv[1] == "--del": + Del() + sys.exit(0) + print("参数错误!") + sys.exit(1) \ No newline at end of file diff --git a/new-deb-build/usr/share/doc/com.gitee.uengine.runner.spark/copyright b/new-deb-build/usr/share/doc/com.gitee.uengine.runner.spark/copyright new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/new-deb-build/usr/share/doc/com.gitee.uengine.runner.spark/copyright @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program 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. + + This program 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 this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine.window.size.setting.policy b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine.window.size.setting.policy new file mode 100644 index 0000000..43c3315 --- /dev/null +++ b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine.window.size.setting.policy @@ -0,0 +1,21 @@ + + + + gfdgd xi + https://gitee.com/gfdgd-xi/uengine-runner/ + + Authentication is required to Set UEngine Window Size Config + 设置 UEngine 窗口大小配置需要输入密码 + preferences-system + + no + no + auth_admin_keep + + /opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py + true + + + \ No newline at end of file diff --git a/pkexec/com.deepin.pkexec.uengine.window.size.setting.policy b/pkexec/com.deepin.pkexec.uengine.window.size.setting.policy new file mode 100644 index 0000000..43c3315 --- /dev/null +++ b/pkexec/com.deepin.pkexec.uengine.window.size.setting.policy @@ -0,0 +1,21 @@ + + + + gfdgd xi + https://gitee.com/gfdgd-xi/uengine-runner/ + + Authentication is required to Set UEngine Window Size Config + 设置 UEngine 窗口大小配置需要输入密码 + preferences-system + + no + no + auth_admin_keep + + /opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py + true + + + \ No newline at end of file diff --git a/uengine-keyboard b/uengine-keyboard index d6d9d3f..eaf54a7 100755 --- a/uengine-keyboard +++ b/uengine-keyboard @@ -18,8 +18,6 @@ import tkinter as tk import tkinter.ttk as ttk import tkinter.messagebox as messagebox import tkinter.filedialog as filedialog -import Xlib.threaded as threaded -#import pymouse.unix as pymouse ######################## # ######################## diff --git a/uengine-window-size-setting.py b/uengine-window-size-setting.py new file mode 100755 index 0000000..28e8136 --- /dev/null +++ b/uengine-window-size-setting.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +import os +import sys +import shutil +import traceback + +def Add(): + try: + shutil.copy(f"/tmp/{sys.argv[2]}.txt", f"/usr/share/uengine/appetc/{sys.argv[2]}.txt") + except: + traceback.print_exc() + sys.exit(1) + +def Del(): + try: + os.remove(f"/usr/share/uengine/appetc/{sys.argv[2]}.txt") + except: + traceback.print_exc() + sys.exit(1) + +def Help(): + print("帮助:") + print("-?/--help 查看程序帮助") + print("-a/--add 设置程序显示配置(参数后面要加包名,配置需要先保存到 /tmp 下,文件名为“APK包名.txt”,需要 Root 权限)") + print("-d/--del 删除程序显示配置(参数后面要加包名,需要 Root 权限)") + +if __name__ == "__main__": + if len(sys.argv) < 3: + print("至少要三个参数,输入 --help 获取帮助") + sys.exit(0) + if "-?" in sys.argv[1] or "--help" in sys.argv: + Help() + sys.exit(0) + if os.geteuid() != 0: + print("不是以 root 权限运行本程序!") + sys.exit(1) + if sys.argv[1] == "-a" or sys.argv[1] == "--add": + Add() + sys.exit(0) + if sys.argv[1] == "-d" or sys.argv[1] == "--del": + Del() + sys.exit(0) + print("参数错误!") + sys.exit(1) \ No newline at end of file