diff --git a/AutoConfig.py b/AutoConfig.py old mode 100644 new mode 100755 index ae49e36..f16cafb --- a/AutoConfig.py +++ b/AutoConfig.py @@ -50,7 +50,7 @@ class Connect: return # 执行脚本 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"]) + 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.waitForFinished() def OpenFile_Triggered(): @@ -59,7 +59,7 @@ class Connect: 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.start(f"{programPath}/launch.sh", ["deepin-terminal", "-e", "env", f"WINE={wine}", f"WINEPREFIX={wineprefix}", f"{programPath}/ConfigLanguareRunner.py", path[0], "--system"]) process.waitForFinished() # 读取文本文档 diff --git a/ChangeWineBottonVersion/10.reg b/ChangeWineBottonVersion/10.reg new file mode 100644 index 0000000..f3dd639 Binary files /dev/null and b/ChangeWineBottonVersion/10.reg differ diff --git a/ChangeWineBottonVersion/2003.reg b/ChangeWineBottonVersion/2003.reg new file mode 100644 index 0000000..7441450 Binary files /dev/null and b/ChangeWineBottonVersion/2003.reg differ diff --git a/ChangeWineBottonVersion/2008.reg b/ChangeWineBottonVersion/2008.reg new file mode 100644 index 0000000..56350bf Binary files /dev/null and b/ChangeWineBottonVersion/2008.reg differ diff --git a/ChangeWineBottonVersion/7.reg b/ChangeWineBottonVersion/7.reg new file mode 100644 index 0000000..1d7ce5a Binary files /dev/null and b/ChangeWineBottonVersion/7.reg differ diff --git a/ChangeWineBottonVersion/8.1.reg b/ChangeWineBottonVersion/8.1.reg new file mode 100644 index 0000000..1c3a360 Binary files /dev/null and b/ChangeWineBottonVersion/8.1.reg differ diff --git a/ChangeWineBottonVersion/8.reg b/ChangeWineBottonVersion/8.reg new file mode 100644 index 0000000..fe66b5a Binary files /dev/null and b/ChangeWineBottonVersion/8.reg differ diff --git a/ChangeWineBottonVersion/desktop/desktop.reg b/ChangeWineBottonVersion/desktop/desktop.reg new file mode 100644 index 0000000..684541e Binary files /dev/null and b/ChangeWineBottonVersion/desktop/desktop.reg differ diff --git a/ChangeWineBottonVersion/vista.reg b/ChangeWineBottonVersion/vista.reg new file mode 100644 index 0000000..a1540df Binary files /dev/null and b/ChangeWineBottonVersion/vista.reg differ diff --git a/ChangeWineBottonVersion/xp.reg b/ChangeWineBottonVersion/xp.reg new file mode 100644 index 0000000..c8f68ef Binary files /dev/null and b/ChangeWineBottonVersion/xp.reg differ diff --git a/ConfigLanguareRunner.py b/ConfigLanguareRunner.py index b3be81b..a6611ab 100755 --- a/ConfigLanguareRunner.py +++ b/ConfigLanguareRunner.py @@ -7,7 +7,6 @@ # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### -from inspect import trace import os import sys import time @@ -83,7 +82,11 @@ class Command(): "createbotton", "reg", "enabledopengl", - "disbledopengl" + "disbledopengl", + "winecfg", + "winver", + "changeversion", + "stopdll" ] def __init__(self, commandString: str) -> None: @@ -147,8 +150,8 @@ class Command(): except: pass if number: - 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])) + return InstallDll.Download(self.wineBottonPath, InstallDll.GetNameByNumber(int(self.command[1])), InstallDll.GetUrlByNumber(int(self.command[1])), self.wine) + return InstallDll.Download(self.wineBottonPath, self.command[1], InstallDll.GetUrlByName(self.command[1]), self.wine) def InstallDxvk(self): if not os.path.exists(f"{programPath}/dxvk"): @@ -189,6 +192,9 @@ class Command(): QtWidgets.QMessageBox.information(None, self.command[1], self.command[2]) return 0 + def StopDll(self) -> int: + os.system(f"WINEPREFIX='{self.wineBottonPath}' '{self.wine}' reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(self.command[1])[0]} /f") + def CreateBotton(self): self.command = ["bat", "exit"] self.Bat() @@ -239,7 +245,8 @@ class Command(): command.append(i) commandStr = command[0] + " " for i in command[1:]: - commandStr += f"{i} " + commandStr += f"'{i}' " + print(commandStr) return os.system(commandStr) def Version(self): @@ -265,11 +272,30 @@ class Command(): return self.Bat() def EnabledOpenGl(self) -> int: - self.command = ["reg", f"{programPath}/EnabledOpengl.reg"] + self.command = ["reg", f"z:{programPath}/EnabledOpengl.reg"] return self.Reg() def DisbledOpenGl(self) -> int: - self.command = ["reg", f"{programPath}/DisabledOpengl.reg"] + self.command = ["reg", f"z:{programPath}/DisabledOpengl.reg"] + return self.Reg() + + def Winver(self): + self.command = ["bat", "winver"] + return self.Bat() + + def Winecfg(self): + self.command = ["bat", "winecfg"] + return self.Bat() + + def ChangeVersion(self): + # 判断是否为正确的版本 + if not os.path.exists(f"{programPath}/ChangeWineBottonVersion/{self.command[1]}.reg"): + print("错误:您选择的版本错误,目前只支持以下版本") + for i in os.listdir(f"{programPath}/ChangeWineBottonVersion"): + print(i.replace(".reg", ""), end=" ") + print() + return 1 + self.command = ["reg", f"z:/{programPath}/ChangeWineBottonVersion/{self.command[1]}.reg"] return self.Reg() # 可以运行的命令的映射关系 @@ -298,7 +324,11 @@ class Command(): "createbotton": CreateBotton, "reg": Reg, "enabledopengl": EnabledOpenGl, - "disbledopengl": DisbledOpenGl + "disbledopengl": DisbledOpenGl, + "winecfg": Winecfg, + "winver": Winver, + "changeversion": ChangeVersion, + "stopdll": StopDll } # 参数数列表 @@ -326,7 +356,11 @@ class Command(): "createbotton": [0], "reg": [1], "enabledopengl": [0], - "disbledopengl": [0] + "disbledopengl": [0], + "winecfg": [0], + "winver": [0], + "changeversion": [1], + "stopdll": [1] } # 解析 diff --git a/InstallDll.py b/InstallDll.py index 869f13d..b299773 100755 --- a/InstallDll.py +++ b/InstallDll.py @@ -37,12 +37,14 @@ def GetUrlByName(dllName: str): if dllName == lists[i][0]: return f"{url}/{lists[i][1]}/{lists[i][2]}/{lists[i][0]}" -def Download(wineBotton, dllName, urlPart) -> bool: +def Download(wineBotton, dllName, urlPart, wine: str) -> bool: try: os.remove(f"{wineBotton}/drive_c/windows/system32/{dllName}") except: pass - return 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}'") + 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 def exit(): input("按回车键退出") @@ -70,6 +72,7 @@ if __name__ == "__main__": ''') wineBotton = sys.argv[1] + wine = sys.argv[2] if not os.path.exists(f"{wineBotton}/drive_c/windows/Fonts"): input("您选择的不是 Wine 容器") exit() @@ -120,5 +123,5 @@ if __name__ == "__main__": # 下载 DLL print(f"正在下载{dllName},请稍后") print(f"下载链接:{urlPart}") - if not Download(wineBotton, dllName, urlPart): + if Download(wineBotton, dllName, urlPart, wine): print("下载失败!请重试") diff --git a/__pycache__/InstallDll.cpython-37.pyc b/__pycache__/InstallDll.cpython-37.pyc index a4b60d4..ba86a66 100644 Binary files a/__pycache__/InstallDll.cpython-37.pyc and b/__pycache__/InstallDll.cpython-37.pyc differ diff --git a/mainwindow.py b/mainwindow.py index 23cf89a..4c90fcb 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -520,7 +520,14 @@ def GetDllFromInternet(): wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"WINE='{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallDll.py' '{wineBottonPath}' {int(setting['RuntimeCache'])}") + os.system(f"WINE='{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallDll.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") + +def WineBottonAutoConfig(): + if e1.currentText() == "": + wineBottonPath = setting["DefultBotton"] + else: + wineBottonPath = e1.currentText() + os.system(f"'{programPath}/AutoConfig.py' '{wine[o1.currentText()]}' '{wineBottonPath}'") def InstallMonoGecko(program): if e1.currentText() == "": @@ -946,6 +953,7 @@ class GetDllFromWindowsISO: return try: shutil.copy(f"/tmp/wine-runner-getdll/i386/{choose[:-1]}_", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}") + os.system(f"WINEPREFIX='{GetDllFromWindowsISO.wineBottonPath}' '{wine[o1.currentText()]}' reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(choose)[0]} /d native /f") QtWidgets.QMessageBox.information(GetDllFromWindowsISO.message, "提示", "提取成功!") except: traceback.print_exc() @@ -1355,12 +1363,15 @@ exe路径\' 参数 \' updateThingsString = '''※1、新增新的 Wine 安装器,并支持将安装的 Wine 打包到 Wine 程序 deb 包中 ※2、Wine 打包器打包 Windows 应用支持将 Wine 打包入 deb 内,可以不依赖 Wine(一般不推荐把 Wine 打包入内,推荐用依赖的形式),并支持设置自定义依赖和生成模板 ※3、开始初步多语言支持 -※4、修复了在没有安装任何 Wine 的情况下使用高级功能导致程序闪退的问题 -4、修改错别字(图形话=>图形化) -5、修复评分功能名称为空也可以上传评分的问题 -6、去除 toilet 依赖,使在 Deepin 23 Preview 上运行更佳 -7、支持删除所有由 Wine 创建的启动器快捷方式 -8、支持从云端获取 Dll 并添加 +※4、修复了在没有安装任何 Wine 的情况下使用高级功能导致程序闪退的问题 +※5、支持云端自动获取数据配置 Wine 容器 +※6、支持手动导入配置文件自动配置 Wine 容器 +※7、新增从云端下载 Dll 的功能 +※8、修复了 Dll 提取工具不会在 winecfg 中添加原装的问题 +9、修改错别字(图形话=>图形化) +10、修复评分功能名称为空也可以上传评分的问题 +11、去除 toilet 依赖,使在 Deepin 23 Preview 上运行更佳 +12、支持删除所有由 Wine 创建的启动器快捷方式 ''' for i in information["Thank"]: thankText += f"{i}\n" @@ -1510,6 +1521,9 @@ programManager.addWidget(button_r_6, 3, 4, 1, 1) sparkWineSetting = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "星火wine配置")) sparkWineSetting.clicked.connect(lambda: threading.Thread(target=os.system, args=["/opt/durapps/spark-dwine-helper/spark-dwine-helper-settings/settings.sh"]).start()) programManager.addWidget(sparkWineSetting, 3, 6, 1, 1) +wineAutoConfig = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "自动/手动配置 Wine 容器")) +wineAutoConfig.clicked.connect(WineBottonAutoConfig) +programManager.addWidget(wineAutoConfig, 3, 8, 1, 1) # 权重 button5.setSizePolicy(size) saveDesktopFileOnLauncher.setSizePolicy(size)