From b31c4bf13493d032656bbf3495fe8e20aaa86524 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Tue, 11 Jul 2023 22:05:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WineLib/install.sh | 4 ++-- WineLib/remove.sh | 10 +++++----- mainwindow.py | 14 ++++++++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/WineLib/install.sh b/WineLib/install.sh index 07e37bf..57df1c9 100755 --- a/WineLib/install.sh +++ b/WineLib/install.sh @@ -1,7 +1,7 @@ #!/bin/bash CURRENT_DIR=$(cd $(dirname $0); pwd) cd $CURRENT_DIR -if [[ -f $CURRENT_DIR/usr/lib/ld-linux-x86-64.so.2 ]]; then +if [[ -f $CURRENT_DIR/usr/ ]]; then echo 运行库已安装,按回车键退出 read exit @@ -11,7 +11,7 @@ if [[ $? != 0 ]]; then echo 安装包下载失败!按回车键退出 read fi -sudo chmod 777 -Rv . +chmod 777 -Rv . tar -xvf /tmp/library.tar.xz rm -vf /tmp/library.tar.xz echo 安装完成!按回车键退出 diff --git a/WineLib/remove.sh b/WineLib/remove.sh index 8c12010..7d9e95c 100755 --- a/WineLib/remove.sh +++ b/WineLib/remove.sh @@ -1,14 +1,14 @@ #!/bin/bash CURRENT_DIR=$(cd $(dirname $0); pwd) cd $CURRENT_DIR -if [[ ! -f $CURRENT_DIR/usr/lib/ld-linux-x86-64.so.2 ]]; then +if [[ ! -f $CURRENT_DIR/usr/ ]]; then echo 运行库未安装,按回车键退出 read exit fi -sudo rm -rfv lib -sudo rm -rfv lib64 -sudo rm -rfv usr -sudo chmod 777 -Rv . +rm -rfv lib +rm -rfv lib64 +rm -rfv usr +chmod 777 -Rv . echo 删除完成!按回车键退出 read \ No newline at end of file diff --git a/mainwindow.py b/mainwindow.py index 09f2919..434a840 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -3071,10 +3071,16 @@ if os.path.exists(f"{programPath}/WineLib/usr"): diyRunnerLib.setEnabled(True) statusRunnerLib.setText("当前状态:已安装") libPathList = [] - def AddLib(number, name): + mapLink = [] + def AddRunnerLib(number, name): + global diyRunnerLib action = QtWidgets.QAction(f"{name}") - action.triggered.connect(lambda: print(int(str(number)))) + mapLink.append(action) + action.triggered.connect(lambda: AddRunnerLib(int(str(number)))) diyRunnerLib.addAction(action) + def DelRunnerLib(number): + os.system(f"rm -rf '{libPathList[number]}'") + mapLink[number].setDisabled(True) for libPath in [f"{programPath}/WineLib/usr/lib", f"{programPath}/WineLib/usr/lib64"]: for i in os.listdir(libPath): if not os.path.isdir(f"{libPath}/{i}"): @@ -3084,12 +3090,12 @@ if os.path.exists(f"{programPath}/WineLib/usr"): except: continue libPathList.append(f"{libPath}/{i}") - AddLib(len(libPathList), f"{i}") + AddRunnerLib(len(libPathList) - 1, f"{i}") else: if not os.path.exists(f"{libPath}/{i}/libc.so.6"): continue libPathList.append(f"{libPath}/{i}/") - AddLib(len(libPathList), f"{i}/") + AddRunnerLib(len(libPathList) - 1, f"{i}/") print(libPathList) if os.path.exists(f"{programPath}/InstallRuntime"): installLib.addSeparator()