This commit is contained in:
gfdgd xi 2022-09-29 21:42:18 +08:00
parent 2bd02b94c5
commit 0c8db7a718
7 changed files with 31 additions and 3 deletions

View File

@ -51,16 +51,24 @@ class Connect:
fileName = i[1] fileName = i[1]
break break
# 下载脚本 # 下载脚本
things = ""
try: try:
print(f"{urlSources}/{fileName}") print(f"{urlSources}/{fileName}")
file = open("/tmp/wine-runner-auto-config.wsh", "w") 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() file.close()
except: except:
traceback.print_exc() traceback.print_exc()
QtWidgets.QMessageBox.critical(window, "错误", "无法获取配置文件") QtWidgets.QMessageBox.critical(window, "错误", "无法获取配置文件")
return 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'") OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/AutoShell/main.py' '/tmp/wine-runner-auto-config.wsh'")
#process = QtCore.QProcess() #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"]) #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);;全部文件(*.*)") path = QtWidgets.QFileDialog.getOpenFileName(window, "提示", homePath, "配置文件(*.sh *.wsh);;全部文件(*.*)")
if path[0] == "": if path[0] == "":
return 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]}'") OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/AutoShell/main.py' '{path[0]}'")
#process = QtCore.QProcess() #process = QtCore.QProcess()
@ -100,6 +118,7 @@ if __name__ == "__main__":
ui = Ui_MainWindow() ui = Ui_MainWindow()
ui.setupUi(window) ui.setupUi(window)
window.setWindowTitle(f"Wine 运行器 {version}——容器自动配置部署脚本") window.setWindowTitle(f"Wine 运行器 {version}——容器自动配置部署脚本")
window.setWindowIcon(QtGui.QIcon(f"{programPath}/deepin-wine-runner.svg"))
window.show() window.show()
# 连接信号和槽 # 连接信号和槽
ui.saerchBotton.clicked.connect(Connect.SearchBotton_Clicked) ui.saerchBotton.clicked.connect(Connect.SearchBotton_Clicked)

View File

@ -52,7 +52,7 @@ if "--system" in sys.argv:
if os.getenv("WINE") != None: if os.getenv("WINE") != None:
programEnv.append(["WINE", os.getenv("WINE")]) programEnv.append(["WINE", os.getenv("WINE")])
if os.getenv("WINEPREFIX") != None: if os.getenv("WINEPREFIX") != None:
programEnv.append(["WINE", os.getenv("WINEPREFIX")]) programEnv.append(["WINEPREFIX", os.getenv("WINEPREFIX")])
# 生成可以使用的参数 # 生成可以使用的参数
commandEnv = "" commandEnv = ""
for i in programEnv: for i in programEnv:
@ -68,4 +68,8 @@ if len(sys.argv) - optionAll < 2:
command = "" command = ""
for i in sys.argv[1:]: for i in sys.argv[1:]:
command += f"\"{i}\" " command += f"\"{i}\" "
print("Wine 运行器自动配置文件解析器(基于 Bash")
print(f"版本:{version}")
print(f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢")
print("--------------------------------------------------------------")
os.system(f"{commandEnv} bash {command}") os.system(f"{commandEnv} bash {command}")

View File

@ -481,4 +481,8 @@ if __name__ == "__main__":
except: except:
print("错误:无法读取该文件,无法继续") print("错误:无法读取该文件,无法继续")
sys.exit(1) 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]) com.Run(com.GetCommandList(), programEnv[0][1], programEnv[1][1])

View File

@ -48,6 +48,7 @@ def Download(wineBotton, dllName, urlPart, wine: str) -> bool:
except: except:
pass pass
os.system(f"aria2c -x 16 -s 16 -d '{wineBotton}/drive_c/windows/system32' -o '{dllName}' '{urlPart}'") 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") 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 return 0