From 0a676993ad3ae00ddc692914b78876c71d399f06 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sun, 19 Mar 2023 14:19:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=90=E8=A1=8C=E5=BA=93?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InstallQemuUser.sh | 0 RemoveQemuUser.sh | 12 ++++++++++++ mainwindow.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) mode change 100644 => 100755 InstallQemuUser.sh create mode 100755 RemoveQemuUser.sh diff --git a/InstallQemuUser.sh b/InstallQemuUser.sh old mode 100644 new mode 100755 diff --git a/RemoveQemuUser.sh b/RemoveQemuUser.sh new file mode 100755 index 0000000..6447ba4 --- /dev/null +++ b/RemoveQemuUser.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# 判断是否有安装 Qemu User +which qemu-i386 > /dev/null +if [[ !$? ]]; then + echo 您已安装过 Qemu User,按回车键后退出 + read + exit 1 +fi +sudo apt update +sudo apt purge qemu-user -y +echo 安装完成,按回车键后退出 +read \ No newline at end of file diff --git a/mainwindow.py b/mainwindow.py index 45112f1..01b1072 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -2899,6 +2899,34 @@ log.addAction(saveLogText) log.addAction(transLogText) log.addAction(uploadLogText) +actionList = [] +def AddLib(install: QtWidgets.QAction, uninstall, menu, info): + actionList.append(install) + actionList.append(uninstall) + install.triggered.connect(lambda: OpenTerminal(f"bash '{programPath}/InstallRuntime/{info}'")) + uninstall.triggered.connect(lambda: OpenTerminal(f"bash '{programPath}/InstallRuntime/remove/{info}'")) + menu.addAction(install) + menu.addAction(uninstall) + +if os.path.exists(f"{programPath}/InstallRuntime"): + installLib = menu.addMenu(transla.transe("U", "运行库")) + installQemuMenu = installLib.addMenu(transla.transe("U", "安装 Qemu User")) + installQemu = QtWidgets.QAction("安装 Qemu User") + removeQemu = QtWidgets.QAction("卸载 Qemu User") + installQemuMenu.addAction(installQemu) + installQemuMenu.addAction(removeQemu) + installQemu.triggered.connect(lambda: OpenTerminal(f"bash '{programPath}/InstallQemuUser.sh'")) + removeQemu.triggered.connect(lambda: OpenTerminal(f"bash '{programPath}/RemoveQemuUser.sh'")) + actionList = [] + nameList = {} + for i in os.listdir(f"{programPath}/InstallRuntime"): + if i[-3:] == ".sh": + print(f"检测到库 {os.path.splitext(i)[0]}") + + AddLib(QtWidgets.QAction(f"安装 {os.path.splitext(i)[0]} 运行库"), QtWidgets.QAction(f"卸载 {os.path.splitext(i)[0]} 运行库"), installLib.addMenu(transla.transe("U", f"运行库 {os.path.splitext(i)[0]}")), i) + + + qemuMenu = menu.addMenu(transla.transe("U", "容器(&C)")) unpackDeb = QtWidgets.QAction(QtWidgets.QApplication.style().standardIcon(32), transla.transe("U", "解包 deb 提取容器")) qemuMenu.addAction(unpackDeb)