From fc19480aa1769a48c6a0c1786d75f6d7973428cb Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Wed, 18 Jan 2023 15:55:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 1 + Model/__init__.py | 2 +- new-deb-build/DEBIAN/postrm | 3 ++ .../files/Model/__init__.py | 38 +++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100755 new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Model/__init__.py diff --git a/Makefile b/Makefile index 50c601b..839a52e 100755 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ build: cp -rv pkexec/* new-deb-build/usr/share/polkit-1/actions cp -rv AutoShell new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ cp -rv AutoConfig.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ + cp -rv Model new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ cp -rv UI new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ cp -rv ConfigLanguareRunner-help.json new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ cp -rv ConfigLanguareRunner.py new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ diff --git a/Model/__init__.py b/Model/__init__.py index e6f57d3..0724c5b 100755 --- a/Model/__init__.py +++ b/Model/__init__.py @@ -13,7 +13,7 @@ programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string # 优先为深度终端 terminal = "" terminalList = [ - "deepin-terminal1", + "deepin-terminal", "mate-terminal", "gnome-terminal", "xfce4-terminal" diff --git a/new-deb-build/DEBIAN/postrm b/new-deb-build/DEBIAN/postrm index 00679ce..6a7f9d5 100755 --- a/new-deb-build/DEBIAN/postrm +++ b/new-deb-build/DEBIAN/postrm @@ -38,6 +38,9 @@ if [ "$1" = "purge" ]; then if [ -d "/home/$username/.config/uengine-runner/" ]; then rm -rf "/home/$username/.config/uengine-runner/" rm -rf "/home/$username/.local/share/uengine-runner" + rm -rf "/home/$username/.local/share/uengine-runner" + rm -rf "/home/$username/.local/share/AutoConfig.py" + fi done # 清理 root 用户的配置文件 diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Model/__init__.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Model/__init__.py new file mode 100755 index 0000000..e6f57d3 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/Model/__init__.py @@ -0,0 +1,38 @@ +import os +import sys +import PyQt5.QtWidgets as QtWidgets +def OpenTerminal(command): + if terminalEnd[terminal][1]: + os.system(f"\"{terminal}\" \"{terminalEnd[terminal][0]}\" \"{command}\"") + print(f"\"{terminal}\" \"{terminalEnd[terminal][0]}\" \"{command}\"") + return + os.system(f"\"{terminal}\" \"{terminalEnd[terminal][0]}\" {command}") + print(f"\"{terminal}\" \"{terminalEnd[terminal][0]}\" {command}") +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +# 对终端的获取 +# 优先为深度终端 +terminal = "" +terminalList = [ + "deepin-terminal1", + "mate-terminal", + "gnome-terminal", + "xfce4-terminal" +] +terminalEnd = { + f"{programPath}/../launch.sh\" \"deepin-terminal": ["-e", 0], + "mate-terminal": ["-e", 1], + "gnome-terminal": ["--", 0], + "xfce4-terminal": ["-e", 1] +} +for i in terminalList: + if not os.system(f"which {i}"): + if i == "deepin-terminal": + i = f"{programPath}/../launch.sh\" \"deepin-terminal" + terminal = i + break +if terminal == "": + print("无法识别到以下的任意一个终端") + print(" ".join(terminalList)) + app = QtWidgets.QApplication(sys.argv) + QtWidgets.QMessageBox.critical(None, "错误", "无法识别到以下的任意一个终端\n" + " ".join(terminalList)) + exit()