diff --git a/Language.json b/Language.json index e36c1d0..1653bc7 100644 --- a/Language.json +++ b/Language.json @@ -37,7 +37,8 @@ "你确定要启用 UEngine 可以安装以及使用默认的更新程序升级应用?(即允许未知来源)", "你确定要禁用 UEngine 可以安装以及使用默认的更新程序升级应用?(即禁止未知来源)" ], - "UseAdbPackageAnswer": "你没有安装 adb 补丁,必须安装才能继续。是否安装?" + "UseAdbPackageAnswer": "你没有安装 adb 补丁,必须安装才能继续。是否安装?", + "CompleteInformation": "设置完毕" }, "Menu": [ { @@ -133,8 +134,9 @@ ] }, "在 Ubuntu 上安装 UEngine", - "启动/禁用UEngine安装的安卓程序程序更新", - "在 Ubuntu 上安装 UEngine" + "启动/禁用UEngine安装的安卓程序程序更新(需要安装 adb 补丁)", + "在 Ubuntu 上安装 UEngine", + "设置 UEngine 代理(需要安装 adb 补丁)" ] }, { @@ -203,7 +205,8 @@ "Are you sure to allow UEngine to install or update other android program? (Allow )(即允许未知来源)", "Are you sure to disallow UEngine to install or update other android program? (Allow )(即允许未知来源)" ], - "UseAdbPackageAnswer": "You don't install adb package with UEngine, you must install, and after install you can connect to set.\nDo you want to install?" + "UseAdbPackageAnswer": "You don't install adb package with UEngine, you must install, and after install you can connect to set.\nDo you want to install?", + "CompleteInformation": "Set Completed" }, "Menu": [ { @@ -299,8 +302,9 @@ ] }, "Install UEngine On Ubuntu", - "Allow/Disallow UEngine To Install Or Update Other Android Program", - "Install UEngine On Ubuntu" + "Allow/Disallow UEngine To Install Or Update Other Android Program (Need Install Adb Patch)", + "Install UEngine On Ubuntu", + "Set UEngine Http Proxy (Need Install Adb Patch)" ] }, { diff --git a/README.md b/README.md index f5e4303..3581f7e 100755 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ -# UEngine 运行器 1.6.2 +# UEngine 运行器 1.7.0 ### 介绍         新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。 -![image.png](https://storage.deepin.org/thread/202206211816301171_image.png) +![image.png](https://storage.deepin.org/thread/202207081157256904_image.png) + (测试平台:UOS 家庭版 21.1,deepin 20.6,UOS 专业版 1040) ## 安装前必读 @@ -34,6 +35,14 @@ sudo apt upgrade ### 更新内容 +#### V1.7.0(2022年07月08日,暑假开始) +**※1、新增暗黑主题** +**※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题** +**※3、修复 UEngine 安装脚本在安装时不让用户选择,直接默认 N 无法安装的问题** +4、新增设置 UEngine 代理的功能 +5、将执行命令和打包器的返回输出从命令结束后显示输出内容改为实时显示内容 +![image.png](https://storage.deepin.org/thread/202207081157256904_image.png) + #### V1.6.2(2022年06月21日,中考假期+即将期末考试) **※1、优化了 UEngine 运行器的英语翻译** **※2、新增加了可以打开或关闭第三方应用安装的功能(使用此功能后在UEngine里可以使用默认的APK安装程序安装应用,此操作需要使用程序的Adb补丁)** diff --git a/com.gitee.uengine.runner.spark.deb b/com.gitee.uengine.runner.spark.deb index 07cf584..a068aa2 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 977410a..f82eb45 100755 --- a/information.json +++ b/information.json @@ -22,10 +22,12 @@ "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ - "1.7.0", + "V1.7.0:", "※1、新增暗黑主题", "※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题", "※3、修复 UEngine 安装脚本在安装时不让用户选择,直接默认 N 无法安装的问题", + "4、新增设置 UEngine 代理的功能", + "5、将执行命令和打包器的返回输出从命令结束后显示输出内容改为实时显示内容", "", "V1.6.2:", "※1、优化了 UEngine 运行器的英语翻译", diff --git a/main.py b/main.py index 3f85ac3..7086ad6 100755 --- a/main.py +++ b/main.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi<3025613752@qq.com> -# 版本:1.6.3 -# 更新时间:2022年07月07日(暑假了) +# 版本:1.7.0 +# 更新时间:2022年07月08日(暑假了) # 感谢:anbox、deepin 和 UOS # 基于 Python3 的 tkinter 构建 # 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>、为什么您不喜欢熊出没和阿布呢 @@ -678,6 +678,26 @@ def AllowOrDisallowUpdateAndroidApp(): adb.setAndroidInstallOtherAppSetting(not adb.boolAndroidInstallOtherAppSetting()) messagebox.showinfo(title=langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"]) +def SetHttpProxy(): + adb = api.Adb("192.168.250.2:5555") + adb.Service.Close() + adb.connect() + if not messagebox.askokcancel(title="提示", message="此功能需要安装 adb 补丁,请保证已经安装然后按下“OK”"): + return + proxy = easygui.enterbox(title="输入代理", msg="请输入要设置的代理(为空代表不设置代理)") + if proxy == None: + return + if proxy == "": + os.system("adb -s 192.168.250.2:5555 shell settings delete global http_proxy") + os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_host") + os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_port") + messagebox.showinfo(title="提示", message="设置成功!") + else: + os.system(f"adb -s 192.168.250.2:5555 shell settings put global http_proxy \"{proxy}\"") + messagebox.showinfo(title="提示", message="设置成功!") + + + class SettingWindow(): saveApkOption = None def ShowWindow(): @@ -935,6 +955,7 @@ class InstallWindow(): global progressbar global runCommand message = tk.Toplevel() + message.title("执行命令") message.iconphoto(False, tk.PhotoImage(file=iconPath)) messageFrame = ttk.Frame(message) installTipsText = tk.StringVar() @@ -960,8 +981,15 @@ class InstallWindow(): global installTipsText InstallWindow.AddText("$>" + command + "\n") progressbar.start() - result = subprocess.getoutput(command) - InstallWindow.AddText(result) + res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 实时读取程序返回 + while res.poll() is None: + try: + texts = res.stdout.readline().decode("utf8") + except: + texts = "" + print(texts, end="") + InstallWindow.AddText(texts) messagebox.showinfo(title="提示", message="操作完毕!") installTipsText.set("操作完毕!") message.title("操作完毕!") @@ -1446,6 +1474,7 @@ adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Men adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2], command=AdbKillAdbProgress) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][13], command=AllowOrDisallowUpdateAndroidApp) +uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][15], command=SetHttpProxy) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][1], command=OpenUengineDebBuilder) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][7], command=KeyboardToMouse) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][8], command=UengineCheckCpu) diff --git a/new-deb-build/DEBIAN/control b/new-deb-build/DEBIAN/control index 0d921da..285de07 100644 --- a/new-deb-build/DEBIAN/control +++ b/new-deb-build/DEBIAN/control @@ -1,19 +1,18 @@ Package: com.gitee.uengine.runner.spark Source: com.gitee.uengine.runner.spark Replaces: spark-uengine-runner, com.gitee.uengine.runner.spark.ubuntu -Version: 1.6.2-1 +Version: 1.7.0 Architecture: all Section: utils Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>, 柚子, 为什么您不喜欢熊出没和阿布呢, 星空露光, shenmo Depends: python3, python3-tk, python3-pip, aapt, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell, python3-xlib, fonts-noto-cjk, python3-numpy, python3-matplotlib, wget, inotify-tools, aria2 Recommends: uengine, deepin-elf-verify (>= 0.0.16.7-1) Priority: optional -Conflicts: spark-uengine-apk-builder -Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner] -Description: UEngine 运行器,1.6.2 更新内容: - ※1、优化了 UEngine 运行器的英语翻译 - ※2、新增加了可以打开或关闭第三方应用安装的功能(使用此功能后在UEngine里可以使用默认的APK安装程序安装应用,此操作需要使用程序的Adb补丁) - ※3、新增加了 UEngine 的 Ubuntu 安装程序 - ※4、双包合一,只保留了UOS打包标准,可以从旧标准无缝升级(推荐使用本程序的升级程序进行升级) - 5、修复了本程序在 Ubuntu 上安装和卸载报错而无法继续的问题 - 6、优化帮助/关于窗口在高分辨率电脑上显示不全的问题 +Conflicts: spark-uengine-apk-builder, com.gitee.uengine.runner.spark.ubuntu +Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner, https://www.gitlink.org.cn/gfdgd_xi/uengine-runner] +Description: UEngine 运行器,1.7.0 更新内容: + ※1、新增暗黑主题 + ※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题 + ※3、修复 UEngine 安装脚本在安装时不让用户选择,直接默认 N 无法安装的问题 + 4、新增设置 UEngine 代理的功能 + 5、将执行命令和打包器的返回输出从命令结束后显示输出内容改为实时显示内容 diff --git a/new-deb-build/DEBIAN/postinst b/new-deb-build/DEBIAN/postinst index 3c8bb7e..7ed57aa 100755 --- a/new-deb-build/DEBIAN/postinst +++ b/new-deb-build/DEBIAN/postinst @@ -1,10 +1,11 @@ #!/bin/sh # 使用 pip 安装所需库 -python3 -m pip install --upgrade pip -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade ttkthemes -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade pyautogui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade keyboard -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -python3 -m pip install --upgrade easygui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade pip -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade ttkthemes -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade pyautogui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade keyboard -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade easygui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +python3 -m pip install --upgrade ttkbootstrap -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com # 建立软链接 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 @@ -22,4 +23,4 @@ ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-laun # 因为 Ubuntu 的问题,省略 gtk-update-icon-cache /usr/share/icons/bloom > /dev/null | true # 向服务器返回安装数加1(不显示内容且忽略错误) -curl http://120.25.153.144/uengine-runner/Install.php?Version=1.6.2 -s > /dev/null | true \ No newline at end of file +curl http://120.25.153.144/uengine-runner/Install.php?Version=1.7.0 -s > /dev/null | true \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Language.json index e36c1d0..1653bc7 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 @@ -37,7 +37,8 @@ "你确定要启用 UEngine 可以安装以及使用默认的更新程序升级应用?(即允许未知来源)", "你确定要禁用 UEngine 可以安装以及使用默认的更新程序升级应用?(即禁止未知来源)" ], - "UseAdbPackageAnswer": "你没有安装 adb 补丁,必须安装才能继续。是否安装?" + "UseAdbPackageAnswer": "你没有安装 adb 补丁,必须安装才能继续。是否安装?", + "CompleteInformation": "设置完毕" }, "Menu": [ { @@ -133,8 +134,9 @@ ] }, "在 Ubuntu 上安装 UEngine", - "启动/禁用UEngine安装的安卓程序程序更新", - "在 Ubuntu 上安装 UEngine" + "启动/禁用UEngine安装的安卓程序程序更新(需要安装 adb 补丁)", + "在 Ubuntu 上安装 UEngine", + "设置 UEngine 代理(需要安装 adb 补丁)" ] }, { @@ -203,7 +205,8 @@ "Are you sure to allow UEngine to install or update other android program? (Allow )(即允许未知来源)", "Are you sure to disallow UEngine to install or update other android program? (Allow )(即允许未知来源)" ], - "UseAdbPackageAnswer": "You don't install adb package with UEngine, you must install, and after install you can connect to set.\nDo you want to install?" + "UseAdbPackageAnswer": "You don't install adb package with UEngine, you must install, and after install you can connect to set.\nDo you want to install?", + "CompleteInformation": "Set Completed" }, "Menu": [ { @@ -299,8 +302,9 @@ ] }, "Install UEngine On Ubuntu", - "Allow/Disallow UEngine To Install Or Update Other Android Program", - "Install UEngine On Ubuntu" + "Allow/Disallow UEngine To Install Or Update Other Android Program (Need Install Adb Patch)", + "Install UEngine On Ubuntu", + "Set UEngine Http Proxy (Need Install Adb Patch)" ] }, { 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 430e2e0..f82eb45 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json @@ -4,7 +4,7 @@ "https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner" ], - "Version": "1.6.2", + "Version": "1.7.0", "System": "Linux(deepin/UOS)", "Tips": [ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis", @@ -22,6 +22,13 @@ "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V1.7.0:", + "※1、新增暗黑主题", + "※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题", + "※3、修复 UEngine 安装脚本在安装时不让用户选择,直接默认 N 无法安装的问题", + "4、新增设置 UEngine 代理的功能", + "5、将执行命令和打包器的返回输出从命令结束后显示输出内容改为实时显示内容", + "", "V1.6.2:", "※1、优化了 UEngine 运行器的英语翻译", "※2、新增加了可以打开或关闭第三方应用安装的功能(使用此功能后在UEngine里可以使用默认的APK安装程序安装应用,此操作需要使用程序的Adb补丁)", @@ -29,6 +36,7 @@ "※4、双包合一,只保留了UOS打包标准,可以从旧标准无缝升级(推荐使用本程序的升级程序进行升级)", "5、修复了本程序在 Ubuntu 上安装和卸载报错而无法继续的问题", "6、优化帮助/关于窗口在高分辨率电脑上显示不全的问题", + "", "V1.6.1:", "※1、修复了打包 deb 包在 APK 的包名有大写时无法启动的问题", "※2、提供新版本的 UEngine Root 镜像", @@ -37,6 +45,7 @@ "5、把构建 UEngine Root 镜像修改为多线程下载(wget=>aria2)", "6、提供了 UEngine 运行器的 API(可以从项目地址中获取)", "7、补上遗漏的项目参与者“星空露光”,新加项目参与者“为什么您不喜欢熊出没和阿布呢”", + "", "V1.6.0:", "※1、更换了新的图标", "※2、支持程序的评分和查看分数详情的功能(如果炸了我的服务器,这个就作废了)", diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/launch.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/launch.sh new file mode 100755 index 0000000..674905e --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/launch.sh @@ -0,0 +1,3 @@ +#!/bin/bash +XDG_CURRENT_DESKTOP="Deepin" +$1 -platformtheme deepin "$@" diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder index 6a963bd..6389a9b 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 @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi -# 版本:1.6.1 -# 更新时间:2022年04月30日(五一了) +# 版本:1.7.0 +# 更新时间:2022年07月08日(暑假了) # 感谢:anbox、deepin 和 统信 # 基于 Python3 的 tkinter 构建 ########################################################################################### @@ -46,8 +46,18 @@ def BuildDeb(): threading.Thread(target=GetBuildApkDebError, args=(combobox1.get(),)).start() def RunCommandShow(command): - TextboxAddText1("$> {}".format(command)) - TextboxAddText1(GetCommandReturn(command)) + TextboxAddText1("$> {}".format(command) + "\n") + res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 实时读取程序返回 + while res.poll() is None: + try: + texts = res.stdout.readline().decode("utf8") + except: + texts = "" + print(texts, end="") + TextboxAddText1(texts) + # 已废弃 + # TextboxAddText1(GetCommandReturn(command)) def GetBuildApkDebError(apkPath): try: @@ -58,6 +68,7 @@ def GetBuildApkDebError(apkPath): DisabledAndEnbled(False) def BuildApkDeb(apkPath): + textbox1.delete("1.0","end") tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024))) RunCommandShow("echo '======================================New===================================='") RunCommandShow("echo '创建目录'") @@ -344,7 +355,7 @@ def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": def TextboxAddText1(message): global textbox1 textbox1.configure(state=tk.NORMAL) - textbox1.insert(tk.END,message + "\n") + textbox1.insert(tk.END,message) textbox1.configure(state=tk.DISABLED) # 获取用户桌面目录 @@ -397,7 +408,20 @@ findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/F ########################### # 窗口创建 ########################### -win = tk.Tk() +# 读取主题 +try: + theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0")) +except: + print("主题读取错误,默认使用浅色主题") + theme = True +if theme: + win = tk.Tk() + themes = ttkthemes.ThemedStyle(win) + themes.set_theme("breeze") +else: + import ttkbootstrap + style = ttkbootstrap.Style(theme="darkly") + win = style.master # 创建窗口 qianZhui = tk.BooleanVar() @@ -422,9 +446,6 @@ textbox1.config(foreground='white', background='black') if len(sys.argv) > 1: combobox1.set(sys.argv[1]) # 设置窗口 -style = ttkthemes.ThemedStyle(win) -style.set_theme("breeze") -#win.attributes('-alpha', 0.5) win.title(title) win.resizable(0, 0) win.iconphoto(False, tk.PhotoImage(file=iconPath)) 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 1316fe0..7086ad6 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.6.2 -# 更新时间:2022年6月20日(要期末考试了) +# 版本:1.7.0 +# 更新时间:2022年07月08日(暑假了) # 感谢:anbox、deepin 和 UOS # 基于 Python3 的 tkinter 构建 # 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>、为什么您不喜欢熊出没和阿布呢 @@ -39,7 +39,6 @@ import tkinter.filedialog as filedialog import tkinter.simpledialog as simpledialog from getxmlimg import getsavexml -win = tk.Tk() # 创建窗口 # 卸载程序 def UninstallProgram(package: "apk 包名")->"卸载程序": @@ -333,19 +332,19 @@ def InstallRootUengineImage(): if not os.path.exists: os.mkdir("/tmp/uengine-runner") write_txt("/tmp/uengine-runner/install.sh", "sudo dpkg -i /tmp/uengine-runner/u*.deb\nsudo apt install -f") - threading.Thread(target=os.system, args=["deepin-terminal -C \"wget -P '/tmp/uengine-runner' 'https://hub.fastgit.xyz/gfdgd-xi/uengine-runner/releases/download/U1.2.15/uengine-android-image_1.2.15_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'\""]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"wget -P '/tmp/uengine-runner' 'https://hub.fastgit.xyz/gfdgd-xi/uengine-runner/releases/download/U1.2.15/uengine-android-image_1.2.15_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'\""]).start() def UengineUbuntuInstall(): - threading.Thread(target=os.system, args=["deepin-terminal -C \"bash '{}'\"".format(programPath + "/uengine-installer")]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath + '/uengine-installer'}'\""]).start() def UbuntuInstallUengine(): - threading.Thread(target=os.system, args=["deepin-terminal -C \"bash '{}'\"".format(programPath + "/uengine-installer")]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath + '/uengine-installer'}'\""]).start() def BuildRootUengineImage(): - threading.Thread(target=os.system, args=["deepin-terminal -C \"bash '{}'\"".format(programPath + "/root-uengine.sh")]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath + '/root-uengine.sh'}'\""]).start() def ReinstallUengineImage(): - threading.Thread(target=os.system, args=["deepin-terminal -e ''pkexec apt reinstall uengine-android-image"]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e ''pkexec apt reinstall uengine-android-image -y"]).start() # 生成 uengine 启动文件到桌面 def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径")->"生成 uengine 启动文件到桌面": @@ -577,12 +576,12 @@ def OpenUengineUserData(): # 终端显示 adb 命令行 def AdbShellShowInTer(): os.system("adb connect 192.168.250.2:5555") - threading.Thread(target=os.system, args=["deepin-terminal -w ~ -e 'adb -s 192.168.250.2:5555 shell'"]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -w ~ -e 'adb -s 192.168.250.2:5555 shell'"]).start() # 终端显示 adb top def AdbCPUAndRAWShowInTer(): os.system("adb connect 192.168.250.2:5555") - threading.Thread(target=os.system, args=["deepin-terminal -w ~ -e 'adb -s 192.168.250.2:5555 shell top'"]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -w ~ -e 'adb -s 192.168.250.2:5555 shell top'"]).start() def UengineSettingShow(): threading.Thread(target=os.system, args=["/usr/bin/uengine launch --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start() @@ -603,7 +602,7 @@ def AdbStartServer(): 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() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt reinstall uengine uengine-android-image uengine-modules-dkms -y && notify-send -i uengine \"安装完毕!\"'"]).start() def DelUengineCheck(): if not os.path.exists("/usr/share/uengine/uengine-check-runnable.sh"): @@ -679,8 +678,28 @@ def AllowOrDisallowUpdateAndroidApp(): adb.setAndroidInstallOtherAppSetting(not adb.boolAndroidInstallOtherAppSetting()) messagebox.showinfo(title=langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"]) +def SetHttpProxy(): + adb = api.Adb("192.168.250.2:5555") + adb.Service.Close() + adb.connect() + if not messagebox.askokcancel(title="提示", message="此功能需要安装 adb 补丁,请保证已经安装然后按下“OK”"): + return + proxy = easygui.enterbox(title="输入代理", msg="请输入要设置的代理(为空代表不设置代理)") + if proxy == None: + return + if proxy == "": + os.system("adb -s 192.168.250.2:5555 shell settings delete global http_proxy") + os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_host") + os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_port") + messagebox.showinfo(title="提示", message="设置成功!") + else: + os.system(f"adb -s 192.168.250.2:5555 shell settings put global http_proxy \"{proxy}\"") + messagebox.showinfo(title="提示", message="设置成功!") + + + class SettingWindow(): - saveApkOption = tk.IntVar() + saveApkOption = None def ShowWindow(): setting = tk.Toplevel() setting.resizable(0, 0) @@ -761,7 +780,7 @@ zenity --info --text=\"更新完毕!\" --ellipsize except: traceback.print_exc() easygui.textbox(title="错误", msg="更新出现错误,无法继续更新!", text=traceback.format_exc()) - os.system("deepin-terminal -e pkexec bash /tmp/uengine-runner/update.sh") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e pkexec bash /tmp/uengine-runner/update.sh") image = None class ApkInformation(): @@ -936,6 +955,7 @@ class InstallWindow(): global progressbar global runCommand message = tk.Toplevel() + message.title("执行命令") message.iconphoto(False, tk.PhotoImage(file=iconPath)) messageFrame = ttk.Frame(message) installTipsText = tk.StringVar() @@ -961,8 +981,15 @@ class InstallWindow(): global installTipsText InstallWindow.AddText("$>" + command + "\n") progressbar.start() - result = subprocess.getoutput(command) - InstallWindow.AddText(result) + res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 实时读取程序返回 + while res.poll() is None: + try: + texts = res.stdout.readline().decode("utf8") + except: + texts = "" + print(texts, end="") + InstallWindow.AddText(texts) messagebox.showinfo(title="提示", message="操作完毕!") installTipsText.set("操作完毕!") message.title("操作完毕!") @@ -1251,11 +1278,7 @@ def showhelp(): y = (screen_height/2) - (winhigh/2) if not helpwindow.winfo_screenheight() > 1080: helpwindow.geometry(f"{winwith}x{winhigh}"+"+{:.0f}+{:.0f}".format(x, y)) - - style = ttkthemes.ThemedStyle(helpwindow) - style.set_theme("breeze") - - + Frmroot=ttk.Frame(helpwindow) FrmMenu = ttk.Frame(Frmroot) @@ -1335,7 +1358,20 @@ def showhelp(): print(windowflag) #helpwindow.mainloop() helpwindow.protocol("WM_DELETE_WINDOW", on_closing) - +# 读取主题 +try: + theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0")) +except: + print("主题读取错误,默认使用浅色主题") + theme = True +if theme: + win = tk.Tk() + themes = ttkthemes.ThemedStyle(win) + themes.set_theme("breeze") +else: + import ttkbootstrap + style = ttkbootstrap.Style(theme="darkly") + win = style.master # 创建窗口 ########################### # 检查 UEngine 是否安装 ########################### @@ -1347,12 +1383,12 @@ if not os.path.exists("/usr/bin/uengine"): # Deepin/UOS 用户 if "deepin" in SystemVersion.lower() or "uos" in SystemVersion.lower(): if messagebox.askyesno(title="提示", message="您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n安装完后重新启动该程序即可"): - os.system("deepin-terminal -C \"pkexec apt install uengine\"") + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"pkexec apt install uengine -y\"") sys.exit(0) # 非 Deepin/UOS 用户 else: if messagebox.askyesno(title="提示", message="您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n这里将会使用 shenmo 提供的脚本进行安装\n安装完后重新启动该程序即可\n提示:无法保证此安装脚本安装的 UEngine 可以使用"): - os.system(f"deepin-terminal -C \"bash '{programPath}/uengine-installer'\"") + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath}/uengine-installer'\"") sys.exit(0) # 重新显示窗口 win.wm_deiconify() @@ -1363,8 +1399,8 @@ if not os.path.exists("/usr/bin/uengine"): # 设置窗口 -style = ttkthemes.ThemedStyle(win) -style.set_theme("breeze") +#style = ttkthemes.ThemedStyle(win) +#style.set_theme("breeze") window = ttk.Frame(win) win.title(title) win.resizable(0, 0) @@ -1438,6 +1474,7 @@ adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Men adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2], command=AdbKillAdbProgress) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][13], command=AllowOrDisallowUpdateAndroidApp) +uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][15], command=SetHttpProxy) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][1], command=OpenUengineDebBuilder) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][7], command=KeyboardToMouse) uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][8], command=UengineCheckCpu) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh index 83d7a99..c2901f1 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh @@ -1,4 +1,6 @@ #!/bin/bash +cd `dirname $0` +dir=`pwd` FILE=/usr/bin/uengine if [ -f "$FILE" ]; then echo "$FILE 存在,正常打开菜单" @@ -13,7 +15,7 @@ else echo "此系统为 Deepin/UOS,使用 apt 安装" zenity --question --text="您还未安装 UEngine,是否现在安装?" --no-wrap if [[ $? = 0 ]]; then - deepin-terminal -C "pkexec apt install uengine" + "$dir/uengine-runner-applist-launch.sh" deepin-terminal -C "pkexec apt install uengine -y" fi else echo "非 Deepin/UOS 系统,使用 shenmo 提供的脚本安装\n暂未保证此安装脚本一定安装成功" diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug index 84b7de7..e4e742b 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug @@ -46,6 +46,10 @@ def OpenGiteeIssues(): def OpenGithubIssues(): webbrowser.open_new_tab("https://github.com/gfdgd-xi/uengine-runner/issues") +# 获取用户主目录 +def get_home()->"获取用户主目录": + return os.path.expanduser('~') + ########################### # 程序信息 ########################### @@ -57,7 +61,20 @@ version = information["Version"] ########################### # 窗口创建 ########################### -window = tk.Tk() +# 读取主题 +try: + theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0")) +except: + print("主题读取错误,默认使用浅色主题") + theme = True +if theme: + window = tk.Tk() + themes = ttkthemes.ThemedStyle(window) + themes.set_theme("breeze") +else: + import ttkbootstrap + style = ttkbootstrap.Style(theme="darkly") + window = style.master # 创建窗口 win = ttk.Frame() starValue = tk.StringVar() @@ -84,8 +101,6 @@ githubButton = ttk.Button(otherUpload, text="Github Issues", command=OpenGithubI 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)) diff --git a/uengine-apk-builder b/uengine-apk-builder index b553d46..6389a9b 100755 --- a/uengine-apk-builder +++ b/uengine-apk-builder @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi -# 版本:1.6.1 -# 更新时间:2022年04月30日(五一了) +# 版本:1.7.0 +# 更新时间:2022年07月08日(暑假了) # 感谢:anbox、deepin 和 统信 # 基于 Python3 的 tkinter 构建 ########################################################################################### @@ -46,8 +46,18 @@ def BuildDeb(): threading.Thread(target=GetBuildApkDebError, args=(combobox1.get(),)).start() def RunCommandShow(command): - TextboxAddText1("$> {}".format(command)) - TextboxAddText1(GetCommandReturn(command)) + TextboxAddText1("$> {}".format(command) + "\n") + res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 实时读取程序返回 + while res.poll() is None: + try: + texts = res.stdout.readline().decode("utf8") + except: + texts = "" + print(texts, end="") + TextboxAddText1(texts) + # 已废弃 + # TextboxAddText1(GetCommandReturn(command)) def GetBuildApkDebError(apkPath): try: @@ -58,6 +68,7 @@ def GetBuildApkDebError(apkPath): DisabledAndEnbled(False) def BuildApkDeb(apkPath): + textbox1.delete("1.0","end") tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024))) RunCommandShow("echo '======================================New===================================='") RunCommandShow("echo '创建目录'") @@ -344,7 +355,7 @@ def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": def TextboxAddText1(message): global textbox1 textbox1.configure(state=tk.NORMAL) - textbox1.insert(tk.END,message + "\n") + textbox1.insert(tk.END,message) textbox1.configure(state=tk.DISABLED) # 获取用户桌面目录