mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-12 17:48:27 +08:00
解释器完成
This commit is contained in:
parent
3f38af72d9
commit
5c2cd380ea
@ -50,21 +50,48 @@ class Connect:
|
||||
return
|
||||
# 执行脚本
|
||||
process = QtCore.QProcess()
|
||||
process.start(f"{programPath}/launch.sh", ["deepin-terminal", "-e", "env", "WINE=deepin-wine6-stable", "WINEPREFIX=/home/gfdgd_xi/.deepinwine", f"{programPath}/ConfigLanguareRunner.py", "/tmp/wine-runner-auto-config.wsh"])
|
||||
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"])
|
||||
process.waitForFinished()
|
||||
|
||||
def OpenFile_Triggered():
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(window, "提示", homePath, "配置文件(*.sh *.wsh);;全部文件(*.*)")
|
||||
if path[0] == "":
|
||||
return
|
||||
# 执行脚本
|
||||
process = QtCore.QProcess()
|
||||
process.start(f"{programPath}/launch.sh", ["deepin-terminal", "-e", "env", f"WINE={wine}", f"WINEPREFIX={wineprefix}", f"{programPath}/ConfigLanguareRunner.py", path[0]])
|
||||
process.waitForFinished()
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path):
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
if __name__ == "__main__":
|
||||
homePath = os.path.expanduser('~')
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
information = json.loads(readtxt(f"{programPath}/information.json"))
|
||||
version = information["Version"]
|
||||
wine = "deepin-wine6-stable"
|
||||
wineprefix = f"{homePath}/.wine"
|
||||
try:
|
||||
wine = sys.argv[1]
|
||||
wineprefix = sys.argv[2]
|
||||
except:
|
||||
pass
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
window = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(window)
|
||||
window.setWindowTitle(f"Wine 运行器 {version}——容器自动配置部署脚本")
|
||||
window.show()
|
||||
# 连接信号和槽
|
||||
ui.saerchBotton.clicked.connect(Connect.SearchBotton_Clicked)
|
||||
ui.runBotton.clicked.connect(Connect.RunBotton_Clicked)
|
||||
ui.openFile.triggered.connect(Connect.OpenFile_Triggered)
|
||||
ui.exitProgram.triggered.connect(window.close)
|
||||
# 解析云列表
|
||||
try:
|
||||
# 获取列表
|
||||
|
@ -37,14 +37,17 @@ programEnv = [
|
||||
["($THANK)", thankText],
|
||||
["($MAKER)", "gfdgd xi、为什么您不喜欢熊出没和阿布呢"],
|
||||
["($COPYRIGHT)", f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢"],
|
||||
["($?)", 0]
|
||||
["($?)", "0"]
|
||||
]
|
||||
readOnlyEnv = [
|
||||
"($DANGER)",
|
||||
"($HOME)",
|
||||
"($PROGRAMPATH)",
|
||||
"($VERSION)",
|
||||
"($THANK)"
|
||||
"($THANK)",
|
||||
"($MAKER)",
|
||||
"($COPYRIGHT)",
|
||||
"($?)"
|
||||
]
|
||||
|
||||
class Command():
|
||||
@ -52,7 +55,8 @@ class Command():
|
||||
dangerCommand = [
|
||||
"bash",
|
||||
"bat",
|
||||
"download"
|
||||
"download",
|
||||
"reg"
|
||||
]
|
||||
# 可以被使用的命令
|
||||
commandList = [
|
||||
@ -74,7 +78,12 @@ class Command():
|
||||
"version",
|
||||
"thank",
|
||||
"pause",
|
||||
"download"
|
||||
"download",
|
||||
"installdxvk",
|
||||
"createbotton",
|
||||
"reg",
|
||||
"enabledopengl",
|
||||
"disbledopengl"
|
||||
]
|
||||
|
||||
def __init__(self, commandString: str) -> None:
|
||||
@ -141,6 +150,14 @@ class Command():
|
||||
return InstallDll.Download(self.wineBottonPath, InstallDll.GetNameByNumber(int(self.command[1])), InstallDll.GetUrlByNumber(int(self.command[1])))
|
||||
return InstallDll.Download(self.wineBottonPath, self.command[1], InstallDll.GetUrlByName(self.command[1]))
|
||||
|
||||
def InstallDxvk(self):
|
||||
if not os.path.exists(f"{programPath}/dxvk"):
|
||||
if os.system(f"7z x \"{programPath}/dxvk.7z\" -o\"{programPath}\""):
|
||||
print("错误:无法解压资源")
|
||||
return 1
|
||||
os.remove(f"{programPath}/dxvk.7z")
|
||||
return os.system(f"env 'WINE={self.wine}' 'WINE64={self.wine}' 'WINEPREFIX={self.wineBottonPath}' bash '{programPath}/dxvk/auto.sh' install")
|
||||
|
||||
def Thank(self) -> int:
|
||||
for i in information["Thank"]:
|
||||
print(i)
|
||||
@ -172,6 +189,11 @@ class Command():
|
||||
QtWidgets.QMessageBox.information(None, self.command[1], self.command[2])
|
||||
return 0
|
||||
|
||||
def CreateBotton(self):
|
||||
self.command = ["bat", "exit"]
|
||||
self.Bat()
|
||||
return 0
|
||||
|
||||
def InstallSparkCoreFont(self):
|
||||
if not os.system("which aptss"):
|
||||
# 最新版本星火应用商店处理
|
||||
@ -208,8 +230,8 @@ class Command():
|
||||
command += f"'{i}' "
|
||||
return os.system(command)
|
||||
|
||||
def Bat(self):
|
||||
command = ["WINEPREFIX='$WINEPREFIX'", "$WINE"]
|
||||
def Bat(self) -> int:
|
||||
command = ["WINEPREFIX='($WINEPREFIX)'", "($WINE)"]
|
||||
for i in programEnv:
|
||||
for k in range(len(command)):
|
||||
command[k] = command[k].replace(i[0], i[1])
|
||||
@ -218,7 +240,6 @@ class Command():
|
||||
commandStr = command[0] + " "
|
||||
for i in command[1:]:
|
||||
commandStr += f"{i} "
|
||||
print(commandStr)
|
||||
return os.system(commandStr)
|
||||
|
||||
def Version(self):
|
||||
@ -239,6 +260,18 @@ class Command():
|
||||
pass
|
||||
return os.system(command)
|
||||
|
||||
def Reg(self) -> int:
|
||||
self.command = ["bat", "regedit", "/s", self.command[1]]
|
||||
return self.Bat()
|
||||
|
||||
def EnabledOpenGl(self) -> int:
|
||||
self.command = ["reg", f"{programPath}/EnabledOpengl.reg"]
|
||||
return self.Reg()
|
||||
|
||||
def DisbledOpenGl(self) -> int:
|
||||
self.command = ["reg", f"{programPath}/DisabledOpengl.reg"]
|
||||
return self.Reg()
|
||||
|
||||
# 可以运行的命令的映射关系
|
||||
# 可以被使用的命令的映射
|
||||
commandList = {
|
||||
@ -260,7 +293,12 @@ class Command():
|
||||
"version": Version,
|
||||
"thank": Thank,
|
||||
"pause": Pause,
|
||||
"download": Download
|
||||
"download": Download,
|
||||
"installdxvk": InstallDxvk,
|
||||
"createbotton": CreateBotton,
|
||||
"reg": Reg,
|
||||
"enabledopengl": EnabledOpenGl,
|
||||
"disbledopengl": DisbledOpenGl
|
||||
}
|
||||
|
||||
# 参数数列表
|
||||
@ -283,7 +321,12 @@ class Command():
|
||||
"version": [0],
|
||||
"thank": [0],
|
||||
"pause": [0],
|
||||
"download": [1]
|
||||
"download": [1],
|
||||
"installdxvk": [0],
|
||||
"createbotton": [0],
|
||||
"reg": [1],
|
||||
"enabledopengl": [0],
|
||||
"disbledopengl": [0]
|
||||
}
|
||||
|
||||
# 解析
|
||||
@ -315,6 +358,7 @@ class Command():
|
||||
# 正常命令解析
|
||||
if len(i) -1 < self.commandInfo[i[0]][0]:
|
||||
print("参数不足")
|
||||
programEnv[9][1] = "-3"
|
||||
continue
|
||||
# 替换环境变量
|
||||
for a in range(1, len(i)):
|
||||
|
@ -2,15 +2,12 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'AutoConfig.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.6
|
||||
# Created by: PyQt5 UI code generator 5.11.3
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
@ -46,8 +43,6 @@ class Ui_MainWindow(object):
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 36))
|
||||
self.menubar.setObjectName("menubar")
|
||||
self.menu_2 = QtWidgets.QMenu(self.menubar)
|
||||
self.menu_2.setObjectName("menu_2")
|
||||
self.menu = QtWidgets.QMenu(self.menubar)
|
||||
self.menu.setObjectName("menu")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
@ -59,14 +54,10 @@ class Ui_MainWindow(object):
|
||||
self.help.setObjectName("help")
|
||||
self.openFile = QtWidgets.QAction(MainWindow)
|
||||
self.openFile.setObjectName("openFile")
|
||||
self.menu_2.addAction(self.help)
|
||||
self.menu_2.addSeparator()
|
||||
self.menu_2.addAction(self.about)
|
||||
self.menu.addAction(self.openFile)
|
||||
self.menu.addSeparator()
|
||||
self.menu.addAction(self.exitProgram)
|
||||
self.menubar.addAction(self.menu.menuAction())
|
||||
self.menubar.addAction(self.menu_2.menuAction())
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
@ -77,9 +68,9 @@ class Ui_MainWindow(object):
|
||||
self.searchTips.setText(_translate("MainWindow", "搜索内容(为空代表显示所有内容):"))
|
||||
self.saerchBotton.setText(_translate("MainWindow", "搜索"))
|
||||
self.runBotton.setText(_translate("MainWindow", "部署此方案"))
|
||||
self.menu_2.setTitle(_translate("MainWindow", "帮助"))
|
||||
self.menu.setTitle(_translate("MainWindow", "程序"))
|
||||
self.about.setText(_translate("MainWindow", "关于"))
|
||||
self.exitProgram.setText(_translate("MainWindow", "退出程序"))
|
||||
self.help.setText(_translate("MainWindow", "帮助"))
|
||||
self.openFile.setText(_translate("MainWindow", "打开本地部署脚本"))
|
||||
|
||||
|
@ -74,14 +74,6 @@
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_2">
|
||||
<property name="title">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
<addaction name="help"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="about"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu">
|
||||
<property name="title">
|
||||
<string>程序</string>
|
||||
@ -91,7 +83,6 @@
|
||||
<addaction name="exitProgram"/>
|
||||
</widget>
|
||||
<addaction name="menu"/>
|
||||
<addaction name="menu_2"/>
|
||||
</widget>
|
||||
<action name="about">
|
||||
<property name="text">
|
||||
|
Binary file not shown.
@ -562,7 +562,7 @@ def InstallDXVK():
|
||||
wineBottonPath = e1.currentText()
|
||||
process = QtCore.QProcess()
|
||||
process.startDetached(f"{programPath}/launch.sh", ["deepin-terminal", "-e",
|
||||
"env", f"WINE={wine[o1.currentText()]}", f"WINE64={wine[o1.currentText()]}", f"WINEPREFIX={wineBottonPath}",
|
||||
"env", f"WINE={wine[o1.currentText()]}", f"WINE64={wine[o1.currentText()]}", f"WINEPREFIX={wineBottonPath}", "bash",
|
||||
f"{programPath}/dxvk/setup_dxvk.sh", "install"])
|
||||
|
||||
def UninstallDXVK():
|
||||
|
Loading…
Reference in New Issue
Block a user