diff --git a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner
index 31c851e..9ff7c7e 100755
--- a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner
+++ b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner
@@ -169,8 +169,8 @@ class Runexebutton_threading(QtCore.QThread):
wineUsingOption = ""
if o1.currentText() == "基于 box86 的 deepin-wine6-stable" or o1.currentText() == "基于 exagear 的 deepin-wine6-stable":
if not os.path.exists(f"{programPath}/dlls-arm"):
- if os.system(f"7z x \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
- QtWidgets.QMessageBox(widget, "错误", "无法解压资源")
+ if os.system(f"7z x -y \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
+ QtWidgets.QMessageBox.critical(widget, "错误", "无法解压资源")
return
os.remove(f"{programPath}/dlls-arm.7z")
if setting["TerminalOpen"]:
@@ -290,8 +290,8 @@ def make_desktop_on_launcher():
wineUsingOption = ""
if o1.currentText() == "基于 box86 的 deepin-wine6-stable" or o1.currentText() == "基于 exagear 的 deepin-wine6-stable":
if not os.path.exists(f"{programPath}/dlls-arm"):
- if os.system(f"7z x \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
- QtWidgets.QMessageBox(widget, "错误", "无法解压资源")
+ if os.system(f"7z x -y \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
+ QtWidgets.QMessageBox.critical(widget, "错误", "无法解压资源")
return
os.remove(f"{programPath}/dlls-arm.7z")
if o1.currentText() == "基于 exagear 的 deepin-wine6-stable" or o1.currentText() == "基于 box86 的 deepin-wine6-stable":
@@ -352,8 +352,8 @@ def make_desktop_on_desktop():
wineUsingOption = ""
if o1.currentText() == "基于 box86 的 deepin-wine6-stable" or o1.currentText() == "基于 exagear 的 deepin-wine6-stable":
if not os.path.exists(f"{programPath}/dlls-arm"):
- if os.system(f"7z x \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
- QtWidgets.QMessageBox(widget, "错误", "无法解压资源")
+ if os.system(f"7z x -y \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
+ QtWidgets.QMessageBox.critical(widget, "错误", "无法解压资源")
return
os.remove(f"{programPath}/dlls-arm.7z")
if not os.path.exists(get_desktop_path()):
@@ -479,8 +479,8 @@ class RunWineProgramThread(QtCore.QThread):
wineUsingOption = ""
if o1.currentText() == "基于 box86 的 deepin-wine6-stable" or o1.currentText() == "基于 exagear 的 deepin-wine6-stable":
if not os.path.exists(f"{programPath}/dlls-arm"):
- if os.system(f"7z x \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
- QtWidgets.QMessageBox(widget, "错误", "无法解压资源")
+ if os.system(f"7z x -y \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
+ QtWidgets.QMessageBox.critical(widget, "错误", "无法解压资源")
return
os.remove(f"{programPath}/dlls-arm.7z")
if setting["TerminalOpen"]:
@@ -543,8 +543,8 @@ class RunWinetricksThread(QtCore.QThread):
wineUsingOption = ""
if o1.currentText() == "基于 box86 的 deepin-wine6-stable" or o1.currentText() == "基于 exagear 的 deepin-wine6-stable":
if not os.path.exists(f"{programPath}/dlls-arm"):
- if os.system(f"7z x \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
- QtWidgets.QMessageBox(widget, "错误", "无法解压资源")
+ if os.system(f"7z x -y \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
+ QtWidgets.QMessageBox.critical(widget, "错误", "无法解压资源")
return
os.remove(f"{programPath}/dlls-arm.7z")
if setting["TerminalOpen"]:
@@ -576,8 +576,8 @@ def RunWinetricks():
return
if o1.currentText() == "基于 box86 的 deepin-wine6-stable" or o1.currentText() == "基于 exagear 的 deepin-wine6-stable":
if not os.path.exists(f"{programPath}/dlls-arm"):
- if os.system(f"7z x \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
- QtWidgets.QMessageBox(widget, "错误", "无法解压资源")
+ if os.system(f"7z x -y \"{programPath}/dlls-arm.7z\" -o\"{programPath}\""):
+ QtWidgets.QMessageBox.critical(widget, "错误", "无法解压资源")
return
os.remove(f"{programPath}/dlls-arm.7z")
returnText.setText("")
@@ -643,8 +643,8 @@ def InstallMSXML():
def InstallDXVK():
if not os.path.exists(f"{programPath}/dxvk"):
- if os.system(f"7z x \"{programPath}/dxvk.7z\" -o\"{programPath}\""):
- QtWidgets.QMessageBox(widget, "错误", "无法解压资源")
+ if os.system(f"7z x -y \"{programPath}/dxvk.7z\" -o\"{programPath}\""):
+ QtWidgets.QMessageBox.critical(widget, "错误", "无法解压资源")
return
os.remove(f"{programPath}/dxvk.7z")
if e1.currentText() == "":
@@ -659,8 +659,8 @@ def InstallDXVK():
def UninstallDXVK():
if not os.path.exists(f"{programPath}/dxvk"):
- if os.system(f"7z x \"{programPath}/dxvk.7z\" -o\"{programPath}\""):
- QtWidgets.QMessageBox(widget, "错误", "无法解压资源")
+ if os.system(f"7z x -y \"{programPath}/dxvk.7z\" -o\"{programPath}\""):
+ QtWidgets.QMessageBox.critical(widget, "错误", "无法解压资源")
return
os.remove(f"{programPath}/dxvk.7z")
if e1.currentText() == "":
@@ -1793,36 +1793,16 @@ exe路径\' 参数 \'
千万不要中断后不删除源的情况下 apt upgrade !!!中断后只需重新打开脚本输入 repair 或者随意安装一个 Wine(会自动执行恢复操作)即可
以及此脚本安装的 Wine 无法保证 100% 能使用,以及副作用是会提示
N: 鉴于仓库 'https://community-packages.deepin.com/beige beige InRelease' 不支持 'i386' 体系结构,跳过配置文件 'main/binary-i386/Packages' 的获取。
'''
-updateThingsString = '''
一个能让Linux用户更加方便运行Windows应用的程序,内置了对wine图形化的支持和各种Wine工具和自制Wine程序打包器、运行库安装工具等等
同时也内置了基于VirtualBox制作的小白Windows虚拟机安装工具,可以做到只需要用户下载系统镜像并点击安装即可,无需顾及虚拟机安装、创建、虚拟机的分区等等
@@ -2146,8 +2126,12 @@ installDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装 D uninstallDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "卸载 DXVK")) dxvkMenu.addAction(installDxvk) dxvkMenu.addAction(uninstallDxvk) -wineOption.addSeparator() wineOption.addAction(deleteDesktopIcon) +settingWineBottleCreateLink = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "允许/禁止指定 wine 容器生成快捷方式")) +enabledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "允许指定 wine 容器生成快捷方式")) +disbledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "禁止指定 wine 容器生成快捷方式")) +settingWineBottleCreateLink.addAction(enabledWineBottleCreateLink) +settingWineBottleCreateLink.addAction(disbledWineBottleCreateLink) w1.triggered.connect(OpenWineBotton) w2.triggered.connect(InstallWineFont) w3.triggered.connect(OpenWineFontPath) @@ -2181,6 +2165,8 @@ wm4_2.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-ter installDxvk.triggered.connect(InstallDXVK) uninstallDxvk.triggered.connect(UninstallDXVK) deleteDesktopIcon.triggered.connect(DeleteDesktopIcon) +enabledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f")) +disbledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f")) virtualMachine = menu.addMenu(QtCore.QCoreApplication.translate("U", "虚拟机(&V)")) v1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用 Virtualbox 虚拟机运行 Windows 应用")) diff --git a/deb/opt/apps/deepin-wine-runner/package-script.zip b/deb/opt/apps/deepin-wine-runner/package-script.zip index d55821c..73dfbeb 100755 Binary files a/deb/opt/apps/deepin-wine-runner/package-script.zip and b/deb/opt/apps/deepin-wine-runner/package-script.zip differ diff --git a/deb/opt/apps/deepin-wine-runner/wine/installwine b/deb/opt/apps/deepin-wine-runner/wine/installwine index 2dae947..34999c1 100755 --- a/deb/opt/apps/deepin-wine-runner/wine/installwine +++ b/deb/opt/apps/deepin-wine-runner/wine/installwine @@ -15,8 +15,11 @@ import sys import json import traceback import requests +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../") +from Model import * from PyQt5 import QtCore, QtGui, QtWidgets - +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string # UI 布局(自动生成) class Ui_MainWindow(object): def setupUi(self, MainWindow): @@ -182,10 +185,11 @@ class DownloadThread(QtCore.QThread): shellFile = open("/tmp/depein-wine-runner-wine-install.sh", "w") shellFile.write(shellCommand) shellFile.close() - process = QtCore.QProcess() - command = ["deepin-terminal", "-e", "bash", "/tmp/depein-wine-runner-wine-install.sh"] - process.start(f"{programPath}/../launch.sh", command) - process.waitForFinished() + #process = QtCore.QProcess() + #command = ["deepin-terminal", "-e", "bash", "/tmp/depein-wine-runner-wine-install.sh"] + #process.start(f"{programPath}/../launch.sh", command) + #process.waitForFinished() + OpenTerminal("bash /tmp/depein-wine-runner-wine-install.sh") self.Finish.emit() except: traceback.print_exc() @@ -274,7 +278,6 @@ if __name__ == "__main__": localJsonList = [] internetJsonList = [] internetWineSource = "https://code.gitlink.org.cn/gfdgd_xi/wine-mirrors/raw/branch/master/" - programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string app = QtWidgets.QApplication(sys.argv) # 读取翻译 if not get_now_lang() == "zh_CN.UTF-8": diff --git a/deepin-wine-packager.py b/deepin-wine-packager.py index fc04b0c..809beb8 100755 --- a/deepin-wine-packager.py +++ b/deepin-wine-packager.py @@ -818,28 +818,29 @@ fi # 设置容器 ############### self.label.emit("正在设置 wine 容器") - os.chdir(programPath) - if cleanBottonByUOS.isChecked(): - self.run_command(f"WINE='{debInformation[debArch.currentIndex()]['Wine']}' '{programPath}/cleanbottle.sh' '{b}'") - os.chdir(b) - # 对用户目录进行处理 - self.run_command("sed -i \"s#$USER#@current_user@#\" ./*.reg") - os.chdir(f"{b}/drive_c/users") - if os.path.exists(f"{b}/drive_c/users/@current_user@"): - self.run_command(f"rm -rfv '{b}/drive_c/users/@current_user@'") - self.run_command(f"mv -fv '{os.getlogin()}' @current_user@") - # 如果缩放文件 scale.txt 存在,需要移除以便用户自行调节缩放设置 - if os.path.exists(f"{b}/scale.txt"): - os.remove(f"{b}/scale.txt") - # 删除因为脚本失误导致用户目录嵌套(如果存在) - if os.path.exists(f"{b}{b}/drive_c/users/@current_user@/@current_user@"): - shutil.rmtree(f"{b}{b}/drive_c/users/@current_user@/@current_user@") - # 删除无用的软链 - self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/我的'*") - self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/My '*") - self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/Desktop'") - self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/Downloads'") - self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/Templates'") + if e6_text.text()[-3: ] != ".7z": + os.chdir(programPath) + if cleanBottonByUOS.isChecked(): + self.run_command(f"WINE='{debInformation[debArch.currentIndex()]['Wine']}' '{programPath}/cleanbottle.sh' '{b}'") + os.chdir(b) + # 对用户目录进行处理 + self.run_command("sed -i \"s#$USER#@current_user@#\" ./*.reg") + os.chdir(f"{b}/drive_c/users") + if os.path.exists(f"{b}/drive_c/users/@current_user@"): + self.run_command(f"rm -rfv '{b}/drive_c/users/@current_user@'") + self.run_command(f"mv -fv '{os.getlogin()}' @current_user@") + # 如果缩放文件 scale.txt 存在,需要移除以便用户自行调节缩放设置 + if os.path.exists(f"{b}/scale.txt"): + os.remove(f"{b}/scale.txt") + # 删除因为脚本失误导致用户目录嵌套(如果存在) + if os.path.exists(f"{b}{b}/drive_c/users/@current_user@/@current_user@"): + shutil.rmtree(f"{b}{b}/drive_c/users/@current_user@/@current_user@") + # 删除无用的软链 + self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/我的'*") + self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/My '*") + self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/Desktop'") + self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/Downloads'") + self.run_command(f"rm -fv '{b}/drive_c/users/@current_user@/Templates'") os.chdir(programPath) ############### # 压缩 Wine @@ -858,8 +859,8 @@ fi ############### self.label.emit("正在打包 wine 容器") # 都有 7z 了为什么要打包呢? - if e1_text.text()[-3: ] == ".7z": - shutil.copy(e1_text.text(), f"{debPackagePath}/opt/apps/{e1_text.text()}/files/files.7z") + if e6_text.text()[-3: ] == ".7z": + shutil.copy(e6_text.text(), f"{debPackagePath}/opt/apps/{e1_text.text()}/files/files.7z") else: self.run_command("7z a {}/opt/apps/{}/files/files.7z {}/*".format(debPackagePath, e1_text.text(), b)) ############### @@ -1076,6 +1077,8 @@ def ReadDeb(unzip = False): # 获取路径 debPath = QtWidgets.QFileDialog.getOpenFileName(window, "读取 deb 包", get_home(), "deb包(*.deb);;所有文件(*.*)")[0] print(debPath) + if debPath == "": + return # 分类讨论 path = f"/tmp/deb-unzip-{random.randint(0, 1000)}" # 新建文件夹 @@ -1234,6 +1237,66 @@ def ReadDeb(unzip = False): wineVersion.setCurrentText(wineValue[dependsItem]) except: print(f"忽略行:{i}") + elif os.path.exists(f"{path}/opt/apps/{package}/files/run_with_box86.sh"): + file = open(f"{path}/opt/apps/{package}/files/run_with_box86.sh", "r") + items = file.read().splitlines() + file.close() + for i in items: + # 按行解析 + if i.replace(" ", "").replace("\n", "") == "": + # 空行,忽略 + continue + # 忽略 export + line = i.replace("export ", "") + # 忽略注释 + if "#" in line: + line = line[:line.index("#")] + # 判断是否合法 + try: + name = line[:line.index("=")].strip() + value = line[line.index("=") + 1:].replace("\"", "").strip() + #lnkMap[name].setText(value) + if name in lnkMap: + lnkMap[name].setText(value) + continue + # 其它的特殊情况判断 + if name == "START_SHELL_PATH" and value == "/opt/deepinwine/tools/spark_run_v4.sh": + # helper + chooseWineHelperValue.setChecked(True) + if name == "APPRUN_CMD" and value in wineValue: + wineVersion.setCurrentText(wineValue[dependsItem]) + except: + print(f"忽略行:{i}") + elif os.path.exists(f"{path}/opt/apps/{package}/files/run_with_exagear.sh"): + file = open(f"{path}/opt/apps/{package}/files/run_with_exagear.sh", "r") + items = file.read().splitlines() + file.close() + for i in items: + # 按行解析 + if i.replace(" ", "").replace("\n", "") == "": + # 空行,忽略 + continue + # 忽略 export + line = i.replace("export ", "") + # 忽略注释 + if "#" in line: + line = line[:line.index("#")] + # 判断是否合法 + try: + name = line[:line.index("=")].strip() + value = line[line.index("=") + 1:].replace("\"", "").strip() + #lnkMap[name].setText(value) + if name in lnkMap: + lnkMap[name].setText(value) + continue + # 其它的特殊情况判断 + if name == "START_SHELL_PATH" and value == "/opt/deepinwine/tools/spark_run_v4.sh": + # helper + chooseWineHelperValue.setChecked(True) + if name == "APPRUN_CMD" and value in wineValue: + wineVersion.setCurrentText(wineValue[dependsItem]) + except: + print(f"忽略行:{i}") diff --git a/package-script.zip b/package-script.zip index d55821c..73dfbeb 100755 Binary files a/package-script.zip and b/package-script.zip differ diff --git a/wine/installwine b/wine/installwine index 2dae947..34999c1 100755 --- a/wine/installwine +++ b/wine/installwine @@ -15,8 +15,11 @@ import sys import json import traceback import requests +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../") +from Model import * from PyQt5 import QtCore, QtGui, QtWidgets - +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string # UI 布局(自动生成) class Ui_MainWindow(object): def setupUi(self, MainWindow): @@ -182,10 +185,11 @@ class DownloadThread(QtCore.QThread): shellFile = open("/tmp/depein-wine-runner-wine-install.sh", "w") shellFile.write(shellCommand) shellFile.close() - process = QtCore.QProcess() - command = ["deepin-terminal", "-e", "bash", "/tmp/depein-wine-runner-wine-install.sh"] - process.start(f"{programPath}/../launch.sh", command) - process.waitForFinished() + #process = QtCore.QProcess() + #command = ["deepin-terminal", "-e", "bash", "/tmp/depein-wine-runner-wine-install.sh"] + #process.start(f"{programPath}/../launch.sh", command) + #process.waitForFinished() + OpenTerminal("bash /tmp/depein-wine-runner-wine-install.sh") self.Finish.emit() except: traceback.print_exc() @@ -274,7 +278,6 @@ if __name__ == "__main__": localJsonList = [] internetJsonList = [] internetWineSource = "https://code.gitlink.org.cn/gfdgd_xi/wine-mirrors/raw/branch/master/" - programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string app = QtWidgets.QApplication(sys.argv) # 读取翻译 if not get_now_lang() == "zh_CN.UTF-8":