From 5c2cd380eaf0a660eeb6c646b9128c8da6f4f652 Mon Sep 17 00:00:00 2001
From: gfdgd_xi <3025613752@qq.com>
Date: Fri, 26 Aug 2022 12:11:34 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E9=87=8A=E5=99=A8=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
AutoConfig.py | 29 ++++++++++-
ConfigLanguareRunner.py | 62 +++++++++++++++++++----
UI/AutoConfig.py | 15 ++----
UI/AutoConfig.ui | 9 ----
UI/__pycache__/AutoConfig.cpython-37.pyc | Bin 2668 -> 2536 bytes
dxvk.7z | Bin 3150826 -> 3150883 bytes
mainwindow.py | 2 +-
7 files changed, 85 insertions(+), 32 deletions(-)
diff --git a/AutoConfig.py b/AutoConfig.py
index 395e42d..ae49e36 100644
--- a/AutoConfig.py
+++ b/AutoConfig.py
@@ -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:
# 获取列表
diff --git a/ConfigLanguareRunner.py b/ConfigLanguareRunner.py
index 5d60248..b3be81b 100755
--- a/ConfigLanguareRunner.py
+++ b/ConfigLanguareRunner.py
@@ -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)):
diff --git a/UI/AutoConfig.py b/UI/AutoConfig.py
index dc727d2..1418666 100644
--- a/UI/AutoConfig.py
+++ b/UI/AutoConfig.py
@@ -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", "打开本地部署脚本"))
+
diff --git a/UI/AutoConfig.ui b/UI/AutoConfig.ui
index 9b491ca..7b0ae10 100644
--- a/UI/AutoConfig.ui
+++ b/UI/AutoConfig.ui
@@ -74,14 +74,6 @@
36
-
-
diff --git a/UI/__pycache__/AutoConfig.cpython-37.pyc b/UI/__pycache__/AutoConfig.cpython-37.pyc
index ebd2bd8dc4710004c59f4e02053efbb9a93296f4..e40ce52387c595c890c0a66e2397a6cb284694be 100644
GIT binary patch
delta 494
zcmaDO@3|TS@85tQ$m=-A4FfL@Q
zVTe}&im5DMND)R8R|Sfz0>wqp#MOY}YCv&OG;wvHxH?c=3?vR@D=yFgiNJY|nhP0_
zBvhdiGGJwj3$zw8KtvX3gB%8QqFk2F0$m6@g&~+hQ+)C+=G~KPS+p4SHm?AZqETGM
zsU^Otd8JN?MN#a5j>#pN`FWEaI7KG06*9_9E@E?I;{k?4amwU@aG2WWY#pz|G$y_82
zlq~`&iQV&iI7BHj;
zFJxq7s9{{743S}E0IE`%e1S<^Ql*9wtWpgqqXtwd3Q`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i@0%9B
zcZWJMnN}&DYbAgVdN%1TapJt951lcwae7AHVduQXUsyll&vPJef?n(T(mjC{^`VQH`q6%~vNIeR71M2CbSj;|!b@lsOT~6r+wo!isGa`F<)kX}_D2i#b
z6Yth2jh=Lr2=u)0kga#8NdH@VRg(B3RWf^v^O;_Be5F~Bv~j#Jb*cr{ZQWe?C{e5Z
zV68=p;IU=*`>O}tkC9#y<6kC|E56RDd)76ai+l>*rec;N#mAF@Tq)?yvk>ij-XeiR
zmCGcJ;QUsR@9zH7SUVqkZx1K=>yIhRD{}wCUD=cuPWYQs%i6Ek#^3Ay97V~B6>d}f
zLT6ou#Ap4IiOad|&)!`+co#&lH;!wyj{EXw4T=@BfI16YmH%L!RZWTj-;V%u0FD4S
z0bBrX01x25#tYyBKmhyzC_n%p2oM4Y14IC#05O0#Kmu?S00T$@qyW+Y8GtN64j>PJ
z0}ucO01}`GPy(O;$^bM#1)vI01E>Qu0Ga?TfOca9SjUQ=AQ0J@GP%-pxG@atRjU28
zGM}81=|EeFoa|?mE0`gQ1~b<6^JJE-h8Wv13xSbkALezpXm+T<#3Necmq~$3tiN3J
zRj*mL_Lw8wVEWdZ2}tm_u??ypbaVL9Pqeh5?q!b|J1yKL4cW{d^L6gz
zEaH`yxk@Dx{y9}JFgBqJntweR_-~*>cElxX96RT;bBa#w6hZY7zEW{R=t+N+ZIwj!
zqdUiiV{iT}_gRPsW4v76%ORy4bup(|H7=8^3fIQv6X)~due&L5n78UR8b@1tu?up{
zg{w1y>ue|Xj)B5rHYqkfHP6TWF7WJBdkM@Go%AH4TtQe{VJ(Wt^zV0Myy!R-MO
R27#cYJO~H6Bu)|p`X30^TIT=&
diff --git a/mainwindow.py b/mainwindow.py
index 925b1d8..23cf89a 100755
--- a/mainwindow.py
+++ b/mainwindow.py
@@ -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():