diff --git a/Language.json b/Language.json index 8fa00f2..60aa763 100644 --- a/Language.json +++ b/Language.json @@ -3,7 +3,7 @@ "Main": { "MainWindow": { "Title": "UEngine 运行器", - "LabApkPath": "安装 APK:", + "LabApkPath": "安装/卸载 APK:", "LabUninstallPath": "卸载 Apk:", "BtnFindApk": "浏览", "BtnInstall": "安装", @@ -12,6 +12,7 @@ "BtnUninstall": "卸载", "Btngeticon": "保存图标", "BtnSaveApk": "保存Apk", + "BtnApkInformation": "Apk 信息", "Menu": [ { "Name": "程序", @@ -92,14 +93,18 @@ "清空 UEngine 数据(需要 Root)" ] }, - "UEngine 键盘映射" + "UEngine 键盘映射", + "UEngine 检测 CPU 是否支持运行", + "删除 UEngine 运行检查", + "重新安装 UEngine" ] }, { "Name": "关于", "Menu": [ "程序官网", - "关于" + "关于", + "反馈程序问题和建议" ] } ] @@ -125,8 +130,7 @@ "Main": { "MainWindow": { "Title": "UEngine Runner", - "LabApkPath": "Install Apk:", - "LabUninstallPath": "Uninstall Apk", + "LabApkPath": "Install Or Uninstall Apk:", "BtnFindApk": "Find", "BtnInstall": "Install", "BtnShowUengineApp": "Open UEngine App List", @@ -134,6 +138,7 @@ "BtnUninstall": "Uninstall", "Btngeticon": "Save Apk Icon", "BtnSaveApk": "Saving Installed App Apk", + "BtnApkInformation": "Apk Information", "Menu": [ { "Name": "Program", @@ -214,14 +219,18 @@ "Delete All UEngine Data (It Need Run With Root)" ] }, - "UEngine Keyboard" + "UEngine Keyboard", + "UEngine Check CPU Can Or Can't Run", + "Delete UEngine Runing Checking", + "Reinstall UEngine" ] }, { "Name": "About", "Menu": [ "Program WebSize", - "Program Help" + "Program Help", + "Upload Problem And Advice" ] } ] diff --git a/README.md b/README.md index 7af9916..917e463 100755 --- a/README.md +++ b/README.md @@ -7,10 +7,21 @@ (自己美术功底太差,图标直接用 anbox 的了) ### 更新内容 +#### V1.5.1(2021-10-05,国庆节版): +**※1、精简用户界面,合并安装和卸载输入框和浏览按钮等** +**※2、修复安装以其的程序图标无法点击进入的问题(deepin 社区版不存在此问题)** +**※3、支持在程序本体反馈问题** +4、修复了菜单栏的部分显示问题 +5、支持显示 apk 的部分信息 +6、支持删除 UEngine 程序运行检查以及重新安装 UEngine 的功能 +7、自带有跳过家庭版必须有指定包名才能运行程序限制的脚本 +8、补回依赖包“adb” +![]() + #### V1.5.0(2021-09-21,中秋节版): -**没有什么实质性的功能,只是开始有多语言支持** -**※1、部分窗口支持英语** -**2、修复在英语状态下启动器图标名称异常的问题** +**没有什么实质性的功能,只是开始有多语言支持** +**※1、部分窗口支持英语** +2、修复在英语状态下启动器图标名称异常的问题 ![1.5.0](https://storage.deepin.org/thread/202109202157289430_截图_选择区域_20210920215550.png) #### V1.4.3(2021-09-11,开学第一版): diff --git a/UengineAndroidProgramList.desktop b/UengineAndroidProgramList.desktop index a8821d7..8ff8e7a 100755 --- a/UengineAndroidProgramList.desktop +++ b/UengineAndroidProgramList.desktop @@ -2,7 +2,7 @@ Categories=System; Comment=UEngine 程序菜单 Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity +Exec=/usr/bin/uengine launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity Icon=/opt/apps/uengine-runner/icon.png MimeType= Name=UEngine 程序菜单 diff --git a/build/DEBIAN/control b/build/DEBIAN/control index 4e8ca70..ea7341b 100644 --- a/build/DEBIAN/control +++ b/build/DEBIAN/control @@ -1,10 +1,10 @@ Package: spark-uengine-runner -Version: 1.5.0 +Version: 1.5.1 Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com> Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner] Architecture: all Priority: optional Conflicts: com.gitee.uengine.runner.spark, spark-uengine-apk-builder -Depends: python3, python3-tk, python3-pip, aapt, uengine, python3-pil, python3-setuptools, deepin-terminal +Depends: python3, python3-tk, python3-pip, aapt, uengine, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell Description: UEngine Runner for deepin and UOS diff --git a/build/DEBIAN/postinst b/build/DEBIAN/postinst index cd4e620..ceea762 100755 --- a/build/DEBIAN/postinst +++ b/build/DEBIAN/postinst @@ -1,5 +1,10 @@ #!/bin/sh -python3 -m pip install --upgrade ttkthemes -python3 -m pip install --upgrade pyautogui -python3 -m pip install --upgrade keyboard -python3 -m pip install --upgrade requests +# 安装所需库 +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 requests -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +# 刷新图标缓存 +gtk-update-icon-cache /usr/share/icons/bloom +# 向服务器返回安装数加1(不显示内容且忽略错误) +curl http://gfdgdxi.qicp.vip/uengine/Install.php -s > /dev/null | true \ No newline at end of file diff --git a/build/DEBIAN/postrm b/build/DEBIAN/postrm new file mode 100755 index 0000000..eb683d7 --- /dev/null +++ b/build/DEBIAN/postrm @@ -0,0 +1,14 @@ +#!/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 +# 刷新图标缓存 +gtk-update-icon-cache /usr/share/icons/bloom \ No newline at end of file diff --git a/build/opt/apps/uengine-runner/Language.json b/build/opt/apps/uengine-runner/Language.json index 8fa00f2..60aa763 100644 --- a/build/opt/apps/uengine-runner/Language.json +++ b/build/opt/apps/uengine-runner/Language.json @@ -3,7 +3,7 @@ "Main": { "MainWindow": { "Title": "UEngine 运行器", - "LabApkPath": "安装 APK:", + "LabApkPath": "安装/卸载 APK:", "LabUninstallPath": "卸载 Apk:", "BtnFindApk": "浏览", "BtnInstall": "安装", @@ -12,6 +12,7 @@ "BtnUninstall": "卸载", "Btngeticon": "保存图标", "BtnSaveApk": "保存Apk", + "BtnApkInformation": "Apk 信息", "Menu": [ { "Name": "程序", @@ -92,14 +93,18 @@ "清空 UEngine 数据(需要 Root)" ] }, - "UEngine 键盘映射" + "UEngine 键盘映射", + "UEngine 检测 CPU 是否支持运行", + "删除 UEngine 运行检查", + "重新安装 UEngine" ] }, { "Name": "关于", "Menu": [ "程序官网", - "关于" + "关于", + "反馈程序问题和建议" ] } ] @@ -125,8 +130,7 @@ "Main": { "MainWindow": { "Title": "UEngine Runner", - "LabApkPath": "Install Apk:", - "LabUninstallPath": "Uninstall Apk", + "LabApkPath": "Install Or Uninstall Apk:", "BtnFindApk": "Find", "BtnInstall": "Install", "BtnShowUengineApp": "Open UEngine App List", @@ -134,6 +138,7 @@ "BtnUninstall": "Uninstall", "Btngeticon": "Save Apk Icon", "BtnSaveApk": "Saving Installed App Apk", + "BtnApkInformation": "Apk Information", "Menu": [ { "Name": "Program", @@ -214,14 +219,18 @@ "Delete All UEngine Data (It Need Run With Root)" ] }, - "UEngine Keyboard" + "UEngine Keyboard", + "UEngine Check CPU Can Or Can't Run", + "Delete UEngine Runing Checking", + "Reinstall UEngine" ] }, { "Name": "About", "Menu": [ "Program WebSize", - "Program Help" + "Program Help", + "Upload Problem And Advice" ] } ] diff --git a/build/opt/apps/uengine-runner/UengineAndroidProgramList.desktop b/build/opt/apps/uengine-runner/UengineAndroidProgramList.desktop index 1b126d3..110309e 100755 --- a/build/opt/apps/uengine-runner/UengineAndroidProgramList.desktop +++ b/build/opt/apps/uengine-runner/UengineAndroidProgramList.desktop @@ -1,11 +1,11 @@ [Desktop Entry] Categories=System; -Comment=uengine(anbox) 程序菜单 +Comment=UEngine 程序菜单 Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity +Exec=/usr/bin/uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity Icon=/opt/apps/uengine-runner/icon.png MimeType= -Name=uengine 程序菜单 -StartupWMClass=uengine 程序菜单 +Name=UEngine 程序菜单 +StartupWMClass=UEngine 程序菜单 Terminal=false Type=Application diff --git a/build/opt/apps/uengine-runner/information.json b/build/opt/apps/uengine-runner/information.json index 9bbd05c..19a922a 100755 --- a/build/opt/apps/uengine-runner/information.json +++ b/build/opt/apps/uengine-runner/information.json @@ -3,7 +3,7 @@ "https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner" ], - "Version": "1.5.0", + "Version": "1.5.1", "System": "Linux(deepin/UOS)", "Tips": [ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis", @@ -26,6 +26,16 @@ "4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V1.5.1:", + "※1、精简用户界面,合并安装和卸载输入框和浏览按钮等", + "※2、修复安装以其的程序图标无法点击进入的问题(deepin 社区版不存在此问题)", + "※3、支持在程序本体反馈问题", + "4、修复了菜单栏的部分显示问题", + "5、支持显示 apk 的部分信息", + "6、支持删除 UEngine 程序运行检查以及重新安装 UEngine 的功能", + "7、自带有跳过家庭版必须有指定包名才能运行程序限制的脚本", + "8、补回依赖包“adb”", + "", "V1.5.0:", "※1、部分窗口支持英语", "2、修复在英语状态下启动器图标名称异常的问题", diff --git a/build/opt/apps/uengine-runner/setting-new.json b/build/opt/apps/uengine-runner/setting-new.json new file mode 100755 index 0000000..5edfd97 --- /dev/null +++ b/build/opt/apps/uengine-runner/setting-new.json @@ -0,0 +1,6 @@ +{ + "Package": "com.gitee.uengine.runner.spark", + "Update": true, + "Version": "1.5.1", + "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" +} \ No newline at end of file diff --git a/build/opt/apps/uengine-runner/setting.json b/build/opt/apps/uengine-runner/setting.json index be23244..d4f0364 100755 --- a/build/opt/apps/uengine-runner/setting.json +++ b/build/opt/apps/uengine-runner/setting.json @@ -1,7 +1,7 @@ { "Package": "spark-uengine-runner", "Update": true, - "Version": "1.5.0", + "Version": "1.5.1", "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" } \ No newline at end of file diff --git a/build/opt/apps/uengine-runner/uengine-apk-builder b/build/opt/apps/uengine-runner/uengine-apk-builder index d78a287..fbbf991 100755 --- a/build/opt/apps/uengine-runner/uengine-apk-builder +++ b/build/opt/apps/uengine-runner/uengine-apk-builder @@ -148,7 +148,7 @@ done exit 0'''.format(apkPackageName) desktopFile = '''[Desktop Entry] Categories=Other; -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} Icon=/usr/share/uengine/icons/{}.png Terminal=false Type=Application @@ -294,7 +294,7 @@ def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath) [Desktop Entry] Categories=app; Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=/usr/bin/uengine launch.sh --action=android.intent.action.MAIN --package={} --component={} GenericName={} Icon={} MimeType= @@ -313,16 +313,16 @@ def GetApkChineseLabel(apkFilePath): line = line.replace("'", "") return line -def GetApkIconInApk(apkFilePath): - info = GetApkInformation(apkFilePath) - for line in info.split('\n'): - if "application:" in line: - line = line[line.index("icon='"): -1] - line = line.replace("icon='", "") - if "'" in line: - line = line[0: line.index("'")] - return line - return line +#def GetApkIconInApk(apkFilePath): +# info = GetApkInformation(apkFilePath) +# for line in info.split('\n'): +# if "application:" in line: +# line = line[line.index("icon='"): -1] +# line = line.replace("icon='", "") +# if "'" in line: +# line = line[0: line.index("'")] +# return line +# return line #合并两个函数到一起 def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": diff --git a/build/opt/apps/uengine-runner/uengine-install (1).desktop b/build/opt/apps/uengine-runner/uengine-install (1).desktop new file mode 100755 index 0000000..e386dfa --- /dev/null +++ b/build/opt/apps/uengine-runner/uengine-install (1).desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Categories=system;Utility; +Encoding=UTF-8 +Exec=uengine-runner -ci %F +GenericName=APK Install(UEngine) +GenericName[zh_CN]=APK 安装(UEngine) +Icon=/opt/apps/uengine-runner/icon.png +MimeType=application/apk; +Name=APK Install(UEngine) +Name[zh_CN]=APK 安装(UEngine) +NoDisplay=true +OnlyShowIn=Unity; +StartupNotify=false +StartupWMClass=APK 安装(UEngine) +Terminal=false +Type=Application diff --git a/build/opt/apps/uengine-runner/uengine-runner b/build/opt/apps/uengine-runner/uengine-runner index 5a05069..9e5dc55 100755 --- a/build/opt/apps/uengine-runner/uengine-runner +++ b/build/opt/apps/uengine-runner/uengine-runner @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi<3025613752@qq.com> -# 版本:1.4.3 -# 更新时间:2021年9月20日(中秋了) +# 版本:1.5.1 +# 更新时间:2021年10月05日(国庆了) # 感谢:anbox、deepin 和 UOS # 基于 Python3 的 tkinter 构建 # 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com> @@ -22,6 +22,8 @@ import threading import ttkthemes import webbrowser import subprocess +import PIL.Image as Image +import PIL.ImageTk as ImageTk import tkinter as tk import tkinter.ttk as ttk import tkinter.messagebox as messagebox @@ -39,37 +41,38 @@ def UninstallProgram(package: "apk 包名")->"卸载程序": os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package)) if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)): os.remove("{}/{}.desktop".format(get_desktop_path(), package)) - fineUninstallApkHistory.append(ComboUninstallPath.get()) - ComboUninstallPath['value'] = fineUninstallApkHistory - write_txt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json", str(json.dumps(ListToDictionary(fineUninstallApkHistory)))) # 将历史记录的数组转换为字典并写入 + 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 BtnFindUninstallApkClk(): - path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApk.json"))["path"]) - if path != "" and path != "()": - try: - ComboUninstallPath.set(path) - write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 - except: - pass +#def BtnFindUninstallApkClk(): +# path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApk.json"))["path"]) +# if path != "" and path != "()": +# try: +# ComboUninstallPath.set(path) +# write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 +# except: +# pass # 卸载按钮事件 def ButtonClick8(): - if ComboUninstallPath.get() is "": + if ComboInstallPath.get() is "": messagebox.showerror(title="提示", message="信息没有填写完整,无法继续卸载 APK") return DisabledAndEnbled(True) - if os.path.exists(ComboUninstallPath.get()): - path = GetApkPackageName(ComboUninstallPath.get()) + if os.path.exists(ComboInstallPath.get()): + path = GetApkPackageName(ComboInstallPath.get()) else: - path = ComboUninstallPath.get() - UninstallProgram(path) - messagebox.showinfo(message="操作执行完毕!", title="提示") - DisabledAndEnbled(False) + path = ComboInstallPath.get() + threading.Thread(target=UninstallProgram, args=[path]).start() # 浏览窗口 # temp strs @@ -88,8 +91,8 @@ def FindApk()->"浏览窗口": # 安装按钮事件 def Button3Install(): - if ComboInstallPath.get() is "": - messagebox.showerror(title="提示", message="信息没有填写完整,无法继续安装 APK") + if ComboInstallPath.get() is "" or not os.path.exists(ComboInstallPath.get()): + messagebox.showerror(title="提示", message="信息没有填写完整或错误,无法继续安装 APK") return DisabledAndEnbled(True) threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start() @@ -136,14 +139,16 @@ def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控 userChoose = {True: tk.DISABLED, False: tk.NORMAL} a = userChoose[choose] ComboInstallPath.configure(state=a) - ComboUninstallPath.configure(state=a) + #ComboUninstallPath.configure(state=a) BtnFindApk.configure(state=a) BtnInstall.configure(state=a) BtnShowUengineApp.configure(state=a) - BtnUninstallApkBrowser.configure(state=a) + #BtnUninstallApkBrowser.configure(state=a) BtnUninstall.configure(state=a) Btngeticon.configure(state=a) BtnSaveApk.configure(state=a) + BtnApkInformation.configure(state=a) + LabApkPath.configure(state=a) # 需引入 subprocess # 运行系统命令并获取返回值 @@ -151,33 +156,39 @@ 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("/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") + os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") # 显示“关于这个程序”窗口 -def about_this_program()->"显示“关于这个程序”窗口": - global about - global title - global iconPath - mess = tk.Toplevel() - message = ttk.Frame(mess) - mess.resizable(0, 0) - mess.title("关于 {}".format(title)) - #mess.iconphoto(False, tk.PhotoImage(file=iconPath)) - img = ImageTk.PhotoImage(Image.open(iconPath)) - LabApkPath = ttk.Label(message, image=img) - label2 = ttk.Label(message, text=about) - button1 = ttk.Button(message, text="确定", command=mess.withdraw) - LabApkPath.pack() - label2.pack() - button1.pack(side="bottom") - message.pack() - mess.mainloop() +#def about_this_program()->"显示“关于这个程序”窗口": +# global about +# global title +# global iconPath +# mess = tk.Toplevel() +# message = ttk.Frame(mess) +# mess.resizable(0, 0) +# mess.title("关于 {}".format(title)) +# #mess.iconphoto(False, tk.PhotoImage(file=iconPath)) +# img = ImageTk.PhotoImage(Image.open(iconPath)) +# LabApkPath = ttk.Label(message, image=img) +# label2 = ttk.Label(message, text=about) +# button1 = ttk.Button(message, text="确定", command=mess.withdraw) +# LabApkPath.pack() +# label2.pack() +# button1.pack(side="bottom") +# message.pack() +# mess.mainloop() # 显示“提示”窗口 def helps()->"显示“提示”窗口": @@ -324,7 +335,7 @@ def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", s things = '''[Desktop Entry] Categories=app; Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} GenericName={} Icon={} MimeType= @@ -507,6 +518,14 @@ def SaveInstallUengineApp(): traceback.print_exc() messagebox.showerror(title="错误", message=traceback.format_exc()) +def UengineCheckCpu(): + english = GetCommandReturn("uengine check-features") + #chinese = GetCommandReturn("trans -b \"{}\"".format(english)) # 获取中文翻译 + #for i in chinese.split("\n"): # 删除提示 + # if "Did you mean:" in i: + # chinese = chinese.replace(i, "").replace("\n", "") + messagebox.showinfo(title="提示", message="{}".format(english)) + # 获取用户主目录 def get_home()->"获取用户主目录": return os.path.expanduser('~') @@ -545,7 +564,7 @@ def AdbCPUAndRAWShowInTer(): threading.Thread(target=os.system, args=["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.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start() + 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(): @@ -562,6 +581,16 @@ def AdbStartServer(): os.system("adb start-server") messagebox.showinfo(title="提示", message="完成!") +def ReinstallUengine(): + threading.Thread(target=os.system, args=["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="本功能已经被删除,无法重复删除!") + 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() + # 使用 adb 连接 uengine def UengineConnectAdb(): messagebox.showinfo(title="提示", message=subprocess.getoutput("adb connect 192.168.250.2:5555")) @@ -581,6 +610,9 @@ def UengineDoNotUseAdb(): 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")) @@ -594,6 +626,67 @@ def AdbAndroidInstallAppList(): 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 + +class ApkInformation(): + def ShowWindows(): + global fullInformation + global path + global tab1 + path = ComboInstallPath.get() + + message = tk.Toplevel() + + tab = ttk.Notebook(message) + + tab1 = ttk.Frame(message) + tab2 = ttk.Frame(message) + + 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) + # 获取图标 + SaveApkIcon(path, "/tmp/uengine-runner-android-app-icon.png") + # 读取图标 + 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)).pack() + else: + ttk.Label(tab1, image=ImageTk.PhotoImage(image.resize((256, 256), Image.ANTIALIAS))).pack() + info = '''包名:{} +中文名:{} +Activity:{} +版本:{}'''.format(GetApkPackageName(path), GetApkChineseLabel(path), GetApkActivityName(path), GetApkVersion(path)) + ttk.Label(tab1, text=info).pack() + + class AdbChangeUengineDisplaySize(): def ShowWindows(): global displayX @@ -817,7 +910,7 @@ class AddNewUengineDesktopLink(): # 打开测试 def TestOpen(): - threading.Thread(target=os.system, args=["/usr/bin/uengine-launch.sh --package={} --component={}".format(packageName.get(), activityName.get())]).start() + threading.Thread(target=os.system, args=["/usr/bin/uengine launch --package={} --component={}".format(packageName.get(), activityName.get())]).start() AddNewUengineDesktopLink.SaveHistory() # 浏览文件 @@ -826,7 +919,7 @@ class AddNewUengineDesktopLink(): if path == "" or path == (): return packageName.set(GetApkPackageName(path)) - activityName.set(GetApkActivityName(path)) + activityName.set(str(GetApkActivityName(path))) write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 def UseProgram(): @@ -863,15 +956,20 @@ programUrl = information["Url"][0] 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, time.strftime("%Y")) +系统版本 :{} + +©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y")) tips = "\n".join(information["Tips"]) updateThingsString = "\n".join(information["Update"]) title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version) @@ -1018,7 +1116,6 @@ win = tk.Tk() # 创建窗口 style = ttkthemes.ThemedStyle(win) style.set_theme("breeze") window = ttk.Frame(win) -win.attributes('-alpha', 0.5) win.title(title) win.resizable(0, 0) win.iconphoto(False, tk.PhotoImage(file=iconPath)) @@ -1036,18 +1133,19 @@ win.geometry(""+"+{:.0f}+{:.0f}".format(x, y)) # 创建控件 FrmInstall = ttk.Frame(window) -FrmUninstall = ttk.Frame(window) +#FrmUninstall = ttk.Frame(window) LabApkPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabApkPath"]) -LabUninstallPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabUninstallPath"]) +#LabUninstallPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabUninstallPath"]) ComboInstallPath = ttk.Combobox(window, width=50) -ComboUninstallPath = ttk.Combobox(window, width=50) +#ComboUninstallPath = 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) -BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstallApkBrowser"], command=BtnFindUninstallApkClk) -BtnUninstall = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstall"], command=ButtonClick8) +#BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstallApkBrowser"], command=BtnFindUninstallApkClk) +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") @@ -1090,21 +1188,25 @@ adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Men 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"][0], command=UengineSettingShow) +#uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][0], command=UengineSettingShow) 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_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) 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) # 设置“程序官网”项 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"][0], command=StopUengine) -uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][0], command=UengineRestart) +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) @@ -1141,14 +1243,15 @@ uengineUseAdb.configure(activebackground="dodgerblue") uengineData.configure(activebackground="dodgerblue") # 设置控件 -ComboUninstallPath['value'] = fineUninstallApkHistory +#ComboUninstallPath['value'] = fineUninstallApkHistory ComboInstallPath['value'] = findApkHistory try: if sys.argv[1] == "-i": ComboInstallPath.set(sys.argv[2]) print("Install Path: " + sys.argv[2]) elif sys.argv[1] == "-u": - ComboUninstallPath.set(sys.argv[2]) + #ComboUninstallPath.set(sys.argv[2]) + ComboInstallPath.set(sys.argv[2]) print("Unstall Path: " + sys.argv[2]) else: print("Command Format Error") @@ -1159,25 +1262,26 @@ win.config(menu=menu) # 显示菜单栏 -LabApkPath.grid(row=1, column=0,sticky= tk.W,padx=3) -ComboInstallPath.grid(row=2, column=0,padx=3) +LabApkPath.grid(row=0, column=0,sticky= tk.W,padx=3) +ComboInstallPath.grid(row=1, column=0,padx=3) -FrmInstall.grid(row=2, column=1,padx=3, rowspan=2) +FrmInstall.grid(row=0, column=1,padx=3, rowspan=3) BtnFindApk.grid(row=0, column=0) BtnInstall.grid(row=0, column=1) -LabUninstallPath.grid(row=4, column=0,sticky= tk.W,padx=3) -ComboUninstallPath.grid(row=5, column=0,padx=3) +#LabUninstallPath.grid(row=4, column=0,sticky= tk.W,padx=3) +#ComboUninstallPath.grid(row=5, column=0,padx=3) -FrmUninstall.grid(row=5, column=1,padx=3) -BtnUninstallApkBrowser.grid(row=0, column=0) -BtnUninstall.grid(row=0, column=1) +#FrmUninstall.grid(row=5, column=1,padx=3) +#BtnUninstallApkBrowser.grid(row=0, column=0) +BtnUninstall.grid(row=1, column=0) -BtnShowUengineApp.grid(row=6, column=0,sticky= tk.W,padx=3,pady=2) +BtnShowUengineApp.grid(row=2, column=0,sticky= tk.W,padx=3,pady=2) -Btngeticon.grid(row=1, column=0,sticky= tk.W,padx=3,pady=2) -BtnSaveApk.grid(row=1, column=1,sticky= tk.W,padx=3,pady=2) +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) window.pack() diff --git a/build/opt/apps/uengine-runner/uengine-runner-launch.sh b/build/opt/apps/uengine-runner/uengine-runner-launch.sh new file mode 100755 index 0000000..3e09ebd --- /dev/null +++ b/build/opt/apps/uengine-runner/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/build/opt/apps/uengine-runner/uengine-runner-update-bug b/build/opt/apps/uengine-runner/uengine-runner-update-bug new file mode 100755 index 0000000..9c6b1af --- /dev/null +++ b/build/opt/apps/uengine-runner/uengine-runner-update-bug @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +import os +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 + +# 读取文本文档 +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: + messagebox.showinfo(message=requests.post(parse.unquote(base64.b64decode("aHR0cCUzQS8vZ2ZkZ2R4aS5xaWNwLnZpcC91ZW5naW5lL2J1Zy91cGxvYWQucGhw").decode("utf-8")), data=data).text) + except: + traceback.print_exc() + messagebox.showerror(title="错误", message="服务器疑似出现错误,可以进行以下尝试:①多尝试几次;②使用其他反馈途径\n错误信息:{}".format(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="反馈信息未填写完整!") + return + Update(name=nameThings.get(), stars=starValue.get(), contact=contactThings.get(), things=updateThings.get(1.0, "end"), 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") + +########################### +# 程序信息 +########################### +iconPath = "{}/icon.png".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"] + +########################### +# 窗口创建 +########################### +window = tk.Tk() +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) + +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) + +# 设置窗口 +style = ttkthemes.ThemedStyle(window) +style.set_theme("breeze") +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) +updateButton.grid(row=3, column=5) + +win.pack(expand="yes", fill="both") +window.mainloop() \ No newline at end of file diff --git a/build/opt/apps/uengine-runner/uengine_logo.svg b/build/opt/apps/uengine-runner/uengine_logo.svg new file mode 100644 index 0000000..c77d1fe --- /dev/null +++ b/build/opt/apps/uengine-runner/uengine_logo.svg @@ -0,0 +1,153 @@ + + + APPS_安卓容器_bonund256pt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/usr/bin/uengine-runner-launch.sh b/build/usr/bin/uengine-runner-launch.sh new file mode 120000 index 0000000..4439cb3 --- /dev/null +++ b/build/usr/bin/uengine-runner-launch.sh @@ -0,0 +1 @@ +/opt/apps/uengine-runner/uengine-runner-launch.sh \ No newline at end of file diff --git a/build/usr/bin/uengine-runner-update-bug b/build/usr/bin/uengine-runner-update-bug new file mode 120000 index 0000000..f3d5efa --- /dev/null +++ b/build/usr/bin/uengine-runner-update-bug @@ -0,0 +1 @@ +/opt/apps/uengine-runner/uengine-runner-update-bug \ No newline at end of file diff --git a/build/usr/share/applications/UengineAndroidProgramList.desktop b/build/usr/share/applications/UengineAndroidProgramList.desktop index 8ff03ad..79d71dc 100644 --- a/build/usr/share/applications/UengineAndroidProgramList.desktop +++ b/build/usr/share/applications/UengineAndroidProgramList.desktop @@ -3,7 +3,7 @@ Categories=System; Comment=UEngine App List Comment[zh]=UEngine 程序菜单 Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity +Exec=/usr/bin/uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity Icon=/opt/apps/uengine-runner/icon.png MimeType= Name=UEngine App List diff --git a/build/usr/share/applications/UengineAndroidSetting.desktop b/build/usr/share/applications/UengineAndroidSetting.desktop deleted file mode 100644 index 1ffa7b9..0000000 --- a/build/usr/share/applications/UengineAndroidSetting.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Categories=System; -Comment=UEngine 系统设置 -Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings -Icon=/opt/apps/uengine-runner/icon.png -MimeType= -Name=UEngine System Control Panel -Name[zh]=UEngine 系统设置 -StartupWMClass=UEngine 系统设置 -Terminal=false -Type=Application diff --git a/build/usr/share/applications/spark-uengine-install.desktop b/build/usr/share/applications/spark-uengine-install.desktop index 6107ff1..a854ea8 100644 --- a/build/usr/share/applications/spark-uengine-install.desktop +++ b/build/usr/share/applications/spark-uengine-install.desktop @@ -5,10 +5,10 @@ Categories=System; Terminal=false Exec=/usr/bin/uengine-runner -i %F Icon=/opt/apps/uengine-runner/icon.png -Name=Install APK(UEngine runner) -Comment=Install APK(UEngine runner) -Comment[zh]=安装 APK(UEngine 运行器) -Name[zh]=安装 APK(UEngine 运行器) +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 diff --git a/build/usr/share/applications/spark-uengine-uninstall.desktop b/build/usr/share/applications/spark-uengine-uninstall.desktop deleted file mode 100644 index c5e1c4c..0000000 --- a/build/usr/share/applications/spark-uengine-uninstall.desktop +++ /dev/null @@ -1,15 +0,0 @@ -[Desktop Entry] -Type=Application -Encoding=UTF-8 -Categories=System; -Terminal=false -Exec=/usr/bin/uengine-runner -u %F -Icon=/opt/apps/uengine-runner/icon.png -Name=Uninstall APK(UEngine runner) -Comment=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/build/usr/share/icons/apps/256/uengine.svg b/build/usr/share/icons/apps/256/uengine.svg new file mode 100644 index 0000000..c77d1fe --- /dev/null +++ b/build/usr/share/icons/apps/256/uengine.svg @@ -0,0 +1,153 @@ + + + APPS_安卓容器_bonund256pt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/usr/share/icons/uengine.svg b/build/usr/share/icons/uengine.svg new file mode 100644 index 0000000..c77d1fe --- /dev/null +++ b/build/usr/share/icons/uengine.svg @@ -0,0 +1,153 @@ + + + APPS_安卓容器_bonund256pt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/usr/share/polkit-1/actions/com.deepin.pkexec.apt.policy b/build/usr/share/polkit-1/actions/com.deepin.pkexec.apt.policy new file mode 100644 index 0000000..da7935b --- /dev/null +++ b/build/usr/share/polkit-1/actions/com.deepin.pkexec.apt.policy @@ -0,0 +1,21 @@ + + + + gfdgd xi + https://gitee.com/gfdgd-xi/uengine-runner/ + + Authentication is required to Install or Reinstall Program + 安装或卸载软件需要输入密码 + preferences-system + + no + no + auth_admin_keep + + /usr/bin/apt + true + + + \ No newline at end of file diff --git a/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy b/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy index 7c0ca86..b5ff17a 100644 --- a/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy +++ b/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy @@ -8,7 +8,7 @@ Authentication is required to Setting UEngine Internet Bridge 设置 UEngine 桥接需要输入密码 - kbox + uengine no no diff --git a/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy b/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy index 70d8f15..9f61433 100644 --- a/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy +++ b/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy @@ -8,7 +8,7 @@ Authentication is required to Change UEngine 设置 UEngine 需要输入密码 - kbox + uengine no no diff --git a/com.gitee.uengine.runner.spark.deb b/com.gitee.uengine.runner.spark.deb index 72e4ee2..07ff5f2 100755 Binary files a/com.gitee.uengine.runner.spark.deb and b/com.gitee.uengine.runner.spark.deb differ diff --git a/information.json b/information.json index 9bbd05c..19a922a 100755 --- a/information.json +++ b/information.json @@ -3,7 +3,7 @@ "https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner" ], - "Version": "1.5.0", + "Version": "1.5.1", "System": "Linux(deepin/UOS)", "Tips": [ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis", @@ -26,6 +26,16 @@ "4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V1.5.1:", + "※1、精简用户界面,合并安装和卸载输入框和浏览按钮等", + "※2、修复安装以其的程序图标无法点击进入的问题(deepin 社区版不存在此问题)", + "※3、支持在程序本体反馈问题", + "4、修复了菜单栏的部分显示问题", + "5、支持显示 apk 的部分信息", + "6、支持删除 UEngine 程序运行检查以及重新安装 UEngine 的功能", + "7、自带有跳过家庭版必须有指定包名才能运行程序限制的脚本", + "8、补回依赖包“adb”", + "", "V1.5.0:", "※1、部分窗口支持英语", "2、修复在英语状态下启动器图标名称异常的问题", diff --git a/main.py b/main.py index 5a05069..9e5dc55 100755 --- a/main.py +++ b/main.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi<3025613752@qq.com> -# 版本:1.4.3 -# 更新时间:2021年9月20日(中秋了) +# 版本:1.5.1 +# 更新时间:2021年10月05日(国庆了) # 感谢:anbox、deepin 和 UOS # 基于 Python3 的 tkinter 构建 # 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com> @@ -22,6 +22,8 @@ import threading import ttkthemes import webbrowser import subprocess +import PIL.Image as Image +import PIL.ImageTk as ImageTk import tkinter as tk import tkinter.ttk as ttk import tkinter.messagebox as messagebox @@ -39,37 +41,38 @@ def UninstallProgram(package: "apk 包名")->"卸载程序": os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package)) if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)): os.remove("{}/{}.desktop".format(get_desktop_path(), package)) - fineUninstallApkHistory.append(ComboUninstallPath.get()) - ComboUninstallPath['value'] = fineUninstallApkHistory - write_txt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json", str(json.dumps(ListToDictionary(fineUninstallApkHistory)))) # 将历史记录的数组转换为字典并写入 + 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 BtnFindUninstallApkClk(): - path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApk.json"))["path"]) - if path != "" and path != "()": - try: - ComboUninstallPath.set(path) - write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 - except: - pass +#def BtnFindUninstallApkClk(): +# path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApk.json"))["path"]) +# if path != "" and path != "()": +# try: +# ComboUninstallPath.set(path) +# write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 +# except: +# pass # 卸载按钮事件 def ButtonClick8(): - if ComboUninstallPath.get() is "": + if ComboInstallPath.get() is "": messagebox.showerror(title="提示", message="信息没有填写完整,无法继续卸载 APK") return DisabledAndEnbled(True) - if os.path.exists(ComboUninstallPath.get()): - path = GetApkPackageName(ComboUninstallPath.get()) + if os.path.exists(ComboInstallPath.get()): + path = GetApkPackageName(ComboInstallPath.get()) else: - path = ComboUninstallPath.get() - UninstallProgram(path) - messagebox.showinfo(message="操作执行完毕!", title="提示") - DisabledAndEnbled(False) + path = ComboInstallPath.get() + threading.Thread(target=UninstallProgram, args=[path]).start() # 浏览窗口 # temp strs @@ -88,8 +91,8 @@ def FindApk()->"浏览窗口": # 安装按钮事件 def Button3Install(): - if ComboInstallPath.get() is "": - messagebox.showerror(title="提示", message="信息没有填写完整,无法继续安装 APK") + if ComboInstallPath.get() is "" or not os.path.exists(ComboInstallPath.get()): + messagebox.showerror(title="提示", message="信息没有填写完整或错误,无法继续安装 APK") return DisabledAndEnbled(True) threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start() @@ -136,14 +139,16 @@ def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控 userChoose = {True: tk.DISABLED, False: tk.NORMAL} a = userChoose[choose] ComboInstallPath.configure(state=a) - ComboUninstallPath.configure(state=a) + #ComboUninstallPath.configure(state=a) BtnFindApk.configure(state=a) BtnInstall.configure(state=a) BtnShowUengineApp.configure(state=a) - BtnUninstallApkBrowser.configure(state=a) + #BtnUninstallApkBrowser.configure(state=a) BtnUninstall.configure(state=a) Btngeticon.configure(state=a) BtnSaveApk.configure(state=a) + BtnApkInformation.configure(state=a) + LabApkPath.configure(state=a) # 需引入 subprocess # 运行系统命令并获取返回值 @@ -151,33 +156,39 @@ 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("/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") + os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") # 显示“关于这个程序”窗口 -def about_this_program()->"显示“关于这个程序”窗口": - global about - global title - global iconPath - mess = tk.Toplevel() - message = ttk.Frame(mess) - mess.resizable(0, 0) - mess.title("关于 {}".format(title)) - #mess.iconphoto(False, tk.PhotoImage(file=iconPath)) - img = ImageTk.PhotoImage(Image.open(iconPath)) - LabApkPath = ttk.Label(message, image=img) - label2 = ttk.Label(message, text=about) - button1 = ttk.Button(message, text="确定", command=mess.withdraw) - LabApkPath.pack() - label2.pack() - button1.pack(side="bottom") - message.pack() - mess.mainloop() +#def about_this_program()->"显示“关于这个程序”窗口": +# global about +# global title +# global iconPath +# mess = tk.Toplevel() +# message = ttk.Frame(mess) +# mess.resizable(0, 0) +# mess.title("关于 {}".format(title)) +# #mess.iconphoto(False, tk.PhotoImage(file=iconPath)) +# img = ImageTk.PhotoImage(Image.open(iconPath)) +# LabApkPath = ttk.Label(message, image=img) +# label2 = ttk.Label(message, text=about) +# button1 = ttk.Button(message, text="确定", command=mess.withdraw) +# LabApkPath.pack() +# label2.pack() +# button1.pack(side="bottom") +# message.pack() +# mess.mainloop() # 显示“提示”窗口 def helps()->"显示“提示”窗口": @@ -324,7 +335,7 @@ def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", s things = '''[Desktop Entry] Categories=app; Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} GenericName={} Icon={} MimeType= @@ -507,6 +518,14 @@ def SaveInstallUengineApp(): traceback.print_exc() messagebox.showerror(title="错误", message=traceback.format_exc()) +def UengineCheckCpu(): + english = GetCommandReturn("uengine check-features") + #chinese = GetCommandReturn("trans -b \"{}\"".format(english)) # 获取中文翻译 + #for i in chinese.split("\n"): # 删除提示 + # if "Did you mean:" in i: + # chinese = chinese.replace(i, "").replace("\n", "") + messagebox.showinfo(title="提示", message="{}".format(english)) + # 获取用户主目录 def get_home()->"获取用户主目录": return os.path.expanduser('~') @@ -545,7 +564,7 @@ def AdbCPUAndRAWShowInTer(): threading.Thread(target=os.system, args=["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.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start() + 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(): @@ -562,6 +581,16 @@ def AdbStartServer(): os.system("adb start-server") messagebox.showinfo(title="提示", message="完成!") +def ReinstallUengine(): + threading.Thread(target=os.system, args=["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="本功能已经被删除,无法重复删除!") + 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() + # 使用 adb 连接 uengine def UengineConnectAdb(): messagebox.showinfo(title="提示", message=subprocess.getoutput("adb connect 192.168.250.2:5555")) @@ -581,6 +610,9 @@ def UengineDoNotUseAdb(): 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")) @@ -594,6 +626,67 @@ def AdbAndroidInstallAppList(): 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 + +class ApkInformation(): + def ShowWindows(): + global fullInformation + global path + global tab1 + path = ComboInstallPath.get() + + message = tk.Toplevel() + + tab = ttk.Notebook(message) + + tab1 = ttk.Frame(message) + tab2 = ttk.Frame(message) + + 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) + # 获取图标 + SaveApkIcon(path, "/tmp/uengine-runner-android-app-icon.png") + # 读取图标 + 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)).pack() + else: + ttk.Label(tab1, image=ImageTk.PhotoImage(image.resize((256, 256), Image.ANTIALIAS))).pack() + info = '''包名:{} +中文名:{} +Activity:{} +版本:{}'''.format(GetApkPackageName(path), GetApkChineseLabel(path), GetApkActivityName(path), GetApkVersion(path)) + ttk.Label(tab1, text=info).pack() + + class AdbChangeUengineDisplaySize(): def ShowWindows(): global displayX @@ -817,7 +910,7 @@ class AddNewUengineDesktopLink(): # 打开测试 def TestOpen(): - threading.Thread(target=os.system, args=["/usr/bin/uengine-launch.sh --package={} --component={}".format(packageName.get(), activityName.get())]).start() + threading.Thread(target=os.system, args=["/usr/bin/uengine launch --package={} --component={}".format(packageName.get(), activityName.get())]).start() AddNewUengineDesktopLink.SaveHistory() # 浏览文件 @@ -826,7 +919,7 @@ class AddNewUengineDesktopLink(): if path == "" or path == (): return packageName.set(GetApkPackageName(path)) - activityName.set(GetApkActivityName(path)) + activityName.set(str(GetApkActivityName(path))) write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 def UseProgram(): @@ -863,15 +956,20 @@ programUrl = information["Url"][0] 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, time.strftime("%Y")) +系统版本 :{} + +©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y")) tips = "\n".join(information["Tips"]) updateThingsString = "\n".join(information["Update"]) title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version) @@ -1018,7 +1116,6 @@ win = tk.Tk() # 创建窗口 style = ttkthemes.ThemedStyle(win) style.set_theme("breeze") window = ttk.Frame(win) -win.attributes('-alpha', 0.5) win.title(title) win.resizable(0, 0) win.iconphoto(False, tk.PhotoImage(file=iconPath)) @@ -1036,18 +1133,19 @@ win.geometry(""+"+{:.0f}+{:.0f}".format(x, y)) # 创建控件 FrmInstall = ttk.Frame(window) -FrmUninstall = ttk.Frame(window) +#FrmUninstall = ttk.Frame(window) LabApkPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabApkPath"]) -LabUninstallPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabUninstallPath"]) +#LabUninstallPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabUninstallPath"]) ComboInstallPath = ttk.Combobox(window, width=50) -ComboUninstallPath = ttk.Combobox(window, width=50) +#ComboUninstallPath = 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) -BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstallApkBrowser"], command=BtnFindUninstallApkClk) -BtnUninstall = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstall"], command=ButtonClick8) +#BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstallApkBrowser"], command=BtnFindUninstallApkClk) +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") @@ -1090,21 +1188,25 @@ adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Men 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"][0], command=UengineSettingShow) +#uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][0], command=UengineSettingShow) 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_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) 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) # 设置“程序官网”项 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"][0], command=StopUengine) -uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][0], command=UengineRestart) +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) @@ -1141,14 +1243,15 @@ uengineUseAdb.configure(activebackground="dodgerblue") uengineData.configure(activebackground="dodgerblue") # 设置控件 -ComboUninstallPath['value'] = fineUninstallApkHistory +#ComboUninstallPath['value'] = fineUninstallApkHistory ComboInstallPath['value'] = findApkHistory try: if sys.argv[1] == "-i": ComboInstallPath.set(sys.argv[2]) print("Install Path: " + sys.argv[2]) elif sys.argv[1] == "-u": - ComboUninstallPath.set(sys.argv[2]) + #ComboUninstallPath.set(sys.argv[2]) + ComboInstallPath.set(sys.argv[2]) print("Unstall Path: " + sys.argv[2]) else: print("Command Format Error") @@ -1159,25 +1262,26 @@ win.config(menu=menu) # 显示菜单栏 -LabApkPath.grid(row=1, column=0,sticky= tk.W,padx=3) -ComboInstallPath.grid(row=2, column=0,padx=3) +LabApkPath.grid(row=0, column=0,sticky= tk.W,padx=3) +ComboInstallPath.grid(row=1, column=0,padx=3) -FrmInstall.grid(row=2, column=1,padx=3, rowspan=2) +FrmInstall.grid(row=0, column=1,padx=3, rowspan=3) BtnFindApk.grid(row=0, column=0) BtnInstall.grid(row=0, column=1) -LabUninstallPath.grid(row=4, column=0,sticky= tk.W,padx=3) -ComboUninstallPath.grid(row=5, column=0,padx=3) +#LabUninstallPath.grid(row=4, column=0,sticky= tk.W,padx=3) +#ComboUninstallPath.grid(row=5, column=0,padx=3) -FrmUninstall.grid(row=5, column=1,padx=3) -BtnUninstallApkBrowser.grid(row=0, column=0) -BtnUninstall.grid(row=0, column=1) +#FrmUninstall.grid(row=5, column=1,padx=3) +#BtnUninstallApkBrowser.grid(row=0, column=0) +BtnUninstall.grid(row=1, column=0) -BtnShowUengineApp.grid(row=6, column=0,sticky= tk.W,padx=3,pady=2) +BtnShowUengineApp.grid(row=2, column=0,sticky= tk.W,padx=3,pady=2) -Btngeticon.grid(row=1, column=0,sticky= tk.W,padx=3,pady=2) -BtnSaveApk.grid(row=1, column=1,sticky= tk.W,padx=3,pady=2) +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) window.pack() diff --git a/new-deb-build/DEBIAN/control b/new-deb-build/DEBIAN/control index 30080e8..f1e51f8 100644 --- a/new-deb-build/DEBIAN/control +++ b/new-deb-build/DEBIAN/control @@ -1,9 +1,9 @@ Package: com.gitee.uengine.runner.spark Source: com.gitee.uengine.runner.spark -Version: 1.5.0 +Version: 1.5.1 Architecture: all Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com> -Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, adb, python3-pil, python3-setuptools, uengine, deepin-terminal +Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, uengine, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell Section: utils Priority: optional Conflicts: spark-uengine-runner, spark-uengine-apk-builder diff --git a/new-deb-build/DEBIAN/postinst b/new-deb-build/DEBIAN/postinst index 68421f3..73c67df 100755 --- a/new-deb-build/DEBIAN/postinst +++ b/new-deb-build/DEBIAN/postinst @@ -1,15 +1,21 @@ #!/bin/sh # 使用 pip 安装所需库 -python3 -m pip install --upgrade ttkthemes -python3 -m pip install --upgrade requests -python3 -m pip install --upgrade pyautogui -python3 -m pip install --upgrade keyboard +python3 -m pip install --upgrade ttkthemes -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade requests -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 # 建立软链接 -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 \ No newline at end of file +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 +# 刷新图标缓存 +#gtk-update-icon-cache /usr/share/icons/bloom +# 向服务器返回安装数加1(不显示内容且忽略错误) +curl http://gfdgdxi.qicp.vip/uengine/Install.php -s > /dev/null | true \ No newline at end of file diff --git a/new-deb-build/DEBIAN/postrm b/new-deb-build/DEBIAN/postrm index b3730ca..eb683d7 100755 --- a/new-deb-build/DEBIAN/postrm +++ b/new-deb-build/DEBIAN/postrm @@ -7,4 +7,8 @@ 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 \ No newline at end of file +rm -fv /usr/bin/uengine-useadb +rm -fv /usr/bin/uengine-runner-launch.sh +rm -fv /usr/bin/uengine-runner-update-bug +# 刷新图标缓存 +gtk-update-icon-cache /usr/share/icons/bloom \ No newline at end of file diff --git a/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/entries/applications/UengineAndroidProgramList.desktop index 7d2fc05..a19b595 100644 --- a/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/entries/applications/UengineAndroidProgramList.desktop @@ -2,7 +2,7 @@ Categories=System; Comment=UEngine 程序菜单 Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity +Exec=/usr/bin/uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png MimeType= Name=UEngine App List diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidSetting.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidSetting.desktop deleted file mode 100644 index 17c8c12..0000000 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidSetting.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Categories=System; -Comment=UEngine System Control Panel -Comment[zh]=UEngine 系统设置 -Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings -Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png -MimeType= -Name=UEngine System Control Panel -Name[zh]=UEngine 系统设置 -StartupWMClass=UEngine 系统设置 -Terminal=false -Type=Application diff --git a/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/entries/applications/spark-uengine-install.desktop index 69a0c51..90f8f1f 100644 --- a/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/entries/applications/spark-uengine-install.desktop @@ -5,10 +5,10 @@ Categories=System; Terminal=false Exec=/usr/bin/uengine-runner -i %F Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png -Name=Install APK(uengine runner) -Comment=Install APK(UEngine runner) -Comment[zh]=安装 APK(UEngine 运行器) -Name[zh]=安装 APK(UEngine 运行器) +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 diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-uninstall.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-uninstall.desktop deleted file mode 100644 index 258c81e..0000000 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-uninstall.desktop +++ /dev/null @@ -1,15 +0,0 @@ -[Desktop Entry] -Type=Application -Encoding=UTF-8 -Categories=System; -Terminal=false -Exec=/usr/bin/uengine-runner -u %F -Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png -Name=Uninstall APK(UEngine runner) -Comment=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/Language.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json index 8fa00f2..60aa763 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 @@ -3,7 +3,7 @@ "Main": { "MainWindow": { "Title": "UEngine 运行器", - "LabApkPath": "安装 APK:", + "LabApkPath": "安装/卸载 APK:", "LabUninstallPath": "卸载 Apk:", "BtnFindApk": "浏览", "BtnInstall": "安装", @@ -12,6 +12,7 @@ "BtnUninstall": "卸载", "Btngeticon": "保存图标", "BtnSaveApk": "保存Apk", + "BtnApkInformation": "Apk 信息", "Menu": [ { "Name": "程序", @@ -92,14 +93,18 @@ "清空 UEngine 数据(需要 Root)" ] }, - "UEngine 键盘映射" + "UEngine 键盘映射", + "UEngine 检测 CPU 是否支持运行", + "删除 UEngine 运行检查", + "重新安装 UEngine" ] }, { "Name": "关于", "Menu": [ "程序官网", - "关于" + "关于", + "反馈程序问题和建议" ] } ] @@ -125,8 +130,7 @@ "Main": { "MainWindow": { "Title": "UEngine Runner", - "LabApkPath": "Install Apk:", - "LabUninstallPath": "Uninstall Apk", + "LabApkPath": "Install Or Uninstall Apk:", "BtnFindApk": "Find", "BtnInstall": "Install", "BtnShowUengineApp": "Open UEngine App List", @@ -134,6 +138,7 @@ "BtnUninstall": "Uninstall", "Btngeticon": "Save Apk Icon", "BtnSaveApk": "Saving Installed App Apk", + "BtnApkInformation": "Apk Information", "Menu": [ { "Name": "Program", @@ -214,14 +219,18 @@ "Delete All UEngine Data (It Need Run With Root)" ] }, - "UEngine Keyboard" + "UEngine Keyboard", + "UEngine Check CPU Can Or Can't Run", + "Delete UEngine Runing Checking", + "Reinstall UEngine" ] }, { "Name": "About", "Menu": [ "Program WebSize", - "Program Help" + "Program Help", + "Upload Problem And Advice" ] } ] diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UengineAndroidProgramList.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UengineAndroidProgramList.desktop index c130e1d..110309e 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UengineAndroidProgramList.desktop +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UengineAndroidProgramList.desktop @@ -2,8 +2,8 @@ Categories=System; Comment=UEngine 程序菜单 Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity -Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png +Exec=/usr/bin/uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity +Icon=/opt/apps/uengine-runner/icon.png MimeType= Name=UEngine 程序菜单 StartupWMClass=UEngine 程序菜单 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 9bbd05c..19a922a 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 @@ -3,7 +3,7 @@ "https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner" ], - "Version": "1.5.0", + "Version": "1.5.1", "System": "Linux(deepin/UOS)", "Tips": [ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis", @@ -26,6 +26,16 @@ "4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V1.5.1:", + "※1、精简用户界面,合并安装和卸载输入框和浏览按钮等", + "※2、修复安装以其的程序图标无法点击进入的问题(deepin 社区版不存在此问题)", + "※3、支持在程序本体反馈问题", + "4、修复了菜单栏的部分显示问题", + "5、支持显示 apk 的部分信息", + "6、支持删除 UEngine 程序运行检查以及重新安装 UEngine 的功能", + "7、自带有跳过家庭版必须有指定包名才能运行程序限制的脚本", + "8、补回依赖包“adb”", + "", "V1.5.0:", "※1、部分窗口支持英语", "2、修复在英语状态下启动器图标名称异常的问题", diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting-new.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting-new.json new file mode 100755 index 0000000..5edfd97 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting-new.json @@ -0,0 +1,6 @@ +{ + "Package": "com.gitee.uengine.runner.spark", + "Update": true, + "Version": "1.5.1", + "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" +} \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json index cc22f18..d4f0364 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json @@ -1,6 +1,7 @@ { - "Package": "com.gitee.uengine.runner.spark", + "Package": "spark-uengine-runner", "Update": true, - "Version": "1.5.0", + "Version": "1.5.1", "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" + } \ No newline at end of file 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 d78a287..fbbf991 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 @@ -148,7 +148,7 @@ done exit 0'''.format(apkPackageName) desktopFile = '''[Desktop Entry] Categories=Other; -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} Icon=/usr/share/uengine/icons/{}.png Terminal=false Type=Application @@ -294,7 +294,7 @@ def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath) [Desktop Entry] Categories=app; Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=/usr/bin/uengine launch.sh --action=android.intent.action.MAIN --package={} --component={} GenericName={} Icon={} MimeType= @@ -313,16 +313,16 @@ def GetApkChineseLabel(apkFilePath): line = line.replace("'", "") return line -def GetApkIconInApk(apkFilePath): - info = GetApkInformation(apkFilePath) - for line in info.split('\n'): - if "application:" in line: - line = line[line.index("icon='"): -1] - line = line.replace("icon='", "") - if "'" in line: - line = line[0: line.index("'")] - return line - return line +#def GetApkIconInApk(apkFilePath): +# info = GetApkInformation(apkFilePath) +# for line in info.split('\n'): +# if "application:" in line: +# line = line[line.index("icon='"): -1] +# line = line.replace("icon='", "") +# if "'" in line: +# line = line[0: line.index("'")] +# return line +# return line #合并两个函数到一起 def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-install (1).desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-install (1).desktop new file mode 100755 index 0000000..e386dfa --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-install (1).desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Categories=system;Utility; +Encoding=UTF-8 +Exec=uengine-runner -ci %F +GenericName=APK Install(UEngine) +GenericName[zh_CN]=APK 安装(UEngine) +Icon=/opt/apps/uengine-runner/icon.png +MimeType=application/apk; +Name=APK Install(UEngine) +Name[zh_CN]=APK 安装(UEngine) +NoDisplay=true +OnlyShowIn=Unity; +StartupNotify=false +StartupWMClass=APK 安装(UEngine) +Terminal=false +Type=Application 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 5a05069..9e5dc55 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,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi<3025613752@qq.com> -# 版本:1.4.3 -# 更新时间:2021年9月20日(中秋了) +# 版本:1.5.1 +# 更新时间:2021年10月05日(国庆了) # 感谢:anbox、deepin 和 UOS # 基于 Python3 的 tkinter 构建 # 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com> @@ -22,6 +22,8 @@ import threading import ttkthemes import webbrowser import subprocess +import PIL.Image as Image +import PIL.ImageTk as ImageTk import tkinter as tk import tkinter.ttk as ttk import tkinter.messagebox as messagebox @@ -39,37 +41,38 @@ def UninstallProgram(package: "apk 包名")->"卸载程序": os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package)) if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)): os.remove("{}/{}.desktop".format(get_desktop_path(), package)) - fineUninstallApkHistory.append(ComboUninstallPath.get()) - ComboUninstallPath['value'] = fineUninstallApkHistory - write_txt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json", str(json.dumps(ListToDictionary(fineUninstallApkHistory)))) # 将历史记录的数组转换为字典并写入 + 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 BtnFindUninstallApkClk(): - path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApk.json"))["path"]) - if path != "" and path != "()": - try: - ComboUninstallPath.set(path) - write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 - except: - pass +#def BtnFindUninstallApkClk(): +# path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApk.json"))["path"]) +# if path != "" and path != "()": +# try: +# ComboUninstallPath.set(path) +# write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 +# except: +# pass # 卸载按钮事件 def ButtonClick8(): - if ComboUninstallPath.get() is "": + if ComboInstallPath.get() is "": messagebox.showerror(title="提示", message="信息没有填写完整,无法继续卸载 APK") return DisabledAndEnbled(True) - if os.path.exists(ComboUninstallPath.get()): - path = GetApkPackageName(ComboUninstallPath.get()) + if os.path.exists(ComboInstallPath.get()): + path = GetApkPackageName(ComboInstallPath.get()) else: - path = ComboUninstallPath.get() - UninstallProgram(path) - messagebox.showinfo(message="操作执行完毕!", title="提示") - DisabledAndEnbled(False) + path = ComboInstallPath.get() + threading.Thread(target=UninstallProgram, args=[path]).start() # 浏览窗口 # temp strs @@ -88,8 +91,8 @@ def FindApk()->"浏览窗口": # 安装按钮事件 def Button3Install(): - if ComboInstallPath.get() is "": - messagebox.showerror(title="提示", message="信息没有填写完整,无法继续安装 APK") + if ComboInstallPath.get() is "" or not os.path.exists(ComboInstallPath.get()): + messagebox.showerror(title="提示", message="信息没有填写完整或错误,无法继续安装 APK") return DisabledAndEnbled(True) threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start() @@ -136,14 +139,16 @@ def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控 userChoose = {True: tk.DISABLED, False: tk.NORMAL} a = userChoose[choose] ComboInstallPath.configure(state=a) - ComboUninstallPath.configure(state=a) + #ComboUninstallPath.configure(state=a) BtnFindApk.configure(state=a) BtnInstall.configure(state=a) BtnShowUengineApp.configure(state=a) - BtnUninstallApkBrowser.configure(state=a) + #BtnUninstallApkBrowser.configure(state=a) BtnUninstall.configure(state=a) Btngeticon.configure(state=a) BtnSaveApk.configure(state=a) + BtnApkInformation.configure(state=a) + LabApkPath.configure(state=a) # 需引入 subprocess # 运行系统命令并获取返回值 @@ -151,33 +156,39 @@ 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("/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") + os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity") # 显示“关于这个程序”窗口 -def about_this_program()->"显示“关于这个程序”窗口": - global about - global title - global iconPath - mess = tk.Toplevel() - message = ttk.Frame(mess) - mess.resizable(0, 0) - mess.title("关于 {}".format(title)) - #mess.iconphoto(False, tk.PhotoImage(file=iconPath)) - img = ImageTk.PhotoImage(Image.open(iconPath)) - LabApkPath = ttk.Label(message, image=img) - label2 = ttk.Label(message, text=about) - button1 = ttk.Button(message, text="确定", command=mess.withdraw) - LabApkPath.pack() - label2.pack() - button1.pack(side="bottom") - message.pack() - mess.mainloop() +#def about_this_program()->"显示“关于这个程序”窗口": +# global about +# global title +# global iconPath +# mess = tk.Toplevel() +# message = ttk.Frame(mess) +# mess.resizable(0, 0) +# mess.title("关于 {}".format(title)) +# #mess.iconphoto(False, tk.PhotoImage(file=iconPath)) +# img = ImageTk.PhotoImage(Image.open(iconPath)) +# LabApkPath = ttk.Label(message, image=img) +# label2 = ttk.Label(message, text=about) +# button1 = ttk.Button(message, text="确定", command=mess.withdraw) +# LabApkPath.pack() +# label2.pack() +# button1.pack(side="bottom") +# message.pack() +# mess.mainloop() # 显示“提示”窗口 def helps()->"显示“提示”窗口": @@ -324,7 +335,7 @@ def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", s things = '''[Desktop Entry] Categories=app; Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} GenericName={} Icon={} MimeType= @@ -507,6 +518,14 @@ def SaveInstallUengineApp(): traceback.print_exc() messagebox.showerror(title="错误", message=traceback.format_exc()) +def UengineCheckCpu(): + english = GetCommandReturn("uengine check-features") + #chinese = GetCommandReturn("trans -b \"{}\"".format(english)) # 获取中文翻译 + #for i in chinese.split("\n"): # 删除提示 + # if "Did you mean:" in i: + # chinese = chinese.replace(i, "").replace("\n", "") + messagebox.showinfo(title="提示", message="{}".format(english)) + # 获取用户主目录 def get_home()->"获取用户主目录": return os.path.expanduser('~') @@ -545,7 +564,7 @@ def AdbCPUAndRAWShowInTer(): threading.Thread(target=os.system, args=["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.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start() + 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(): @@ -562,6 +581,16 @@ def AdbStartServer(): os.system("adb start-server") messagebox.showinfo(title="提示", message="完成!") +def ReinstallUengine(): + threading.Thread(target=os.system, args=["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="本功能已经被删除,无法重复删除!") + 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() + # 使用 adb 连接 uengine def UengineConnectAdb(): messagebox.showinfo(title="提示", message=subprocess.getoutput("adb connect 192.168.250.2:5555")) @@ -581,6 +610,9 @@ def UengineDoNotUseAdb(): 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")) @@ -594,6 +626,67 @@ def AdbAndroidInstallAppList(): 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 + +class ApkInformation(): + def ShowWindows(): + global fullInformation + global path + global tab1 + path = ComboInstallPath.get() + + message = tk.Toplevel() + + tab = ttk.Notebook(message) + + tab1 = ttk.Frame(message) + tab2 = ttk.Frame(message) + + 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) + # 获取图标 + SaveApkIcon(path, "/tmp/uengine-runner-android-app-icon.png") + # 读取图标 + 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)).pack() + else: + ttk.Label(tab1, image=ImageTk.PhotoImage(image.resize((256, 256), Image.ANTIALIAS))).pack() + info = '''包名:{} +中文名:{} +Activity:{} +版本:{}'''.format(GetApkPackageName(path), GetApkChineseLabel(path), GetApkActivityName(path), GetApkVersion(path)) + ttk.Label(tab1, text=info).pack() + + class AdbChangeUengineDisplaySize(): def ShowWindows(): global displayX @@ -817,7 +910,7 @@ class AddNewUengineDesktopLink(): # 打开测试 def TestOpen(): - threading.Thread(target=os.system, args=["/usr/bin/uengine-launch.sh --package={} --component={}".format(packageName.get(), activityName.get())]).start() + threading.Thread(target=os.system, args=["/usr/bin/uengine launch --package={} --component={}".format(packageName.get(), activityName.get())]).start() AddNewUengineDesktopLink.SaveHistory() # 浏览文件 @@ -826,7 +919,7 @@ class AddNewUengineDesktopLink(): if path == "" or path == (): return packageName.set(GetApkPackageName(path)) - activityName.set(GetApkActivityName(path)) + activityName.set(str(GetApkActivityName(path))) write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 def UseProgram(): @@ -863,15 +956,20 @@ programUrl = information["Url"][0] 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, time.strftime("%Y")) +系统版本 :{} + +©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y")) tips = "\n".join(information["Tips"]) updateThingsString = "\n".join(information["Update"]) title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version) @@ -1018,7 +1116,6 @@ win = tk.Tk() # 创建窗口 style = ttkthemes.ThemedStyle(win) style.set_theme("breeze") window = ttk.Frame(win) -win.attributes('-alpha', 0.5) win.title(title) win.resizable(0, 0) win.iconphoto(False, tk.PhotoImage(file=iconPath)) @@ -1036,18 +1133,19 @@ win.geometry(""+"+{:.0f}+{:.0f}".format(x, y)) # 创建控件 FrmInstall = ttk.Frame(window) -FrmUninstall = ttk.Frame(window) +#FrmUninstall = ttk.Frame(window) LabApkPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabApkPath"]) -LabUninstallPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabUninstallPath"]) +#LabUninstallPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabUninstallPath"]) ComboInstallPath = ttk.Combobox(window, width=50) -ComboUninstallPath = ttk.Combobox(window, width=50) +#ComboUninstallPath = 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) -BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstallApkBrowser"], command=BtnFindUninstallApkClk) -BtnUninstall = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstall"], command=ButtonClick8) +#BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstallApkBrowser"], command=BtnFindUninstallApkClk) +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") @@ -1090,21 +1188,25 @@ adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Men 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"][0], command=UengineSettingShow) +#uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][0], command=UengineSettingShow) 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_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) 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) # 设置“程序官网”项 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"][0], command=StopUengine) -uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][0], command=UengineRestart) +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) @@ -1141,14 +1243,15 @@ uengineUseAdb.configure(activebackground="dodgerblue") uengineData.configure(activebackground="dodgerblue") # 设置控件 -ComboUninstallPath['value'] = fineUninstallApkHistory +#ComboUninstallPath['value'] = fineUninstallApkHistory ComboInstallPath['value'] = findApkHistory try: if sys.argv[1] == "-i": ComboInstallPath.set(sys.argv[2]) print("Install Path: " + sys.argv[2]) elif sys.argv[1] == "-u": - ComboUninstallPath.set(sys.argv[2]) + #ComboUninstallPath.set(sys.argv[2]) + ComboInstallPath.set(sys.argv[2]) print("Unstall Path: " + sys.argv[2]) else: print("Command Format Error") @@ -1159,25 +1262,26 @@ win.config(menu=menu) # 显示菜单栏 -LabApkPath.grid(row=1, column=0,sticky= tk.W,padx=3) -ComboInstallPath.grid(row=2, column=0,padx=3) +LabApkPath.grid(row=0, column=0,sticky= tk.W,padx=3) +ComboInstallPath.grid(row=1, column=0,padx=3) -FrmInstall.grid(row=2, column=1,padx=3, rowspan=2) +FrmInstall.grid(row=0, column=1,padx=3, rowspan=3) BtnFindApk.grid(row=0, column=0) BtnInstall.grid(row=0, column=1) -LabUninstallPath.grid(row=4, column=0,sticky= tk.W,padx=3) -ComboUninstallPath.grid(row=5, column=0,padx=3) +#LabUninstallPath.grid(row=4, column=0,sticky= tk.W,padx=3) +#ComboUninstallPath.grid(row=5, column=0,padx=3) -FrmUninstall.grid(row=5, column=1,padx=3) -BtnUninstallApkBrowser.grid(row=0, column=0) -BtnUninstall.grid(row=0, column=1) +#FrmUninstall.grid(row=5, column=1,padx=3) +#BtnUninstallApkBrowser.grid(row=0, column=0) +BtnUninstall.grid(row=1, column=0) -BtnShowUengineApp.grid(row=6, column=0,sticky= tk.W,padx=3,pady=2) +BtnShowUengineApp.grid(row=2, column=0,sticky= tk.W,padx=3,pady=2) -Btngeticon.grid(row=1, column=0,sticky= tk.W,padx=3,pady=2) -BtnSaveApk.grid(row=1, column=1,sticky= tk.W,padx=3,pady=2) +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) window.pack() diff --git a/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/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/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/uengine-runner-update-bug b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug new file mode 100755 index 0000000..9c6b1af --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +import os +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 + +# 读取文本文档 +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: + messagebox.showinfo(message=requests.post(parse.unquote(base64.b64decode("aHR0cCUzQS8vZ2ZkZ2R4aS5xaWNwLnZpcC91ZW5naW5lL2J1Zy91cGxvYWQucGhw").decode("utf-8")), data=data).text) + except: + traceback.print_exc() + messagebox.showerror(title="错误", message="服务器疑似出现错误,可以进行以下尝试:①多尝试几次;②使用其他反馈途径\n错误信息:{}".format(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="反馈信息未填写完整!") + return + Update(name=nameThings.get(), stars=starValue.get(), contact=contactThings.get(), things=updateThings.get(1.0, "end"), 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") + +########################### +# 程序信息 +########################### +iconPath = "{}/icon.png".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"] + +########################### +# 窗口创建 +########################### +window = tk.Tk() +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) + +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) + +# 设置窗口 +style = ttkthemes.ThemedStyle(window) +style.set_theme("breeze") +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) +updateButton.grid(row=3, column=5) + +win.pack(expand="yes", fill="both") +window.mainloop() \ No newline at end of file diff --git a/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/uengine_logo.svg new file mode 100644 index 0000000..c77d1fe --- /dev/null +++ b/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/usr/share/icons/apps/256/uengine.svg b/new-deb-build/usr/share/icons/apps/256/uengine.svg new file mode 100644 index 0000000..c77d1fe --- /dev/null +++ b/new-deb-build/usr/share/icons/apps/256/uengine.svg @@ -0,0 +1,153 @@ + + + APPS_安卓容器_bonund256pt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.apt.policy b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.apt.policy new file mode 100644 index 0000000..da7935b --- /dev/null +++ b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.apt.policy @@ -0,0 +1,21 @@ + + + + gfdgd xi + https://gitee.com/gfdgd-xi/uengine-runner/ + + Authentication is required to Install or Reinstall Program + 安装或卸载软件需要输入密码 + preferences-system + + no + no + auth_admin_keep + + /usr/bin/apt + true + + + \ No newline at end of file diff --git a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy index 7c0ca86..b5ff17a 100644 --- a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy +++ b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy @@ -8,7 +8,7 @@ Authentication is required to Setting UEngine Internet Bridge 设置 UEngine 桥接需要输入密码 - kbox + uengine no no diff --git a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy index 70d8f15..9f61433 100644 --- a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy +++ b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy @@ -8,7 +8,7 @@ Authentication is required to Change UEngine 设置 UEngine 需要输入密码 - kbox + uengine no no diff --git a/pkexec/com.deepin.pkexec.apt.policy b/pkexec/com.deepin.pkexec.apt.policy new file mode 100644 index 0000000..da7935b --- /dev/null +++ b/pkexec/com.deepin.pkexec.apt.policy @@ -0,0 +1,21 @@ + + + + gfdgd xi + https://gitee.com/gfdgd-xi/uengine-runner/ + + Authentication is required to Install or Reinstall Program + 安装或卸载软件需要输入密码 + preferences-system + + no + no + auth_admin_keep + + /usr/bin/apt + true + + + \ No newline at end of file diff --git a/setting-new.json b/setting-new.json index cc22f18..5edfd97 100755 --- a/setting-new.json +++ b/setting-new.json @@ -1,6 +1,6 @@ { "Package": "com.gitee.uengine.runner.spark", "Update": true, - "Version": "1.5.0", + "Version": "1.5.1", "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" } \ No newline at end of file diff --git a/setting.json b/setting.json index be23244..d4f0364 100755 --- a/setting.json +++ b/setting.json @@ -1,7 +1,7 @@ { "Package": "spark-uengine-runner", "Update": true, - "Version": "1.5.0", + "Version": "1.5.1", "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" } \ No newline at end of file diff --git a/spark-uengine-runner.deb b/spark-uengine-runner.deb index 1566d23..865fff0 100755 Binary files a/spark-uengine-runner.deb and b/spark-uengine-runner.deb differ diff --git a/uengine-apk-builder b/uengine-apk-builder index d78a287..fbbf991 100755 --- a/uengine-apk-builder +++ b/uengine-apk-builder @@ -148,7 +148,7 @@ done exit 0'''.format(apkPackageName) desktopFile = '''[Desktop Entry] Categories=Other; -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} Icon=/usr/share/uengine/icons/{}.png Terminal=false Type=Application @@ -294,7 +294,7 @@ def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath) [Desktop Entry] Categories=app; Encoding=UTF-8 -Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={} +Exec=/usr/bin/uengine launch.sh --action=android.intent.action.MAIN --package={} --component={} GenericName={} Icon={} MimeType= @@ -313,16 +313,16 @@ def GetApkChineseLabel(apkFilePath): line = line.replace("'", "") return line -def GetApkIconInApk(apkFilePath): - info = GetApkInformation(apkFilePath) - for line in info.split('\n'): - if "application:" in line: - line = line[line.index("icon='"): -1] - line = line.replace("icon='", "") - if "'" in line: - line = line[0: line.index("'")] - return line - return line +#def GetApkIconInApk(apkFilePath): +# info = GetApkInformation(apkFilePath) +# for line in info.split('\n'): +# if "application:" in line: +# line = line[line.index("icon='"): -1] +# line = line.replace("icon='", "") +# if "'" in line: +# line = line[0: line.index("'")] +# return line +# return line #合并两个函数到一起 def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": diff --git a/uengine-runner-launch.sh b/uengine-runner-launch.sh new file mode 100755 index 0000000..3e09ebd --- /dev/null +++ b/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/uengine-runner-update-bug b/uengine-runner-update-bug new file mode 100755 index 0000000..9c6b1af --- /dev/null +++ b/uengine-runner-update-bug @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +import os +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 + +# 读取文本文档 +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: + messagebox.showinfo(message=requests.post(parse.unquote(base64.b64decode("aHR0cCUzQS8vZ2ZkZ2R4aS5xaWNwLnZpcC91ZW5naW5lL2J1Zy91cGxvYWQucGhw").decode("utf-8")), data=data).text) + except: + traceback.print_exc() + messagebox.showerror(title="错误", message="服务器疑似出现错误,可以进行以下尝试:①多尝试几次;②使用其他反馈途径\n错误信息:{}".format(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="反馈信息未填写完整!") + return + Update(name=nameThings.get(), stars=starValue.get(), contact=contactThings.get(), things=updateThings.get(1.0, "end"), 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") + +########################### +# 程序信息 +########################### +iconPath = "{}/icon.png".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"] + +########################### +# 窗口创建 +########################### +window = tk.Tk() +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) + +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) + +# 设置窗口 +style = ttkthemes.ThemedStyle(window) +style.set_theme("breeze") +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) +updateButton.grid(row=3, column=5) + +win.pack(expand="yes", fill="both") +window.mainloop() \ No newline at end of file diff --git a/uengine_logo.svg b/uengine_logo.svg new file mode 100644 index 0000000..c77d1fe --- /dev/null +++ b/uengine_logo.svg @@ -0,0 +1,153 @@ + + + APPS_安卓容器_bonund256pt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file