新增运行库安装功能

This commit is contained in:
gfdgd xi 2023-03-19 14:19:28 +08:00
parent a572839928
commit 0a676993ad
3 changed files with 40 additions and 0 deletions

0
InstallQemuUser.sh Normal file → Executable file
View File

12
RemoveQemuUser.sh Executable file
View File

@ -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

View File

@ -2899,6 +2899,34 @@ log.addAction(saveLogText)
log.addAction(transLogText) log.addAction(transLogText)
log.addAction(uploadLogText) 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)")) qemuMenu = menu.addMenu(transla.transe("U", "容器(&C)"))
unpackDeb = QtWidgets.QAction(QtWidgets.QApplication.style().standardIcon(32), transla.transe("U", "解包 deb 提取容器")) unpackDeb = QtWidgets.QAction(QtWidgets.QApplication.style().standardIcon(32), transla.transe("U", "解包 deb 提取容器"))
qemuMenu.addAction(unpackDeb) qemuMenu.addAction(unpackDeb)