测试完成

This commit is contained in:
gfdgd xi 2022-09-28 21:00:53 +08:00
parent f6a4389c26
commit 6276dfb0f9

View File

@ -1343,6 +1343,7 @@ class ProgramSetting():
autoWine = None autoWine = None
runtimeCache = None runtimeCache = None
buildByBottleName = None buildByBottleName = None
autoPath = None
def ShowWindow(): def ShowWindow():
ProgramSetting.message = QtWidgets.QMainWindow() ProgramSetting.message = QtWidgets.QMainWindow()
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
@ -1358,6 +1359,7 @@ class ProgramSetting():
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "忽略未安装的 Wine")), 8, 0, 1, 1) widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "忽略未安装的 Wine")), 8, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "下载缓存:")), 9, 0, 1, 1) widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "下载缓存:")), 9, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "图标生成:")), 10, 0, 1, 1) widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "图标生成:")), 10, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "自动根据EXE名称生成路径")), 11, 0, 1, 1)
ProgramSetting.wineBottonA = QtWidgets.QComboBox() ProgramSetting.wineBottonA = QtWidgets.QComboBox()
ProgramSetting.wineDebug = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "开启 DEBUG 输出")) ProgramSetting.wineDebug = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "开启 DEBUG 输出"))
ProgramSetting.defultWine = QtWidgets.QComboBox() ProgramSetting.defultWine = QtWidgets.QComboBox()
@ -1377,6 +1379,7 @@ class ProgramSetting():
ProgramSetting.autoWine = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "不显示未检测到的 Wine")) ProgramSetting.autoWine = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "不显示未检测到的 Wine"))
ProgramSetting.runtimeCache = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "开启下载缓存")) ProgramSetting.runtimeCache = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "开启下载缓存"))
ProgramSetting.buildByBottleName = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "本软件构建的图标后面添加容器名")) ProgramSetting.buildByBottleName = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "本软件构建的图标后面添加容器名"))
ProgramSetting.autoPath = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "自动根据文件名生成容器路径开启后必须通过修改默认wine容器路径才可指定其它路径重启后生效"))
ProgramSetting.wineBottonA.addItems(["Auto", "win32", "win64"]) ProgramSetting.wineBottonA.addItems(["Auto", "win32", "win64"])
ProgramSetting.wineBottonA.setCurrentText(setting["Architecture"]) ProgramSetting.wineBottonA.setCurrentText(setting["Architecture"])
ProgramSetting.wineDebug.setChecked(setting["Debug"]) ProgramSetting.wineDebug.setChecked(setting["Debug"])
@ -1389,6 +1392,7 @@ class ProgramSetting():
ProgramSetting.autoWine.setChecked(setting["AutoWine"]) ProgramSetting.autoWine.setChecked(setting["AutoWine"])
ProgramSetting.runtimeCache.setChecked(setting["RuntimeCache"]) ProgramSetting.runtimeCache.setChecked(setting["RuntimeCache"])
ProgramSetting.buildByBottleName.setChecked(setting["BuildByBottleName"]) ProgramSetting.buildByBottleName.setChecked(setting["BuildByBottleName"])
ProgramSetting.autoPath.setChecked(setting["AutoPath"])
widgetLayout.addWidget(ProgramSetting.wineBottonA, 0, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.wineBottonA, 0, 1, 1, 1)
widgetLayout.addWidget(ProgramSetting.wineDebug, 1, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.wineDebug, 1, 1, 1, 1)
widgetLayout.addWidget(ProgramSetting.defultWine, 2, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.defultWine, 2, 1, 1, 1)
@ -1402,7 +1406,8 @@ class ProgramSetting():
widgetLayout.addWidget(ProgramSetting.autoWine, 8, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.autoWine, 8, 1, 1, 1)
widgetLayout.addWidget(ProgramSetting.runtimeCache, 9, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.runtimeCache, 9, 1, 1, 1)
widgetLayout.addWidget(ProgramSetting.buildByBottleName, 10, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.buildByBottleName, 10, 1, 1, 1)
widgetLayout.addWidget(save, 11, 2, 1, 1) widgetLayout.addWidget(ProgramSetting.autoPath, 11, 1, 1, 2)
widgetLayout.addWidget(save, 12, 2, 1, 1)
widget.setLayout(widgetLayout) widget.setLayout(widgetLayout)
ProgramSetting.message.setCentralWidget(widget) ProgramSetting.message.setCentralWidget(widget)
ProgramSetting.message.setWindowIcon(QtGui.QIcon(iconPath)) ProgramSetting.message.setWindowIcon(QtGui.QIcon(iconPath))
@ -1431,6 +1436,7 @@ class ProgramSetting():
setting["AutoWine"] = ProgramSetting.autoWine.isChecked() setting["AutoWine"] = ProgramSetting.autoWine.isChecked()
setting["RuntimeCache"] = ProgramSetting.runtimeCache.isChecked() setting["RuntimeCache"] = ProgramSetting.runtimeCache.isChecked()
setting["BuildByBottleName"] = ProgramSetting.buildByBottleName.isChecked() setting["BuildByBottleName"] = ProgramSetting.buildByBottleName.isChecked()
setting["AutoPath"] = ProgramSetting.autoPath.isChecked()
try: try:
write_txt(get_home() + "/.config/deepin-wine-runner/WineSetting.json", json.dumps(setting)) write_txt(get_home() + "/.config/deepin-wine-runner/WineSetting.json", json.dumps(setting))
except: except:
@ -1537,6 +1543,9 @@ class ValueCheck():
traceback.print_exc() traceback.print_exc()
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc()) QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
def ChangePath():
e1.setCurrentText(f'{setting["DefultBotton"]}/{os.path.splitext(os.path.basename(e2.currentText()))[0]}')
########################### ###########################
# 加载配置 # 加载配置
########################### ###########################
@ -1554,7 +1563,8 @@ defultProgramList = {
"AutoWine": True, "AutoWine": True,
"RuntimeCache": True, "RuntimeCache": True,
"MustRead": False, "MustRead": False,
"BuildByBottleName": False "BuildByBottleName": False,
"AutoPath": False
} }
if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹 if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹
os.mkdir(get_home() + "/.config/deepin-wine-runner") # 创建配置文件夹 os.mkdir(get_home() + "/.config/deepin-wine-runner") # 创建配置文件夹
@ -1909,6 +1919,8 @@ button1.clicked.connect(liulanbutton)
leftUpLayout.addWidget(button1, 3, 1, 1, 1) leftUpLayout.addWidget(button1, 3, 1, 1, 1)
leftUpLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "请选择要执行的程序:")), 4, 0, 1, 1) leftUpLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "请选择要执行的程序:")), 4, 0, 1, 1)
e2 = QtWidgets.QComboBox() e2 = QtWidgets.QComboBox()
if setting["AutoPath"]:
e2.editTextChanged.connect(ChangePath)
e2.setEditable(True) e2.setEditable(True)
leftUpLayout.addWidget(e2, 5, 0, 1, 1) leftUpLayout.addWidget(e2, 5, 0, 1, 1)
button2 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览")) button2 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览"))