diff --git a/Makefile b/Makefile index d62679a..173ce55 100755 --- a/Makefile +++ b/Makefile @@ -56,6 +56,7 @@ build: cp -rv AutoConfig.py deb/opt/apps/deepin-wine-runner cp -rv UI/*.py deb/opt/apps/deepin-wine-runner/UI cp -rv InstallDll.py deb/opt/apps/deepin-wine-runner + cp -rv Model deb/opt/apps/deepin-wine-runner dpkg -b deb spark-deepin-wine-runner.deb diff --git a/VM-source/VirtualMachine b/VM-source/VirtualMachine index dbad864..bae4484 100755 Binary files a/VM-source/VirtualMachine and b/VM-source/VirtualMachine differ diff --git a/VM/VirtualMachine b/VM/VirtualMachine index dbad864..bae4484 100755 Binary files a/VM/VirtualMachine and b/VM/VirtualMachine differ diff --git a/deb/DEBIAN/control b/deb/DEBIAN/control index 48a5b49..5fe8ee9 100755 --- a/deb/DEBIAN/control +++ b/deb/DEBIAN/control @@ -1,5 +1,5 @@ Package: spark-deepin-wine-runner -Version: 2.1.0 +Version: 2.1.0-1 Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿布呢 Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner Architecture: all @@ -8,9 +8,14 @@ Depends: python3, python3-pil, python3-pil.imagetk, python3-pyquery, deepin-term Section: utils Conflicts: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer, spark-deepin-wine-runner-52 Replaces: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer, spark-deepin-wine-runner-52 -Installed-Size: 24928 +Installed-Size: 24948 Description: gfdgd xi、为什么您不喜欢熊出没和阿布呢 制作的 wine 运行器 - 更新内容: + 2.1.0-1 更新内容: + ※1、删除多余图标 + ※2、修复将打包文件生成目录设置为 / 等重要目录导致删库的问题 + 3、修复了打包器浏览按钮闪退、生成的 postrm 有误的问题 + 4、支持在输入信息时自动生成 deb 保存路径 + 2.1.0 更新内容: ※1、新增新的 Wine 安装器,并支持将安装的 Wine 打包到 Wine 程序 deb 包中 ※2、Wine 打包器打包 Windows 应用支持将 Wine 打包入 deb 内,可以不依赖 Wine(一般不推荐把 Wine 打包入内,推荐用依赖的形式),并支持设置自定义依赖和生成模板 ※3、开始初步多语言支持 diff --git a/deb/DEBIAN/postinst b/deb/DEBIAN/postinst index 5bd25e6..096cfe3 100755 --- a/deb/DEBIAN/postinst +++ b/deb/DEBIAN/postinst @@ -23,4 +23,4 @@ fi # 设置目录权限,让用户可读可写,方便后续删除组件 chmod 777 -R /opt/apps/deepin-wine-runner # 向服务器返回安装数加1(不显示内容且忽略错误) -curl https://304626p927.goho.co/spark-deepin-wine-runner/Install.php?Version=2.1.0 -s > /dev/null | true +curl https://304626p927.goho.co/spark-deepin-wine-runner/Install.php?Version=2.1.0-1 -s > /dev/null | true diff --git a/deb/opt/apps/deepin-wine-runner/AppStore.py b/deb/opt/apps/deepin-wine-runner/AppStore.py index da4fddb..db583ae 100755 --- a/deb/opt/apps/deepin-wine-runner/AppStore.py +++ b/deb/opt/apps/deepin-wine-runner/AppStore.py @@ -19,6 +19,15 @@ import urllib.parse as parse def CleanTerminal(): os.system("clear") + print(''' + mm mmmm m + ## mmmm mmmm #" " mm#mm mmm m mm mmm + # # #" "# #" "# "#mmm # #" "# #" " #" # + #mm# # # # # "# # # # # #"""" + # # ##m#" ##m#" "mmm#" "mm "#m#" # "#mm" + # # + " " +''') print("本软件源来自腾讯软件管家,只会下载文件后缀为“.exe”的文件") print("请输入要搜索的内容,如果要结束,请输入“exit”或点击右上角“×”关闭") print("无法保证从这里下载的安装包能正常安装/运行") @@ -37,15 +46,6 @@ if __name__ == "__main__": sys.exit() CleanTerminal() - print(''' - mm mmmm m - ## mmmm mmmm #" " mm#mm mmm m mm mmm - # # #" "# #" "# "#mmm # #" "# #" " #" # - #mm# # # # # "# # # # # #"""" - # # ##m#" ##m#" "mmm#" "mm "#m#" # "#mm" - # # - " " -''') while True: search = input(">") if search.replace(" ", "").replace("\n", "") == "": @@ -54,7 +54,12 @@ if __name__ == "__main__": break # 结束程序 # 获取初步 API - apiReturn = json.loads(requests.get(f"https://s.pcmgr.qq.com/tapi/web/searchcgi.php?type=search&callback=searchCallback&keyword={parse.quote(search)}&page=1&pernum=30").text[:-2][15:]) + try: + apiReturn = json.loads(requests.get(f"https://s.pcmgr.qq.com/tapi/web/searchcgi.php?type=search&callback=searchCallback&keyword={parse.quote(search)}&page=1&pernum=30").text[:-2][15:]) + except: + input("无法连接服务器,按回车键继续") + CleanTerminal() + continue option = 0 downloadUrl = [] if not "list" in apiReturn: diff --git a/deb/opt/apps/deepin-wine-runner/AutoConfig.py b/deb/opt/apps/deepin-wine-runner/AutoConfig.py index 87909ea..bbac29e 100755 --- a/deb/opt/apps/deepin-wine-runner/AutoConfig.py +++ b/deb/opt/apps/deepin-wine-runner/AutoConfig.py @@ -17,6 +17,7 @@ import traceback import requests import PyQt5.QtWidgets as QtWidgets from UI.AutoConfig import * +from Model import * urlSources = "https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/auto" lists = [] @@ -60,18 +61,20 @@ class Connect: QtWidgets.QMessageBox.critical(window, "错误", "无法获取配置文件") 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", "--system"]) - process.waitForFinished() + OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/ConfigLanguareRunner.py' '/tmp/wine-runner-auto-config.wsh' --system") + #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", "--system"]) + #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], "--system"]) - process.waitForFinished() + OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/ConfigLanguareRunner.py' '{path[0]}' --system") + #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], "--system"]) + #process.waitForFinished() # 读取文本文档 def readtxt(path): diff --git a/deb/opt/apps/deepin-wine-runner/ConfigLanguareRunner.py b/deb/opt/apps/deepin-wine-runner/ConfigLanguareRunner.py index a6611ab..534c04c 100755 --- a/deb/opt/apps/deepin-wine-runner/ConfigLanguareRunner.py +++ b/deb/opt/apps/deepin-wine-runner/ConfigLanguareRunner.py @@ -11,6 +11,7 @@ import os import sys import time import json +import platform import traceback import PyQt5.QtWidgets as QtWidgets # 读取文本文档 @@ -36,7 +37,9 @@ programEnv = [ ["($THANK)", thankText], ["($MAKER)", "gfdgd xi、为什么您不喜欢熊出没和阿布呢"], ["($COPYRIGHT)", f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢"], - ["($?)", "0"] + ["($?)", "0"], + ["($PLATFORM)", platform.system()], + ["($DEBUG)", str(int("--debug" in sys.argv))] ] readOnlyEnv = [ "($DANGER)", @@ -46,8 +49,13 @@ readOnlyEnv = [ "($THANK)", "($MAKER)", "($COPYRIGHT)", - "($?)" + "($?)", + "($SYSTEM)", + "($DEBUG)" ] +def Debug(): + if "--debug" in sys.argv: + traceback.print_exc() class Command(): # 有风险的命令 @@ -86,7 +94,8 @@ class Command(): "winecfg", "winver", "changeversion", - "stopdll" + "stopdll", + "cat" ] def __init__(self, commandString: str) -> None: @@ -237,6 +246,10 @@ class Command(): return os.system(command) def Bat(self) -> int: + # Windows 直接转换为以 cmd 运行 + if platform.system() == "Windows": + # 直接调用 Bash 函数 + return self.Bash() command = ["WINEPREFIX='($WINEPREFIX)'", "($WINE)"] for i in programEnv: for k in range(len(command)): @@ -298,6 +311,15 @@ class Command(): self.command = ["reg", f"z:/{programPath}/ChangeWineBottonVersion/{self.command[1]}.reg"] return self.Reg() + def Cat(self): + try: + file = open(self.command[1], "r") + print(file.read()) + file.close() + except: + print("文件读取错误") + Debug() + # 可以运行的命令的映射关系 # 可以被使用的命令的映射 commandList = { @@ -328,7 +350,8 @@ class Command(): "winecfg": Winecfg, "winver": Winver, "changeversion": ChangeVersion, - "stopdll": StopDll + "stopdll": StopDll, + "cat": Cat } # 参数数列表 @@ -360,9 +383,23 @@ class Command(): "winecfg": [0], "winver": [0], "changeversion": [1], - "stopdll": [1] + "stopdll": [1], + "cat": [1] } - + windowsUnrun = [ + "createbotton", + "installdll", + "installmono", + "installgecko", + "winecfg", + "stopdll", + "changeversion", + "enabledopengl", + "disbledopengl", + "installdxvk", + "installfont", + "installsparkcorefont" + ] # 解析 def __init__(self, command: list, wineBottonPath: str, wine: str) -> int: self.wineBottonPath = wineBottonPath @@ -389,6 +426,11 @@ class Command(): # 添加变量 programEnv.append([f"{env}", value]) continue + # 解析命令是否可以在 Windows 使用(只限在 Windows 系统时) + if platform.system() == "Windows" and i[0] in self.windowsUnrun: + print("此命令不支持在 Windows 上运行") + programEnv[9][1] = "-5" + continue # 正常命令解析 if len(i) -1 < self.commandInfo[i[0]][0]: print("参数不足") @@ -409,6 +451,8 @@ class Command(): if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) optionAll = 0 + if "--debug" in sys.argv: + optionAll += 1 if "--system" in sys.argv: programEnv[2][1] = "1" optionAll += 1 diff --git a/deb/opt/apps/deepin-wine-runner/InstallDll.py b/deb/opt/apps/deepin-wine-runner/InstallDll.py index b299773..fb99d7d 100755 --- a/deb/opt/apps/deepin-wine-runner/InstallDll.py +++ b/deb/opt/apps/deepin-wine-runner/InstallDll.py @@ -15,6 +15,11 @@ import sys import json import traceback import requests +def exit(): + if __name__ == "__main__": + input("按回车键退出") + sys.exit() + sys.exit() # 获取云列表 url = "https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/dlls" print("获取列表中……", end="") diff --git a/deb/opt/apps/deepin-wine-runner/InstallFont.py b/deb/opt/apps/deepin-wine-runner/InstallFont.py index bb94430..94689ed 100755 --- a/deb/opt/apps/deepin-wine-runner/InstallFont.py +++ b/deb/opt/apps/deepin-wine-runner/InstallFont.py @@ -86,5 +86,8 @@ if __name__ == "__main__": os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/font' -o '{fontList[choose][0]}' \"{fontList[choose][1]}\"") if os.path.exists(f"{sys.argv[1]}/drive_c/windows/Fonts/{fontList[choose][2]}"): print("字体已存在,覆盖") - shutil.copy(f"{homePath}/.cache/deepin-wine-runner/font/{fontList[choose][0]}", f"{sys.argv[1]}/drive_c/windows/Fonts/{fontList[choose][2]}") + try: + shutil.copy(f"{homePath}/.cache/deepin-wine-runner/font/{fontList[choose][0]}", f"{sys.argv[1]}/drive_c/windows/Fonts/{fontList[choose][2]}") + except: + print("拷贝失败!") input("安装结束,按回车键继续") \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/LANG/InstallDll.py b/deb/opt/apps/deepin-wine-runner/LANG/InstallDll.py index b299773..fb99d7d 100755 --- a/deb/opt/apps/deepin-wine-runner/LANG/InstallDll.py +++ b/deb/opt/apps/deepin-wine-runner/LANG/InstallDll.py @@ -15,6 +15,11 @@ import sys import json import traceback import requests +def exit(): + if __name__ == "__main__": + input("按回车键退出") + sys.exit() + sys.exit() # 获取云列表 url = "https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/dlls" print("获取列表中……", end="") diff --git a/deb/opt/apps/deepin-wine-runner/Model/__init__.py b/deb/opt/apps/deepin-wine-runner/Model/__init__.py new file mode 100644 index 0000000..5373bf0 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/Model/__init__.py @@ -0,0 +1,31 @@ +import os +def OpenTerminal(command): + if terminalEnd[terminal][1]: + os.system(f"\"{terminal}\" \"{terminalEnd[terminal][0]}\" \"{command}\"") + return + os.system(f"\"{terminal}\" \"{terminalEnd[terminal][0]}\" {command}") +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +# 对终端的获取 +# 为什么 openkylin 只有 mate-terminal +# 优先为深度终端 +terminal = "" +terminalList = [ + "deepin-terminal1", + "mate-terminal1", + "gnome-terminal" +] +terminalEnd = { + f"{programPath}/launch.sh\" \"deepin-terminal": ["-e", 0], + "mate-terminal": ["-e", 1], + "gnome-terminal": ["--", 0] +} +for i in terminalList: + if not os.system(f"which {i}"): + if i == "deepin-terminal": + i = f"{programPath}/launch.sh\" \"deepin-terminal" + terminal = i + break +if terminal == "": + print("无法识别到以下的任意一个终端") + print(" ".join(terminalList)) + exit() \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/Model/__pycache__/__init__.cpython-37.pyc b/deb/opt/apps/deepin-wine-runner/Model/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..647b21f Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/Model/__pycache__/__init__.cpython-37.pyc differ diff --git a/deb/opt/apps/deepin-wine-runner/VM/VirtualMachine b/deb/opt/apps/deepin-wine-runner/VM/VirtualMachine index dbad864..bae4484 100755 Binary files a/deb/opt/apps/deepin-wine-runner/VM/VirtualMachine and b/deb/opt/apps/deepin-wine-runner/VM/VirtualMachine differ diff --git a/deb/opt/apps/deepin-wine-runner/deepin-wine-packager.py b/deb/opt/apps/deepin-wine-runner/deepin-wine-packager.py index 664b26a..404ee51 100755 --- a/deb/opt/apps/deepin-wine-runner/deepin-wine-packager.py +++ b/deb/opt/apps/deepin-wine-runner/deepin-wine-packager.py @@ -27,7 +27,7 @@ import PyQt5.QtWidgets as QtWidgets ################# def button1_cl(): - path = QtWidgets.QFileDialog.getExistingDirectory(QtCore.QCoreApplication.translate("U", "选择 wine 容器"), f"{get_home()}/.deepinwine") + path = QtWidgets.QFileDialog.getExistingDirectory(widget, QtCore.QCoreApplication.translate("U", "选择 wine 容器"), f"{get_home()}/.deepinwine") if path != "": e6_text.setText(path) @@ -207,7 +207,7 @@ class make_deb_threading(QtCore.QThread): f"{wine[wineVersion.currentText()]}, spark-dwine-helper (>= 1.6.2), fonts-wqy-microhei, fonts-wqy-zenhei" ][int(chooseWineHelperValue.isChecked())], "postinst": "", - "postrm": ["", f"""#!/bin/bash.. + "postrm": ["", f"""#!/bin/bash if [ "$1" = "remove" ] || [ "$1" = "purge" ];then @@ -345,12 +345,12 @@ fi ##############<<<<<<<<<屏蔽mono和gecko安装器开始 ##默认屏蔽mono和gecko安装器 -if [ "$APPRUN_CMD" = "spark-wine7-devel" ];then +#if [ "$APPRUN_CMD" = "spark-wine7-devel" ];then -export WINEDLLOVERRIDES="mscoree,mshtml=" -echo "为了降低打包体积,默认关闭gecko和momo,如有需要,注释此行(仅对spark-wine7-devel有效)" +#export WINEDLLOVERRIDES="mscoree,mshtml=" +#echo "为了降低打包体积,默认关闭gecko和momo,如有需要,注释此行(仅对spark-wine7-devel有效)" -fi +#fi ##############>>>>>>>>>屏蔽mono和gecko安装器结束 #########################执行段 @@ -781,7 +781,11 @@ fi debPackagePath = f"/tmp/{random.randint(0, 9999)}" #self.run_command(f"rm -rfv /tmp/{debPackagePath}") print("f") - self.run_command(f"rm -rfv '{debPackagePath}'") + # 为了避免删库,必须保证是 deb 文件构建目录才进行清空 + if os.path.exists(f"{debPackagePath}/DEBIAN/control"): + self.run_command(f"rm -rfv '{debPackagePath}/usr'") + self.run_command(f"rm -rfv '{debPackagePath}/opt'") + self.run_command(f"rm -rfv '{debPackagePath}/DEBIAN'") print("d") ############### # 创建目录 @@ -928,6 +932,8 @@ Description: {e3_text.text()} self.label.emit("完成构建!") self.disabled_or_NORMAL_all.emit(True) self.infoMsg.emit("打包完毕!") + global change + change = False except: traceback.print_exc() self.errorMsg.emit("程序出现错误,错误信息:\n{}".format(traceback.format_exc())) @@ -1018,6 +1024,37 @@ def ChangeWine(): debDepends.setText("libasound2 (>= 1.0.16), libc6 (>= 2.28), libglib2.0-0 (>= 2.12.0), libgphoto2-6 (>= 2.5.10), libgphoto2-port12 (>= 2.5.10), libgstreamer-plugins-base1.0-0 (>= 1.0.0), libgstreamer1.0-0 (>= 1.4.0), liblcms2-2 (>= 2.2+git20110628), libldap-2.4-2 (>= 2.4.7), libmpg123-0 (>= 1.13.7), libopenal1 (>= 1.14), libpcap0.8 (>= 0.9.8), libpulse0 (>= 0.99.1), libudev1 (>= 183), libvkd3d1 (>= 1.0), libx11-6, libxext6, libxml2 (>= 2.9.0), ocl-icd-libopencl1 | libopencl1, udis86, zlib1g (>= 1:1.1.4), libasound2-plugins, libncurses6 | libncurses5 | libncurses, deepin-wine-plugin-virtual") debRecommend.setText("libcapi20-3, libcups2, libdbus-1-3, libfontconfig1, libfreetype6, libglu1-mesa | libglu1, libgnutls30 | libgnutls28 | libgnutls26, libgsm1, libgssapi-krb5-2, libjpeg62-turbo | libjpeg8, libkrb5-3, libodbc1, libosmesa6, libpng16-16 | libpng12-0, libsane | libsane1, libsdl2-2.0-0, libtiff5, libv4l-0, libxcomposite1, libxcursor1, libxfixes3, libxi6, libxinerama1, libxrandr2, libxrender1, libxslt1.1, libxxf86vm1") +# 获取用户桌面目录 +def get_desktop_path(): + for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件 + desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1 + if desktop_index != -1: # 如果有对应项 + break # 结束循环 + if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1 + return -1 + else: + get = line[17:-2] # 截取桌面目录路径 + get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容 + if get != -1: # 如果有 + get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~) + return get # 返回目录 + +change = False +autoChange = True # 有第一次的路径自动设置 +def AutoPathSet(): + global autoChange + autoChange = True + architecture = ["i386", "arm64", "arm64"] + if not change: + e12_text.setText(f"{get_desktop_path()}/{e1_text.text()}_{e2_text.text()}_{architecture[debArch.currentIndex()]}.deb") + +def UserPathSet(): + global change + global autoChange + if autoChange: + autoChange = False + return + change = True ############### # 程序信息 @@ -1107,7 +1144,6 @@ button5.clicked.connect(make_deb) buildDebDir.clicked.connect(lambda: make_deb(True)) installDeb.clicked.connect(InstallDeb) wineFrame.addWidget(wineVersion) -debArch.currentIndexChanged.connect(ChangeArchCombobox) # 创建控件 widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的包名(※必填):")), 0, 0, 1, 1) widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的版本号(※必填):")), 1, 0, 1, 1) @@ -1173,6 +1209,11 @@ widgetLayout.addWidget(buildDebDir, 16, 3) useInstallWineArch.setDisabled(True) wineVersion.currentTextChanged.connect(ChangeWine) chooseWineHelperValue.stateChanged.connect(ChangeWine) +e1_text.textChanged.connect(AutoPathSet) +e2_text.textChanged.connect(AutoPathSet) +debArch.currentIndexChanged.connect(AutoPathSet) +debArch.currentIndexChanged.connect(ChangeArchCombobox) +e12_text.textChanged.connect(UserPathSet) # 菜单栏 menu = window.menuBar() programmenu = menu.addMenu(QtCore.QCoreApplication.translate("U", "程序")) @@ -1190,6 +1231,7 @@ try: wineVersion.setCurrentText(sys.argv[2]) except: pass +e12_text.setText(f"{get_desktop_path()}/demo_1.0.0_i386.deb") widget.setLayout(widgetLayout) window.setCentralWidget(widget) window.setWindowTitle(f"wine 应用打包器 {version}") diff --git a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner index 86d680b..c88d8b5 100755 --- a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner +++ b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner @@ -1,12 +1,12 @@ #!/usr/bin/env python3 # 使用系统默认的 python3 运行 -########################################################################################### +################################################################################################################# # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 # 版本:2.0.0 # 更新时间:2022年08月12日 # 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序 # 基于 Python3 的 PyQt5 构建 -########################################################################################### +################################################################################################################# ################# # 引入所需的库 ################# @@ -26,6 +26,7 @@ import urllib.parse as parse import PyQt5.QtGui as QtGui import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets +from Model import * ################### # 程序所需事件 ################### @@ -158,18 +159,21 @@ class Runexebutton_threading(QtCore.QThread): return os.remove(f"{programPath}/dlls-arm.7z") if setting["TerminalOpen"]: - res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"] + "\" --keep-open" + wineUsingOption], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + res = "" + OpenTerminal("env WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"]) + #res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"] + "\" --keep-open" + wineUsingOption], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) else: res = subprocess.Popen(["WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"]], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # 实时读取程序返回 # - while res.poll() is None: - try: - text = res.stdout.readline().decode("utf8") - except: - text = "" - self.signal.emit(text) - print(text, end="") + if not setting["TerminalOpen"]: + while res.poll() is None: + try: + text = res.stdout.readline().decode("utf8") + except: + text = "" + self.signal.emit(text) + print(text, end="") if len(findExeHistory) == 0 or findExeHistory[-1] != wineBottonPath: findExeHistory.append(wineBottonPath) # 将记录写进数组 write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", str(json.dumps(ListToDictionary(findExeHistory)))) # 将历史记录的数组转换为字典并写入 @@ -352,13 +356,13 @@ def KillProgram(): os.system("killall winedbg -9") def InstallWine(): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e \"{programPath}/AllInstall.py\""]).start() + threading.Thread(target=OpenTerminal, args=[f"'{programPath}/AllInstall.py'"]).start() def InstallWineOnDeepin23(): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e \"{programPath}/InstallWineOnDeepin23.py\""]).start() + threading.Thread(target=OpenTerminal, args=[f"'{programPath}/InstallWineOnDeepin23.py'"]).start() def InstallWineHQ(): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e \"{programPath}/InstallNewWineHQ.sh\""]).start() + threading.Thread(target=OpenTerminal, args=[f"{programPath}/InstallNewWineHQ.sh"]).start() def OpenWineBotton(): if e1.currentText() == "": @@ -408,17 +412,20 @@ class RunWineProgramThread(QtCore.QThread): return os.remove(f"{programPath}/dlls-arm.7z") if setting["TerminalOpen"]: - res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + self.wineProgram + "' " + setting["WineOption"] + " " + wineUsingOption + "\" --keep-open"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + res = "" + OpenTerminal(f"env WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + self.wineProgram + "' " + setting["WineOption"] + " " + wineUsingOption) + #res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + self.wineProgram + "' " + setting["WineOption"] + " " + wineUsingOption + "\" --keep-open"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) else: res = subprocess.Popen(["WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + self.wineProgram + "' " + setting["WineOption"]], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # 实时读取程序返回 - while res.poll() is None: - try: - text = res.stdout.readline().decode("utf8") - except: - text = "" - self.signal.emit(text) - print(text, end="") + if not setting["TerminalOpen"]: + while res.poll() is None: + try: + text = res.stdout.readline().decode("utf8") + except: + text = "" + self.signal.emit(text) + print(text, end="") if self.history: if len(findExeHistory) == 0 or findExeHistory[-1] != wineBottonPath: findExeHistory.append(wineBottonPath) # 将记录写进数组 @@ -469,7 +476,10 @@ class RunWinetricksThread(QtCore.QThread): return os.remove(f"{programPath}/dlls-arm.7z") if setting["TerminalOpen"]: - res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='{wineBottonPath}' {option} WINE=" + subprocess.getoutput(f"which {wine[o1.currentText()]}").replace(" ", "").replace("\n", "") + f" winetricks --gui {wineUsingOption}\" --keep-open"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + res = "" + # 用终端开应该不用返回输出内容了 + OpenTerminal(f"WINEPREFIX='{wineBottonPath}' {option} WINE=" + subprocess.getoutput(f"which {wine[o1.currentText()]}").replace(" ", "").replace("\n", "") + f" winetricks --gui {wineUsingOption}") + #res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='{wineBottonPath}' {option} WINE=" + subprocess.getoutput(f"which {wine[o1.currentText()]}").replace(" ", "").replace("\n", "") + f" winetricks --gui {wineUsingOption}\" --keep-open"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) else: res = subprocess.Popen([f"WINEPREFIX='{wineBottonPath}' {option} WINE='" + subprocess.getoutput(f"which {wine[o1.currentText()]}").replace(" ", "").replace("\n", "") + "' winetricks --gui"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # 实时读取程序返回 @@ -506,21 +516,21 @@ def CleanWineBottonByUOS(): wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"WINE='{wine[o1.currentText()]}' '{programPath}/cleanbottle.sh' '{wineBottonPath}'; echo 按回车退出; read; read; exit;\"") + OpenTerminal(f"env WINE='{wine[o1.currentText()]}' '{programPath}/cleanbottle.sh' '{wineBottonPath}'") def FontAppStore(): if e1.currentText() == "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"WINE='{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallFont.py' '{wineBottonPath}' {int(setting['RuntimeCache'])}") + OpenTerminal(f"env WINE='{programPath}/launch.sh' '{programPath}/InstallFont.py' '{wineBottonPath}' {int(setting['RuntimeCache'])}") def GetDllFromInternet(): if e1.currentText() == "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"WINE='{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallDll.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") + OpenTerminal(f"env WINE='{programPath}/launch.sh' '{programPath}/InstallDll.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") def WineBottonAutoConfig(): if e1.currentText() == "": @@ -534,28 +544,28 @@ def InstallMonoGecko(program): wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallMono.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {program} {int(setting['RuntimeCache'])}") + OpenTerminal(f"'{programPath}/InstallMono.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {program} {int(setting['RuntimeCache'])}") def InstallNetFramework(): if e1.currentText() == "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallNetFramework.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") + OpenTerminal(f"'{programPath}/InstallNetFramework.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") def InstallVisualStudioCPlusPlus(): if e1.currentText() == "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallVisualCPlusPlus.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") + OpenTerminal(f"'{programPath}/InstallVisualCPlusPlus.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") def InstallMSXML(): if e1.currentText() == "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallMsxml.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") + OpenTerminal(f"'{programPath}/InstallMsxml.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") def InstallDXVK(): if not os.path.exists(f"{programPath}/dxvk"): @@ -567,10 +577,11 @@ def InstallDXVK(): wineBottonPath = setting["DefultBotton"] else: 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}", "bash", - f"{programPath}/dxvk/setup_dxvk.sh", "install"]) + OpenTerminal(f"env WINE='{wine[o1.currentText()]}' WINE64='{wine[o1.currentText()]}' WINEPREFIX='{wineBottonPath}' '{programPath}/dxvk/setup_dxvk.sh' install") + #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}", "bash", + #f"{programPath}/dxvk/setup_dxvk.sh", "install"]) def UninstallDXVK(): if not os.path.exists(f"{programPath}/dxvk"): @@ -582,24 +593,25 @@ def UninstallDXVK(): wineBottonPath = setting["DefultBotton"] else: 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}", - f"{programPath}/dxvk/setup_dxvk.sh", "uninstall"]) + OpenTerminal(f"env WINE='{wine[o1.currentText()]}' WINE64='{wine[o1.currentText()]}' WINEPREFIX='{wineBottonPath}' '{programPath}/dxvk/setup_dxvk.sh' uninstall") + #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}", + #f"{programPath}/dxvk/setup_dxvk.sh", "uninstall"]) def MiniAppStore(): if e1.currentText()== "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/AppStore.py' '{wineBottonPath}' '{wine[o1.currentText()]}'") + OpenTerminal(f"'{programPath}/AppStore.py' '{wineBottonPath}' '{wine[o1.currentText()]}'") def InstallOther(): if e1.currentText()== "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallOther.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") + OpenTerminal(f"'{programPath}/InstallOther.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") def BuildExeDeb(): if e1.currentText() == "": @@ -629,7 +641,7 @@ def SetDeepinFileDialogDefult(): QtWidgets.QMessageBox.information(widget, "提示", "设置完成!") def SetDeepinFileDialogRecovery(): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec \"{programPath}/deepin-wine-venturi-setter.py\" recovery' --keep-open"]).start() + threading.Thread(target=OpenTerminal, args=[f"pkexec '{programPath}/deepin-wine-venturi-setter.py' recovery"]).start() def DeleteDesktopIcon(): if os.path.exists(f"{get_home()}/.local/share/applications/wine"): @@ -662,13 +674,13 @@ def ThankWindow(): def InstallWineFont(): # 筛选 apt if not os.system("which aptss"): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo aptss install ms-core-fonts -y' --keep-open"]).start() + threading.Thread(target=OpenTerminal, args=[f"sudo aptss install ms-core-fonts -y"]).start() elif not os.system("which ss-apt-fast"): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo ss-apt-fast update && sudo ss-apt-fast install ms-core-fonts -y' --keep-open"]).start() + threading.Thread(target=OpenTerminal, args=[f"sudo ss-apt-fast install ms-core-fonts -y"]).start() elif not os.system("which apt-fast"): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo apt-fast install ms-core-fonts -y' --keep-open"]).start() + threading.Thread(target=OpenTerminal, args=[f"sudo apt-fast install ms-core-fonts -y"]).start() else: - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo apt install ms-core-fonts -y' --keep-open"]).start() + threading.Thread(target=OpenTerminal, args=[f"sudo apt install ms-core-fonts -y"]).start() def WineRunnerBugUpload(): threading.Thread(target=os.system, args=[f"'{programPath}/deepin-wine-runner-update-bug'"]).start() @@ -707,7 +719,7 @@ def RunVM(): threading.Thread(target=os.system, args=[f"bash '{programPath}/RunVM.sh'"]).start() def CleanProgram(): - os.system(f"'{programPath}/launch.sh' deepin-terminal -e \"{programPath}/clean-unuse-program.py\"") + OpenTerminal(f"{programPath}/clean-unuse-program.py") class UpdateWindow(): data = {} @@ -723,7 +735,7 @@ class UpdateWindow(): cancel = QtWidgets.QPushButton("取消") cancel.clicked.connect(UpdateWindow.update.close) try: - UpdateWindow.data = json.loads(requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci91cGRhdGUuanNvbg==").decode("utf-8")).text) + UpdateWindow.data = json.loads(requests.get(base64.b64decode("aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL3VwZGF0ZS5qc29u").decode("utf-8")).text) versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:{UpdateWindow.data['Version']}\n更新内容:") if UpdateWindow.data["Version"] == version: updateText.setText(QtCore.QCoreApplication.translate("U", "此为最新版本,无需更新")) @@ -766,7 +778,7 @@ zenity --info --text=\"更新完毕!\" --ellipsize except: traceback.print_exc() QtWidgets.QMessageBox.critical(None, "出现错误,无法继续更新", traceback.format_exc()) - os.system(f"'{programPath}/launch.sh' deepin-terminal -e pkexec bash /tmp/spark-deepin-wine-runner/update.sh") + OpenTerminal("pkexec bash /tmp/spark-deepin-wine-runner/update.sh") class GetDllFromWindowsISO: wineBottonPath = get_home() + "/.wine" @@ -967,8 +979,8 @@ class ProgramRunStatusShow(): return try: sha = ProgramRunStatusUpload.GetSHA1(e2.currentText()) - lists = json.loads(requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9hcHAv").decode("utf-8") + sha + base64.b64decode("L2FsbC5qc29u").decode("utf-8")).text) - r = requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9hcHAv").decode("utf-8") + sha + base64.b64decode("L3RpdGxlLnR4dA==").decode("utf-8")) + lists = json.loads(requests.get(base64.b64decode("aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL2FwcC8=").decode("utf-8") + sha + base64.b64decode("L2FsbC5qc29u").decode("utf-8")).text) + r = requests.get(base64.b64decode("aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL2FwcC8=").decode("utf-8") + sha + base64.b64decode("L3RpdGxlLnR4dA==").decode("utf-8")) r.encoding = "utf-8" title = r.text except: @@ -1085,7 +1097,7 @@ class ProgramRunStatusUpload(): try: if ProgramRunStatusUpload.sha1Value == "": ProgramRunStatusUpload.sha1Value = ProgramRunStatusUpload.GetSHA1(e2.currentText()) - QtWidgets.QMessageBox.information(None, QtCore.QCoreApplication.translate("U", "提示"), json.loads(requests.post(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0OjMwMjUw").decode("utf-8"), { + QtWidgets.QMessageBox.information(None, QtCore.QCoreApplication.translate("U", "提示"), json.loads(requests.post(base64.b64decode("aHR0cDovL2dmZGdkeGkucWljcC52aXA6Mjc1MDI=").decode("utf-8"), { "SHA1": ProgramRunStatusUpload.sha1Value, "Name": ProgramRunStatusUpload.programName.text(), "Fen": ProgramRunStatusUpload.fen.currentIndex(), @@ -1210,6 +1222,8 @@ class ProgramSetting(): return QtWidgets.QMessageBox.information(ProgramSetting.message, "提示", "保存完毕!") + + ########################### # 加载配置 ########################### @@ -1360,7 +1374,13 @@ exe路径\' 参数 \' 千万不要中断后不删除源的情况下 apt upgrade !!!中断后只需重新打开脚本输入 repair 或者随意安装一个 Wine(会自动执行恢复操作)即可 以及此脚本安装的 Wine 无法保证 100% 能使用,以及副作用是会提示 N: 鉴于仓库 'https://community-packages.deepin.com/beige beige InRelease' 不支持 'i386' 体系结构,跳过配置文件 'main/binary-i386/Packages' 的获取。''' -updateThingsString = '''※1、新增新的 Wine 安装器,并支持将安装的 Wine 打包到 Wine 程序 deb 包中 +updateThingsString = '''

2.1.0-1 更新内容:

+※1、删除多余图标 +※2、修复将打包文件生成目录设置为 / 等重要目录导致删库的问题 +3、修复了打包器浏览按钮闪退、生成的 postrm 有误的问题 +4、支持在输入信息时自动生成 deb 保存路径 +

2.1.0 更新内容:

+※1、新增新的 Wine 安装器,并支持将安装的 Wine 打包到 Wine 程序 deb 包中 ※2、Wine 打包器打包 Windows 应用支持将 Wine 打包入 deb 内,可以不依赖 Wine(一般不推荐把 Wine 打包入内,推荐用依赖的形式),并支持设置自定义依赖和生成模板 ※3、开始初步多语言支持 ※4、修复了在没有安装任何 Wine 的情况下使用高级功能导致程序闪退的问题 @@ -1375,7 +1395,7 @@ updateThingsString = '''※1、新增新的 Wine 安装器,并支持将安 ''' for i in information["Thank"]: thankText += f"{i}\n" -updateTime = "2022年08月26日" +updateTime = "2022年09月03日" about = f'''

关于

一个能让Linux用户更加方便运行Windows应用的程序,内置了对wine图形化的支持和各种Wine工具和自制Wine程序打包器、运行库安装工具等等

同时也内置了基于VirtualBox制作的小白Windows虚拟机安装工具,可以做到只需要用户下载系统镜像并点击安装即可,无需顾及虚拟机安装、创建、虚拟机的分区等等

@@ -1406,11 +1426,12 @@ Qt 版本:{QtCore.qVersion()} title = "Wine 运行器 {}".format(version) updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) try: - threading.Thread(target=requests.get, args=[parse.unquote(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9vcGVuL0luc3RhbGwucGhw").decode("utf-8")) + "?Version=" + version]).start() + threading.Thread(target=requests.get, args=[parse.unquote(base64.b64decode("aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL29wZW4vSW5zdGFsbC5waHA=").decode("utf-8")) + "?Version=" + version]).start() except: pass + ########################### # 窗口创建 ########################### @@ -1728,6 +1749,7 @@ s2.triggered.connect(lambda: webbrowser.open_new_tab("https://s.threatbook.cn/") s3.triggered.connect(lambda: webbrowser.open_new_tab("https://www.virustotal.com/")) help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助(&H)")) +runStatusWebSize = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询程序在 Wine 的运行情况")) h1 = help.addMenu(QtCore.QCoreApplication.translate("U", "程序官网")) h2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "小提示")) h3 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "更新内容")) @@ -1749,6 +1771,8 @@ h1.addAction(gitlink) h1.addAction(gitlab) h1.addAction(jihu) help.addSeparator() +help.addAction(runStatusWebSize) +help.addSeparator() help.addAction(h2) help.addAction(h3) help.addAction(h4) @@ -1773,6 +1797,7 @@ github.triggered.connect(lambda: webbrowser.open_new_tab("https://github.com/gfd gitlink.triggered.connect(lambda: webbrowser.open_new_tab("https://gitlink.org.cn/gfdgd_xi/deep-wine-runner")) gitlab.triggered.connect(lambda: webbrowser.open_new_tab("https://gitlab.com/gfdgd-xi/deep-wine-runner")) jihu.triggered.connect(lambda: webbrowser.open_new_tab("https://jihulab.com//gfdgd-xi/deep-wine-runner")) +runStatusWebSize.triggered.connect(lambda: webbrowser.open_new_tab("https://gfdgd-xi.github.io/wine-runner-info")) h2.triggered.connect(helps) h3.triggered.connect(UpdateThings) h4.triggered.connect(ThankWindow) diff --git a/deb/opt/apps/deepin-wine-runner/information.json b/deb/opt/apps/deepin-wine-runner/information.json index b36c36f..e065b87 100755 --- a/deb/opt/apps/deepin-wine-runner/information.json +++ b/deb/opt/apps/deepin-wine-runner/information.json @@ -1,5 +1,5 @@ { - "Version": "2.1.0", + "Version": "2.1.0-1", "Thank": [ "感谢 @a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301", "感谢 @zhangs https://bbs.deepin.org/post/227948", diff --git a/deb/opt/apps/deepin-wine-runner/package-script.zip b/deb/opt/apps/deepin-wine-runner/package-script.zip index e4e994d..abc38de 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 fd1c6da..2dae947 100755 --- a/deb/opt/apps/deepin-wine-runner/wine/installwine +++ b/deb/opt/apps/deepin-wine-runner/wine/installwine @@ -98,7 +98,11 @@ def ReadLocalInformation(): def ReadInternetInformation(): global internetJsonList # C++ 版本是用 curl 的,考虑到 Python 用 requests 反而方便,于是不用 curl - internetJsonList = json.loads(requests.get(f"{internetWineSource}/information.json").text) + try: + internetJsonList = json.loads(requests.get(f"{internetWineSource}/information.json").text) + except: + QtWidgets.QMessageBox.critical(window, "错误", "无法连接服务器!") + return nmodel = QtGui.QStandardItemModel(window) for i in internetJsonList: item = QtGui.QStandardItem(i[0]) diff --git a/deb/usr/share/applications/spark-deepin-wine-package-builder.desktop b/deb/usr/share/applications/spark-deepin-wine-package-builder.desktop index 5151365..cdcdeb2 100755 --- a/deb/usr/share/applications/spark-deepin-wine-package-builder.desktop +++ b/deb/usr/share/applications/spark-deepin-wine-package-builder.desktop @@ -11,4 +11,5 @@ Comment=Wine Package Builder Comment[zh]=Wine 打包器 Terminal=false StartupNotify=true +NoDisplay=true MimeType=application/vnd.microsoft.portable-executable;application/x-dosexec;application/x-msi;application-x-executable;application/application-x-ms-dos-executable;application/application-x-msdownload;application/octet-stream diff --git a/deb/usr/share/applications/spark-deepin-wine-packager-with-script.desktop b/deb/usr/share/applications/spark-deepin-wine-packager-with-script.desktop index 733137c..e5172b4 100755 --- a/deb/usr/share/applications/spark-deepin-wine-packager-with-script.desktop +++ b/deb/usr/share/applications/spark-deepin-wine-packager-with-script.desktop @@ -6,6 +6,7 @@ Version=1.7.0 Exec=/usr/bin/deepin-wine-packager-with-script Icon=/opt/apps/deepin-wine-runner/deepin-wine-runner.svg Name=Wine Package Builder For UOS +NoDisplay=true Name[zh]=Wine 打包器(基于活动脚本) Comment=Wine Package Builder For UOS Comment[zh]=Wine 打包器(基于活动脚本) diff --git a/deb/usr/share/applications/spark-deepin-wine-runner-control-vm.desktop b/deb/usr/share/applications/spark-deepin-wine-runner-control-vm.desktop index 466e578..5e1be4d 100755 --- a/deb/usr/share/applications/spark-deepin-wine-runner-control-vm.desktop +++ b/deb/usr/share/applications/spark-deepin-wine-runner-control-vm.desktop @@ -9,5 +9,6 @@ Name=Setting VirtualMachine Name[zh]=设置 Windows 虚拟机 Comment=Setting VirtualMachine Comment[zh]=设置虚拟机 +NoDisplay=true Terminal=false StartupNotify=true diff --git a/deepin-wine-packager.py b/deepin-wine-packager.py index 43f6c1c..404ee51 100755 --- a/deepin-wine-packager.py +++ b/deepin-wine-packager.py @@ -781,7 +781,11 @@ fi debPackagePath = f"/tmp/{random.randint(0, 9999)}" #self.run_command(f"rm -rfv /tmp/{debPackagePath}") print("f") - self.run_command(f"rm -rfv '{debPackagePath}'") + # 为了避免删库,必须保证是 deb 文件构建目录才进行清空 + if os.path.exists(f"{debPackagePath}/DEBIAN/control"): + self.run_command(f"rm -rfv '{debPackagePath}/usr'") + self.run_command(f"rm -rfv '{debPackagePath}/opt'") + self.run_command(f"rm -rfv '{debPackagePath}/DEBIAN'") print("d") ############### # 创建目录 diff --git a/dxvk.7z b/dxvk.7z new file mode 100644 index 0000000..b1f4837 Binary files /dev/null and b/dxvk.7z differ diff --git a/information.json b/information.json index b36c36f..e065b87 100755 --- a/information.json +++ b/information.json @@ -1,5 +1,5 @@ { - "Version": "2.1.0", + "Version": "2.1.0-1", "Thank": [ "感谢 @a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301", "感谢 @zhangs https://bbs.deepin.org/post/227948", diff --git a/mainwindow.py b/mainwindow.py index f4222ac..d62c6df 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 # 使用系统默认的 python3 运行 -########################################################################################### +################################################################################################################# # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 # 版本:2.0.0 # 更新时间:2022年08月12日 # 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序 # 基于 Python3 的 PyQt5 构建 -########################################################################################### +################################################################################################################# ################# # 引入所需的库 ################# @@ -17,6 +17,7 @@ import json import base64 import shutil import hashlib +import platform import requests import threading import traceback @@ -27,6 +28,19 @@ import PyQt5.QtGui as QtGui import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets from Model import * + +def PythonLower(): + app = QtWidgets.QApplication(sys.argv) + QtWidgets.QMessageBox.critical(None, "错误", "Python 至少需要 3.6 及以上版本,目前版本:" + platform.python_version() + "") + sys.exit(1) + +# Python 版本检测,因为 f-string 格式化要至少 Python 3.6 及以上的版本,所以需要检测 +# 判断主版本号 +if sys.version_info[0] > 3: + PythonLower() +if sys.version_info[1] < 6: + PythonLower() + ################### # 程序所需事件 ################### @@ -1374,7 +1388,13 @@ exe路径\' 参数 \' 千万不要中断后不删除源的情况下 apt upgrade !!!中断后只需重新打开脚本输入 repair 或者随意安装一个 Wine(会自动执行恢复操作)即可 以及此脚本安装的 Wine 无法保证 100% 能使用,以及副作用是会提示 N: 鉴于仓库 'https://community-packages.deepin.com/beige beige InRelease' 不支持 'i386' 体系结构,跳过配置文件 'main/binary-i386/Packages' 的获取。''' -updateThingsString = '''※1、新增新的 Wine 安装器,并支持将安装的 Wine 打包到 Wine 程序 deb 包中 +updateThingsString = '''

2.1.0-1 更新内容:

+※1、删除多余图标 +※2、修复将打包文件生成目录设置为 / 等重要目录导致删库的问题 +3、修复了打包器浏览按钮闪退、生成的 postrm 有误的问题 +4、支持在输入信息时自动生成 deb 保存路径 +

2.1.0 更新内容:

+※1、新增新的 Wine 安装器,并支持将安装的 Wine 打包到 Wine 程序 deb 包中 ※2、Wine 打包器打包 Windows 应用支持将 Wine 打包入 deb 内,可以不依赖 Wine(一般不推荐把 Wine 打包入内,推荐用依赖的形式),并支持设置自定义依赖和生成模板 ※3、开始初步多语言支持 ※4、修复了在没有安装任何 Wine 的情况下使用高级功能导致程序闪退的问题 @@ -1389,7 +1409,7 @@ updateThingsString = '''※1、新增新的 Wine 安装器,并支持将安 ''' for i in information["Thank"]: thankText += f"{i}\n" -updateTime = "2022年08月26日" +updateTime = "2022年09月03日" about = f'''

关于

一个能让Linux用户更加方便运行Windows应用的程序,内置了对wine图形化的支持和各种Wine工具和自制Wine程序打包器、运行库安装工具等等

同时也内置了基于VirtualBox制作的小白Windows虚拟机安装工具,可以做到只需要用户下载系统镜像并点击安装即可,无需顾及虚拟机安装、创建、虚拟机的分区等等

@@ -1743,6 +1763,7 @@ s2.triggered.connect(lambda: webbrowser.open_new_tab("https://s.threatbook.cn/") s3.triggered.connect(lambda: webbrowser.open_new_tab("https://www.virustotal.com/")) help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助(&H)")) +runStatusWebSize = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询程序在 Wine 的运行情况")) h1 = help.addMenu(QtCore.QCoreApplication.translate("U", "程序官网")) h2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "小提示")) h3 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "更新内容")) @@ -1764,6 +1785,8 @@ h1.addAction(gitlink) h1.addAction(gitlab) h1.addAction(jihu) help.addSeparator() +help.addAction(runStatusWebSize) +help.addSeparator() help.addAction(h2) help.addAction(h3) help.addAction(h4) @@ -1788,6 +1811,7 @@ github.triggered.connect(lambda: webbrowser.open_new_tab("https://github.com/gfd gitlink.triggered.connect(lambda: webbrowser.open_new_tab("https://gitlink.org.cn/gfdgd_xi/deep-wine-runner")) gitlab.triggered.connect(lambda: webbrowser.open_new_tab("https://gitlab.com/gfdgd-xi/deep-wine-runner")) jihu.triggered.connect(lambda: webbrowser.open_new_tab("https://jihulab.com//gfdgd-xi/deep-wine-runner")) +runStatusWebSize.triggered.connect(lambda: webbrowser.open_new_tab("https://gfdgd-xi.github.io/wine-runner-info")) h2.triggered.connect(helps) h3.triggered.connect(UpdateThings) h4.triggered.connect(ThankWindow) diff --git a/package-script.zip b/package-script.zip index e4e994d..abc38de 100755 Binary files a/package-script.zip and b/package-script.zip differ diff --git a/package-script/information.json b/package-script/information.json index fa2d2a0..5ef6a3c 100755 --- a/package-script/information.json +++ b/package-script/information.json @@ -1,3 +1,3 @@ { - "Version": "2.1.0" + "Version": "2.1.0-1" }