diff --git a/.idea/misc.xml b/.idea/misc.xml index a2e120d..60121c6 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/__pycache__/getxmlimg.cpython-37.pyc b/__pycache__/getxmlimg.cpython-37.pyc index aec1ea2..f69713c 100644 Binary files a/__pycache__/getxmlimg.cpython-37.pyc and b/__pycache__/getxmlimg.cpython-37.pyc differ diff --git a/api/__pycache__/__init__.cpython-37.pyc b/api/__pycache__/__init__.cpython-37.pyc index 69ef9b1..3adbef1 100644 Binary files a/api/__pycache__/__init__.cpython-37.pyc and b/api/__pycache__/__init__.cpython-37.pyc differ diff --git a/information.json b/information.json index 430e2e0..977410a 100755 --- a/information.json +++ b/information.json @@ -4,7 +4,7 @@ "https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner" ], - "Version": "1.6.2", + "Version": "1.7.0", "System": "Linux(deepin/UOS)", "Tips": [ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis", @@ -22,6 +22,11 @@ "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "1.7.0", + "※1、新增暗黑主题", + "※2、优化 deepin-terminal 在其它发行版显示奇奇怪怪的问题", + "※3、修复 UEngine 安装脚本在安装时不让用户选择,直接默认 N 无法安装的问题", + "", "V1.6.2:", "※1、优化了 UEngine 运行器的英语翻译", "※2、新增加了可以打开或关闭第三方应用安装的功能(使用此功能后在UEngine里可以使用默认的APK安装程序安装应用,此操作需要使用程序的Adb补丁)", @@ -29,6 +34,7 @@ "※4、双包合一,只保留了UOS打包标准,可以从旧标准无缝升级(推荐使用本程序的升级程序进行升级)", "5、修复了本程序在 Ubuntu 上安装和卸载报错而无法继续的问题", "6、优化帮助/关于窗口在高分辨率电脑上显示不全的问题", + "", "V1.6.1:", "※1、修复了打包 deb 包在 APK 的包名有大写时无法启动的问题", "※2、提供新版本的 UEngine Root 镜像", @@ -37,6 +43,7 @@ "5、把构建 UEngine Root 镜像修改为多线程下载(wget=>aria2)", "6、提供了 UEngine 运行器的 API(可以从项目地址中获取)", "7、补上遗漏的项目参与者“星空露光”,新加项目参与者“为什么您不喜欢熊出没和阿布呢”", + "", "V1.6.0:", "※1、更换了新的图标", "※2、支持程序的评分和查看分数详情的功能(如果炸了我的服务器,这个就作废了)", diff --git a/launch.sh b/launch.sh new file mode 100755 index 0000000..674905e --- /dev/null +++ b/launch.sh @@ -0,0 +1,3 @@ +#!/bin/bash +XDG_CURRENT_DESKTOP="Deepin" +$1 -platformtheme deepin "$@" diff --git a/main.py b/main.py index 1316fe0..3f85ac3 100755 --- a/main.py +++ b/main.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi<3025613752@qq.com> -# 版本:1.6.2 -# 更新时间:2022年6月20日(要期末考试了) +# 版本:1.6.3 +# 更新时间:2022年07月07日(暑假了) # 感谢: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"): @@ -680,7 +679,7 @@ def AllowOrDisallowUpdateAndroidApp(): messagebox.showinfo(title=langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"]) class SettingWindow(): - saveApkOption = tk.IntVar() + saveApkOption = None def ShowWindow(): setting = tk.Toplevel() setting.resizable(0, 0) @@ -761,7 +760,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(): @@ -1251,11 +1250,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 +1330,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 +1355,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 +1371,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) diff --git a/uengine-apk-builder b/uengine-apk-builder index 6a963bd..b553d46 100755 --- a/uengine-apk-builder +++ b/uengine-apk-builder @@ -397,7 +397,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 +435,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/uengine-runner-applist-launch.sh b/uengine-runner-applist-launch.sh index 83d7a99..c2901f1 100755 --- a/uengine-runner-applist-launch.sh +++ b/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/uengine-runner-update-bug b/uengine-runner-update-bug index 84b7de7..e4e742b 100755 --- a/uengine-runner-update-bug +++ b/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))