From 0c8db7a718cac2b229eacfc5b6eedf55d1e2b973 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Thu, 29 Sep 2022 21:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AutoConfig.py | 21 +++++++++++++++++- AutoShell/command/installvcpp | 2 +- AutoShell/main.py | 6 ++++- ConfigLanguareRunner.py | 4 ++++ InstallDll.py | 1 + .../ConfigLanguareRunner.cpython-37.pyc | Bin 13156 -> 13262 bytes __pycache__/InstallDll.cpython-37.pyc | Bin 4005 -> 4005 bytes 7 files changed, 31 insertions(+), 3 deletions(-) diff --git a/AutoConfig.py b/AutoConfig.py index c24487e..19372ff 100755 --- a/AutoConfig.py +++ b/AutoConfig.py @@ -51,16 +51,24 @@ class Connect: fileName = i[1] break # 下载脚本 + things = "" try: print(f"{urlSources}/{fileName}") file = open("/tmp/wine-runner-auto-config.wsh", "w") - file.write(requests.get(f"{urlSources}/{fileName}").text) + things = requests.get(f"{urlSources}/{fileName}").text + file.write(things) file.close() except: traceback.print_exc() QtWidgets.QMessageBox.critical(window, "错误", "无法获取配置文件") return + # 判断版本以启动对应的解释器 + # 做到新旧兼容 + if "$(" in things: + print("a") + OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/ConfigLanguareRunner.py' '/tmp/wine-runner-auto-config.wsh' --system") # 执行脚本 + print(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/AutoShell/main.py' '/tmp/wine-runner-auto-config.wsh'") OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/AutoShell/main.py' '/tmp/wine-runner-auto-config.wsh'") #process = QtCore.QProcess() #process.start(f"{programPath}/launch.sh", ["deepin-terminal", "-e", "env", f"WINE={wine}", f"WINEPREFIX={wineprefix}", f"{programPath}/ConfigLanguareRunner.py", "/tmp/wine-runner-auto-config.wsh", "--system"]) @@ -70,6 +78,16 @@ class Connect: path = QtWidgets.QFileDialog.getOpenFileName(window, "提示", homePath, "配置文件(*.sh *.wsh);;全部文件(*.*)") if path[0] == "": return + try: + things = "" + with open(path) as file: + things = file.read() + except: + traceback.print_exc() + # 判断版本以启动对应的解释器 + # 做到新旧兼容 + if "$(" in things: + OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/ConfigLanguareRunner.py' '{path[0]}' --system") # 执行脚本 OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/AutoShell/main.py' '{path[0]}'") #process = QtCore.QProcess() @@ -100,6 +118,7 @@ if __name__ == "__main__": ui = Ui_MainWindow() ui.setupUi(window) window.setWindowTitle(f"Wine 运行器 {version}——容器自动配置部署脚本") + window.setWindowIcon(QtGui.QIcon(f"{programPath}/deepin-wine-runner.svg")) window.show() # 连接信号和槽 ui.saerchBotton.clicked.connect(Connect.SearchBotton_Clicked) diff --git a/AutoShell/command/installvcpp b/AutoShell/command/installvcpp index 1bf2fba..bcf4bde 100755 --- a/AutoShell/command/installvcpp +++ b/AutoShell/command/installvcpp @@ -10,4 +10,4 @@ argv = [] for i in sys.argv[1:]: argv.append(i.replace(" ", "\\ ")) com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") -com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) diff --git a/AutoShell/main.py b/AutoShell/main.py index 7826010..47ea08d 100755 --- a/AutoShell/main.py +++ b/AutoShell/main.py @@ -52,7 +52,7 @@ if "--system" in sys.argv: if os.getenv("WINE") != None: programEnv.append(["WINE", os.getenv("WINE")]) if os.getenv("WINEPREFIX") != None: - programEnv.append(["WINE", os.getenv("WINEPREFIX")]) + programEnv.append(["WINEPREFIX", os.getenv("WINEPREFIX")]) # 生成可以使用的参数 commandEnv = "" for i in programEnv: @@ -68,4 +68,8 @@ if len(sys.argv) - optionAll < 2: command = "" for i in sys.argv[1:]: command += f"\"{i}\" " +print("Wine 运行器自动配置文件解析器(基于 Bash)") +print(f"版本:{version}") +print(f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢") +print("--------------------------------------------------------------") os.system(f"{commandEnv} bash {command}") \ No newline at end of file diff --git a/ConfigLanguareRunner.py b/ConfigLanguareRunner.py index 4517606..2b1c65f 100755 --- a/ConfigLanguareRunner.py +++ b/ConfigLanguareRunner.py @@ -481,4 +481,8 @@ if __name__ == "__main__": except: print("错误:无法读取该文件,无法继续") sys.exit(1) + print("Wine 运行器自动配置文件解析器") + print(f"版本:{version}") + print(f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("--------------------------------------------------------------") com.Run(com.GetCommandList(), programEnv[0][1], programEnv[1][1]) \ No newline at end of file diff --git a/InstallDll.py b/InstallDll.py index 1d07749..cff3675 100755 --- a/InstallDll.py +++ b/InstallDll.py @@ -48,6 +48,7 @@ def Download(wineBotton, dllName, urlPart, wine: str) -> bool: except: pass os.system(f"aria2c -x 16 -s 16 -d '{wineBotton}/drive_c/windows/system32' -o '{dllName}' '{urlPart}'") + #print(f"WINEPREFIX='{wineBotton}' {wine} reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(dllName)[0]} /d native /f") os.system(f"WINEPREFIX='{wineBotton}' {wine} reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(dllName)[0]} /d native /f") return 0 diff --git a/__pycache__/ConfigLanguareRunner.cpython-37.pyc b/__pycache__/ConfigLanguareRunner.cpython-37.pyc index ee49095134f1fca67dd46e32b471f897368f1141..affb5a67b6bd8dae8c936adebf5b958c56a10829 100644 GIT binary patch delta 89 zcmaEob}pUIiIXJni(+1Pk806>}&K>z>% diff --git a/__pycache__/InstallDll.cpython-37.pyc b/__pycache__/InstallDll.cpython-37.pyc index 6c5ab6e8864a131abe400e7ad47c1e82592322f3..31351b447bc365bbe709c9fae1fdd47d6049661f 100644 GIT binary patch delta 42 wcmZ1~zf_*jiI