diff --git a/InstallFont.py b/InstallFont.py new file mode 100755 index 0000000..e660887 --- /dev/null +++ b/InstallFont.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +import os +import sys +import shutil + +if __name__ == "__main__": + if "--help" in sys.argv: + print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("版本:1.0.0") + print("本程序可以更方便的在 wine 容器中安装指定应用") + sys.exit() + if len(sys.argv) <= 1 or sys.argv[1] == "": + print("您未指定需要安装的容器,无法继续") + print("参数:") + print("XXX 参数一") + print("参数一为需要安装的容器") + sys.exit() + + homePath = os.path.expanduser('~') + while True: + os.system("clear") + os.system("toilet Fonts") + if not os.path.exists(f"{sys.argv[1]}/drive_c/windows/Fonts"): + input("您选择的不是 Wine 容器,无法继续,按回车键退出") + exit() + fontList = [ + ["fake_simsun.ttc", "https://gitlink.org.cn/api/attachments/392168", "simsun.ttc", "fake_simsun.ttc(会替换容器内的宋体,且与 deepin 有问题)"], + ["simsun.ttc", "https://gitlink.org.cn/api/attachments/392181", "simsun.ttc", "simsun.ttc"], + ["simsunb.ttf", "https://gitlink.org.cn/api/attachments/392180", "simsunb.ttf", "simsunb.ttf"], + ["msyh.ttc", "https://gitlink.org.cn/api/attachments/392182", "msyh.ttc", "msyh.ttc"], + ["msyhl.ttc", "https://gitlink.org.cn/api/attachments/392184", "msyhl.ttc", "msyhl.ttc"], + ["msyhbd.ttc", "https://gitlink.org.cn/api/attachments/392183", "msyhbd.ttc", "msyhbd.ttc"] + ] + for i in range(0, len(fontList)): + print(f"{i} {fontList[i][3]}") + while True: + try: + choose = input("请输入要选择的 字体(输入“exit”退出):").lower() + if choose == "exit": + break + choose = int(choose) + except: + print("输入错误,请重新输入") + continue + if 0 <= choose and choose < len(fontList): + break + if choose == "exit": + exit() + print(f"您选择了字体 {fontList[choose][0]}") + if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/font/{fontList[choose][0]}"): + print("已经缓存,使用本地版本") + 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]}") + input("安装结束,按回车键继续") + continue + print("开始下载") + os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/font/{fontList[choose][0]}'") + os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/font'") + 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]}") + input("安装结束,按回车键继续") \ No newline at end of file diff --git a/InstallMono.py b/InstallMono.py index 30b4d8c..85421d4 100755 --- a/InstallMono.py +++ b/InstallMono.py @@ -3,7 +3,7 @@ ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 # 版本:1.8.0 -# 更新时间:2022年08月01日 +# 更新时间:2022年08月06日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -22,11 +22,27 @@ if "--help" in sys.argv: if len(sys.argv) <= 3 or sys.argv[1] == "" or sys.argv[2] == "" or sys.argv[3] == "": print("您未指定需要安装 gecko 或者 mono 的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二 参数三") - print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为安装gecko或mono(gecko/mono),三个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三 参数四(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为安装gecko或mono(gecko/mono),参数四为是否缓存(可略),四个参数位置不能颠倒") sys.exit() -# 获取最新版本的版本号 -programVersionList = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/") + +os.system(f"toilet '{sys.argv[3]}'") +homePath = os.path.expanduser('~') +try: + # 获取最新版本的版本号 + programVersionList = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/") +except: + print("无法连接下载服务器,将使用本地缓存") + if not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi") or not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt"): + print("无本地缓存数据,无法进行、结束") + input("按回车键退出") + exit() + file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "r") + version = file.read().replace("\n", "") + print("安装版本:", version) + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") + input("安装结束,按回车键退出") + exit() programVersion = programVersionList("a:last-child").attr.href # 获取最新版本安装包的URL programUrl = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/{programVersion}") @@ -42,10 +58,41 @@ if programDownloadUrl == "": print("无法获取链接,无法继续") sys.exit() print(f"当前选择的程序获取路径:{programDownloadUrl}") +if not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}"): + os.makedirs(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}") +if len(sys.argv) <= 4: + choice = True +else: + choice = (sys.argv[3] == "1") +if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi") and os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt") and choice: + print("版本号校验") + file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "r") + version = file.read().replace("\n", "") + if version == programVersion.replace("\n", ""): + print("缓存版本:", version.replace("/", "")) + print("已经缓存,使用本地版本") + file.close() + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") + input("安装结束,按回车键退出") + exit() + +file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "w+") print("开始下载") -os.system("rm -rf /tmp/winegeckomonoinstall") +os.system(f"rm -rf \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") os.system("mkdir -p /tmp/winegeckomonoinstall") -os.system(f"aria2c -x 16 -s 16 -d /tmp/winegeckomonoinstall -o install.msi \"{programDownloadUrl}\"") +os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}\" -o install.msi \"{programDownloadUrl}\"") print("开始安装") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i /tmp/winegeckomonoinstall/install.msi") +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") +try: + if sys.argv[4] == "1": + print("写入缓存") + file.write(programVersion) + file.close() + else: + print("删除临时文件") + os.system(f"rm -rf \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}\"") +except: + print("写入缓存") + file.write(programVersion) + file.close() input("安装结束,按回车键退出") \ No newline at end of file diff --git a/InstallMsxml.py b/InstallMsxml.py index aa2c2a3..5ac3e92 100755 --- a/InstallMsxml.py +++ b/InstallMsxml.py @@ -3,7 +3,7 @@ ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 # 版本:1.8.0 -# 更新时间:2022年08月01日 +# 更新时间:2022年08月06日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -21,32 +21,50 @@ if "--help" in sys.argv: if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": print("您未指定需要安装 MSXML 的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二") - print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") sys.exit() +homePath = os.path.expanduser('~') +os.system("toilet MSXML") msxmlList = [ - ["MSXML 4.0 SP2", "https://www.gitlink.org.cn/api/attachments/390679?gfdgd_xi"], - ["MSXML 4.0 SP3", "https://www.gitlink.org.cn/api/attachments/390678?gfdgd_xi"], - ["MSXML 6.0", "https://www.gitlink.org.cn/api/attachments/390681?gfdgd_xi"] + ["MSXML 4.0 SP2", "https://www.gitlink.org.cn/api/attachments/390679?gfdgd_xi", "msxml6.0.msi"], + ["MSXML 4.0 SP3", "https://www.gitlink.org.cn/api/attachments/390678?gfdgd_xi", "msxml4.0SP3.msi"], + ["MSXML 6.0", "https://www.gitlink.org.cn/api/attachments/390681?gfdgd_xi", "msxml6_x64.msi"] ] print("请选择以下的 MSXML 进行安装(不保证能正常安装运行)") for i in range(0, len(msxmlList)): print(f"{i}、{msxmlList[i][0]}") while True: try: - choose = int(input("请输入要选择要安装的 MSXML:")) + choose = input("请输入要选择要安装的 MSXML(输入“exit”退出):") + if choose.lower() == "exit": + break + choose = int(choose) except: print("输入错误,请重新输入") continue if 0 <= choose and choose < len(msxmlList): break +try: + if choose.lower() == "exit": + exit() +except: + pass print(f"您选择了 {msxmlList[choose][0]}") +if len(sys.argv) <= 3: + choice = True +else: + choice = (sys.argv[3] == "1") +if os.path.exists(f"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}") and choice: + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") + input("安装结束,按回车键退出") + exit() print("开始下载") -os.system("rm -rfv /tmp/wineinstallmsxml") -os.system("mkdir -p /tmp/wineinstallmsxml") -os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstallmsxml -o install.msi \"{msxmlList[choose][1]}\"") +os.system(f"rm -rfv \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") +os.system(f"mkdir -p \"{homePath}/.config/deepin-wine-runner/MSXML/\"") +os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.config/deepin-wine-runner/MSXML\" -o \"{msxmlList[choose][2]}\" \"{msxmlList[choose][1]}\"") print("开始安装") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i /tmp/wineinstallmsxml/install.msi") -input("安装结束,按回车键退出") -sys.exit() \ No newline at end of file +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") +input("安装结束,按回车键退出") \ No newline at end of file diff --git a/InstallNetFramework.py b/InstallNetFramework.py index 3e4e940..261fb52 100755 --- a/InstallNetFramework.py +++ b/InstallNetFramework.py @@ -21,9 +21,12 @@ if "--help" in sys.argv: if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": print("您未指定需要安装 .net framework 的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二") - print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") sys.exit() + +homePath = os.path.expanduser('~') +os.system("toilet .NET") netList = [ ["3.5 SP1 Offline Installer", "https://download.visualstudio.microsoft.com/download/pr/b635098a-2d1d-4142-bef6-d237545123cb/2651b87007440a15209cac29634a4e45/dotnetfx35.exe"], ["4.0 Offline Installer", "https://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"], @@ -43,19 +46,35 @@ for i in range(0, len(netList)): print(f"{i} .net framework {netList[i][0]}") while True: try: - choose = int(input("请输入要选择的 .net framework 版本:")) + choose = input("请输入要选择的 .net framework 版本(输入“exit”退出):").lower() + if choose == "exit": + break + choose = int(choose) except: print("输入错误,请重新输入") continue if 0 <= choose and choose < len(netList): break + +if choose == "exit": + exit() +if len(sys.argv) <= 3: + choice = True +else: + choice = (sys.argv[3] == "1") print(f"您选择了 .net framework {netList[choose][0]}") print(f"如果是 Offline Installer 版本,提示需要连接互联网,其实是不需要的,断网也可以安装") print(f"如果 Offline Installer 版本连接网络时安装失败,提示无法连接服务器或连接超时,可以尝试下载完安装包加载过程中断网以便断网安装") print(f"一般建议 Offline Installer 版本在下载完 exe 安装程序后在加载过程中断网以便提高安装速度") +programName = os.path.split(netList[choose][1])[1] +if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/.netframework/{programName}") and choice: + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") + input("安装结束,按回车键退出") + exit() print("开始下载") -os.system("rm -rf /tmp/wineinstallnetframework") -os.system("mkdir -p /tmp/wineinstallnetframework") -os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstallnetframework -o install.exe \"{netList[choose][1]}\"") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} /tmp/wineinstallnetframework/install.exe") +os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") +os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/.netframework'") +os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.cache/deepin-wine-runner/.netframework\" -o \"{programName}\" \"{netList[choose][1]}\"") +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") input("安装结束,按回车键退出") \ No newline at end of file diff --git a/InstallOther.py b/InstallOther.py index 6012216..bc589c7 100755 --- a/InstallOther.py +++ b/InstallOther.py @@ -21,38 +21,57 @@ if "--help" in sys.argv: if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": print("您未指定需要安装的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二") - print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") sys.exit() +homePath = os.path.expanduser('~') +os.system("toilet Other") msxmlList = [ - ["Windows Script 5.7 for Windows XP", "https://download.microsoft.com/download/f/f/e/ffea3abf-b55f-4924-b5a5-bde0805ad67c/scripten.exe", "exe"], - ["Windows Management Instrumentation 1.50.1131", "https://www.gitlink.org.cn/api/attachments/390680", "exe"] + ["Windows Script 5.7 for Windows XP", "https://download.microsoft.com/download/f/f/e/ffea3abf-b55f-4924-b5a5-bde0805ad67c/scripten.exe", "exe", "scripten.exe"], + ["Windows Management Instrumentation 1.50.1131", "https://www.gitlink.org.cn/api/attachments/390680", "exe", "WMITools.exe"] ] print("请选择以下的应用进行安装(不保证能正常安装运行)") for i in range(0, len(msxmlList)): print(f"{i}、{msxmlList[i][0]}") while True: try: - choose = int(input("请输入要选择要安装的应用:")) + choose = input("请输入要选择要安装的应用(输入“exit”退出):").lower() + choose = int(choose) except: print("输入错误,请重新输入") continue if 0 <= choose and choose < len(msxmlList): break +if choose == "exit": + exit() +if len(sys.argv) <= 3: + choice = True +else: + choice = (sys.argv[3] == "1") print(f"您选择了{msxmlList[choose][0]}") +if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}") and choice: + print("已经缓存,使用本地版本") + if msxmlList[choose][2] == "msi": + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") + input("安装结束,按回车键退出") + sys.exit() + if msxmlList[choose][2] == "exe": + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") + input("安装结束,按回车键退出") + sys.exit() print("开始下载") -os.system("rm -rf /tmp/wineinstall") -os.system("mkdir -p /tmp/wineinstall") +os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") +os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/other'") if msxmlList[choose][2] == "msi": - os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstall -o install.msi \"{msxmlList[choose][1]}\"") + os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/other' -o '{msxmlList[choose][3]}' \"{msxmlList[choose][1]}\"") print("开始安装") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i /tmp/wineinstall/install.msi") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") print("安装结束") sys.exit() if msxmlList[choose][2] == "exe": - os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstall -o install.exe \"{msxmlList[choose][1]}\"") + os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/other' -o '{msxmlList[choose][3]}' \"{msxmlList[choose][1]}\"") print("开始安装") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} /tmp/wineinstall/install.exe") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") input("安装结束,按回车键退出") sys.exit() \ No newline at end of file diff --git a/InstallVisualCPlusPlus.py b/InstallVisualCPlusPlus.py index 2224f61..999f6db 100755 --- a/InstallVisualCPlusPlus.py +++ b/InstallVisualCPlusPlus.py @@ -21,32 +21,45 @@ if "--help" in sys.argv: if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": print("您未指定需要安装 Visual Studio C++ 的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二") - print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") sys.exit() + +homePath = os.path.expanduser('~') +os.system("toilet VC++") netList = [ - ["2005 Service Pack 1 Redistributable Package MFC 安全更新", "https://download.microsoft.com/download/4/A/2/4A22001F-FA3B-4C13-BF4E-42EC249D51C4/vcredist_x86.EXE"], - ["2008 (VC++ 9.0) SP1 (不再支持) ", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe"], - ["2010 (VC++ 10.0) SP1 (不再支持) ", "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe"], - ["2012 (VC++ 11.0) Update 4", "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe"], - ["2013 (VC++ 12.0) ", "https://download.visualstudio.microsoft.com/download/pr/10912113/5da66ddebb0ad32ebd4b922fd82e8e25/vcredist_x86.exe"], - ["2015、2017、2019 和 2022", "https://aka.ms/vs/17/release/vc_redist.x86.exe"] + ["2005 Service Pack 1 Redistributable Package MFC 安全更新", "https://download.microsoft.com/download/4/A/2/4A22001F-FA3B-4C13-BF4E-42EC249D51C4/vcredist_x86.EXE", "vcredist05_x86.exe"], + ["2008 (VC++ 9.0) SP1 (不再支持) ", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe", "vcredist08_x86.exe"], + ["2010 (VC++ 10.0) SP1 (不再支持) ", "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe", "vcredist10_x86.exe"], + ["2012 (VC++ 11.0) Update 4", "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe", "vcredist12_x86.exe"], + ["2013 (VC++ 12.0) ", "https://download.visualstudio.microsoft.com/download/pr/10912113/5da66ddebb0ad32ebd4b922fd82e8e25/vcredist_x86.exe", "vcredist13_x86.exe"], + ["2015、2017、2019 和 2022", "https://aka.ms/vs/17/release/vc_redist.x86.exe", "vcredist15_x86.exe"] ] print("请选择以下的 Visual Studio C++ 进行安装(不保证能正常安装运行)") for i in range(0, len(netList)): print(f"{i} Visual Studio C++ {netList[i][0]}") while True: try: - choose = int(input("请输入要选择的 Visual Studio C++ 版本:")) + choose = input("请输入要选择的 Visual Studio C++ 版本(输入“exit”退出):").lower() + if choose == "exit": + break + choose = int(choose) except: print("输入错误,请重新输入") continue if 0 <= choose and choose < len(netList): break +if choose == "exit": + exit() print(f"您选择了 Visual Studio C++ {netList[choose][0]}") +if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}"): + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") + input("安装结束,按回车键退出") + exit() print("开始下载") -os.system("rm -rf /tmp/wineinstallvisualstudiocplusplus") -os.system("mkdir -p /tmp/wineinstallvisualstudiocplusplus") -os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstallvisualstudiocplusplus -o install.exe \"{netList[choose][1]}\"") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} /tmp/wineinstallvisualstudiocplusplus/install.exe") +os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") +os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/vcpp'") +os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/vcpp' -o '{netList[choose][2]}' \"{netList[choose][1]}\"") +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") input("安装结束,按回车键退出") \ No newline at end of file diff --git a/Makefile b/Makefile index 796f010..3faaba5 100755 --- a/Makefile +++ b/Makefile @@ -37,13 +37,16 @@ build: cp -rv UpdateGeek.sh deb/opt/apps/deepin-wine-runner cp -rv AppStore.py deb/opt/apps/deepin-wine-runner cp -rv InstallWineOnDeepin23.py deb/opt/apps/deepin-wine-runner + cp -rv dxvk deb/opt/apps/deepin-wine-runner + cp -rv InstallFont.py deb/opt/apps/deepin-wine-runner dpkg -b deb spark-deepin-wine-runner.deb + install: make build sudo apt update - sudo dpkg -i spark-deepin-wine-runner.deb - sudo apt install -f + #sudo dpkg -i spark-deepin-wine-runner.deb + sudo apt install ./spark-deepin-wine-runner.deb -y --allow-downgrades remove: sudo apt purge spark-deepin-wine-runner @@ -55,4 +58,4 @@ depend: python3-requests fakeroot bash python3-pyqt5 run: - python3 mainwindow.py \ No newline at end of file + python3 mainwindow.py diff --git a/deb/DEBIAN/control b/deb/DEBIAN/control index ba55a5a..751ea32 100755 --- a/deb/DEBIAN/control +++ b/deb/DEBIAN/control @@ -1,10 +1,10 @@ Package: spark-deepin-wine-runner -Version: 1.9.0Alpha1 +Version: 1.9.0 Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿布呢 Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner Architecture: all Priority: optional -Depends: python3, python3-pil, python3-pil.imagetk, python3-pyquery, deepin-terminal, aria2, curl, unrar, unzip, python3-requests, fakeroot, bash, python3-pyqt5 +Depends: python3, python3-pil, python3-pil.imagetk, python3-pyquery, deepin-terminal, aria2, curl, unrar, unzip, python3-requests, fakeroot, bash, python3-pyqt5, toilet Conflicts: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer Replaces: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer Description: gfdgd xi、为什么您不喜欢熊出没和阿布呢 制作的 wine 运行器 diff --git a/deb/DEBIAN/postinst b/deb/DEBIAN/postinst index efb83a3..bd8f6ba 100755 --- a/deb/DEBIAN/postinst +++ b/deb/DEBIAN/postinst @@ -1,3 +1,3 @@ # !/bin/sh # 向服务器返回安装数加1(不显示内容且忽略错误) -curl http://120.25.153.144/spark-deepin-wine-runner/Install.php?Version=1.8.0 -s > /dev/null | true +curl http://120.25.153.144/spark-deepin-wine-runner/Install.php?Version=1.9.0 -s > /dev/null | true diff --git a/deb/opt/apps/deepin-wine-runner/InstallFont.py b/deb/opt/apps/deepin-wine-runner/InstallFont.py new file mode 100755 index 0000000..e660887 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/InstallFont.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +import os +import sys +import shutil + +if __name__ == "__main__": + if "--help" in sys.argv: + print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("版本:1.0.0") + print("本程序可以更方便的在 wine 容器中安装指定应用") + sys.exit() + if len(sys.argv) <= 1 or sys.argv[1] == "": + print("您未指定需要安装的容器,无法继续") + print("参数:") + print("XXX 参数一") + print("参数一为需要安装的容器") + sys.exit() + + homePath = os.path.expanduser('~') + while True: + os.system("clear") + os.system("toilet Fonts") + if not os.path.exists(f"{sys.argv[1]}/drive_c/windows/Fonts"): + input("您选择的不是 Wine 容器,无法继续,按回车键退出") + exit() + fontList = [ + ["fake_simsun.ttc", "https://gitlink.org.cn/api/attachments/392168", "simsun.ttc", "fake_simsun.ttc(会替换容器内的宋体,且与 deepin 有问题)"], + ["simsun.ttc", "https://gitlink.org.cn/api/attachments/392181", "simsun.ttc", "simsun.ttc"], + ["simsunb.ttf", "https://gitlink.org.cn/api/attachments/392180", "simsunb.ttf", "simsunb.ttf"], + ["msyh.ttc", "https://gitlink.org.cn/api/attachments/392182", "msyh.ttc", "msyh.ttc"], + ["msyhl.ttc", "https://gitlink.org.cn/api/attachments/392184", "msyhl.ttc", "msyhl.ttc"], + ["msyhbd.ttc", "https://gitlink.org.cn/api/attachments/392183", "msyhbd.ttc", "msyhbd.ttc"] + ] + for i in range(0, len(fontList)): + print(f"{i} {fontList[i][3]}") + while True: + try: + choose = input("请输入要选择的 字体(输入“exit”退出):").lower() + if choose == "exit": + break + choose = int(choose) + except: + print("输入错误,请重新输入") + continue + if 0 <= choose and choose < len(fontList): + break + if choose == "exit": + exit() + print(f"您选择了字体 {fontList[choose][0]}") + if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/font/{fontList[choose][0]}"): + print("已经缓存,使用本地版本") + 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]}") + input("安装结束,按回车键继续") + continue + print("开始下载") + os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/font/{fontList[choose][0]}'") + os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/font'") + 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]}") + input("安装结束,按回车键继续") \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/InstallMono.py b/deb/opt/apps/deepin-wine-runner/InstallMono.py index 30b4d8c..85421d4 100755 --- a/deb/opt/apps/deepin-wine-runner/InstallMono.py +++ b/deb/opt/apps/deepin-wine-runner/InstallMono.py @@ -3,7 +3,7 @@ ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 # 版本:1.8.0 -# 更新时间:2022年08月01日 +# 更新时间:2022年08月06日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -22,11 +22,27 @@ if "--help" in sys.argv: if len(sys.argv) <= 3 or sys.argv[1] == "" or sys.argv[2] == "" or sys.argv[3] == "": print("您未指定需要安装 gecko 或者 mono 的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二 参数三") - print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为安装gecko或mono(gecko/mono),三个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三 参数四(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为安装gecko或mono(gecko/mono),参数四为是否缓存(可略),四个参数位置不能颠倒") sys.exit() -# 获取最新版本的版本号 -programVersionList = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/") + +os.system(f"toilet '{sys.argv[3]}'") +homePath = os.path.expanduser('~') +try: + # 获取最新版本的版本号 + programVersionList = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/") +except: + print("无法连接下载服务器,将使用本地缓存") + if not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi") or not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt"): + print("无本地缓存数据,无法进行、结束") + input("按回车键退出") + exit() + file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "r") + version = file.read().replace("\n", "") + print("安装版本:", version) + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") + input("安装结束,按回车键退出") + exit() programVersion = programVersionList("a:last-child").attr.href # 获取最新版本安装包的URL programUrl = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/{programVersion}") @@ -42,10 +58,41 @@ if programDownloadUrl == "": print("无法获取链接,无法继续") sys.exit() print(f"当前选择的程序获取路径:{programDownloadUrl}") +if not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}"): + os.makedirs(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}") +if len(sys.argv) <= 4: + choice = True +else: + choice = (sys.argv[3] == "1") +if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi") and os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt") and choice: + print("版本号校验") + file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "r") + version = file.read().replace("\n", "") + if version == programVersion.replace("\n", ""): + print("缓存版本:", version.replace("/", "")) + print("已经缓存,使用本地版本") + file.close() + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") + input("安装结束,按回车键退出") + exit() + +file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "w+") print("开始下载") -os.system("rm -rf /tmp/winegeckomonoinstall") +os.system(f"rm -rf \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") os.system("mkdir -p /tmp/winegeckomonoinstall") -os.system(f"aria2c -x 16 -s 16 -d /tmp/winegeckomonoinstall -o install.msi \"{programDownloadUrl}\"") +os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}\" -o install.msi \"{programDownloadUrl}\"") print("开始安装") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i /tmp/winegeckomonoinstall/install.msi") +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") +try: + if sys.argv[4] == "1": + print("写入缓存") + file.write(programVersion) + file.close() + else: + print("删除临时文件") + os.system(f"rm -rf \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}\"") +except: + print("写入缓存") + file.write(programVersion) + file.close() input("安装结束,按回车键退出") \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/InstallMsxml.py b/deb/opt/apps/deepin-wine-runner/InstallMsxml.py index aa2c2a3..5ac3e92 100755 --- a/deb/opt/apps/deepin-wine-runner/InstallMsxml.py +++ b/deb/opt/apps/deepin-wine-runner/InstallMsxml.py @@ -3,7 +3,7 @@ ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 # 版本:1.8.0 -# 更新时间:2022年08月01日 +# 更新时间:2022年08月06日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -21,32 +21,50 @@ if "--help" in sys.argv: if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": print("您未指定需要安装 MSXML 的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二") - print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") sys.exit() +homePath = os.path.expanduser('~') +os.system("toilet MSXML") msxmlList = [ - ["MSXML 4.0 SP2", "https://www.gitlink.org.cn/api/attachments/390679?gfdgd_xi"], - ["MSXML 4.0 SP3", "https://www.gitlink.org.cn/api/attachments/390678?gfdgd_xi"], - ["MSXML 6.0", "https://www.gitlink.org.cn/api/attachments/390681?gfdgd_xi"] + ["MSXML 4.0 SP2", "https://www.gitlink.org.cn/api/attachments/390679?gfdgd_xi", "msxml6.0.msi"], + ["MSXML 4.0 SP3", "https://www.gitlink.org.cn/api/attachments/390678?gfdgd_xi", "msxml4.0SP3.msi"], + ["MSXML 6.0", "https://www.gitlink.org.cn/api/attachments/390681?gfdgd_xi", "msxml6_x64.msi"] ] print("请选择以下的 MSXML 进行安装(不保证能正常安装运行)") for i in range(0, len(msxmlList)): print(f"{i}、{msxmlList[i][0]}") while True: try: - choose = int(input("请输入要选择要安装的 MSXML:")) + choose = input("请输入要选择要安装的 MSXML(输入“exit”退出):") + if choose.lower() == "exit": + break + choose = int(choose) except: print("输入错误,请重新输入") continue if 0 <= choose and choose < len(msxmlList): break +try: + if choose.lower() == "exit": + exit() +except: + pass print(f"您选择了 {msxmlList[choose][0]}") +if len(sys.argv) <= 3: + choice = True +else: + choice = (sys.argv[3] == "1") +if os.path.exists(f"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}") and choice: + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") + input("安装结束,按回车键退出") + exit() print("开始下载") -os.system("rm -rfv /tmp/wineinstallmsxml") -os.system("mkdir -p /tmp/wineinstallmsxml") -os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstallmsxml -o install.msi \"{msxmlList[choose][1]}\"") +os.system(f"rm -rfv \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") +os.system(f"mkdir -p \"{homePath}/.config/deepin-wine-runner/MSXML/\"") +os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.config/deepin-wine-runner/MSXML\" -o \"{msxmlList[choose][2]}\" \"{msxmlList[choose][1]}\"") print("开始安装") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i /tmp/wineinstallmsxml/install.msi") -input("安装结束,按回车键退出") -sys.exit() \ No newline at end of file +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") +input("安装结束,按回车键退出") \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/InstallNetFramework.py b/deb/opt/apps/deepin-wine-runner/InstallNetFramework.py index 3e4e940..261fb52 100755 --- a/deb/opt/apps/deepin-wine-runner/InstallNetFramework.py +++ b/deb/opt/apps/deepin-wine-runner/InstallNetFramework.py @@ -21,9 +21,12 @@ if "--help" in sys.argv: if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": print("您未指定需要安装 .net framework 的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二") - print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") sys.exit() + +homePath = os.path.expanduser('~') +os.system("toilet .NET") netList = [ ["3.5 SP1 Offline Installer", "https://download.visualstudio.microsoft.com/download/pr/b635098a-2d1d-4142-bef6-d237545123cb/2651b87007440a15209cac29634a4e45/dotnetfx35.exe"], ["4.0 Offline Installer", "https://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"], @@ -43,19 +46,35 @@ for i in range(0, len(netList)): print(f"{i} .net framework {netList[i][0]}") while True: try: - choose = int(input("请输入要选择的 .net framework 版本:")) + choose = input("请输入要选择的 .net framework 版本(输入“exit”退出):").lower() + if choose == "exit": + break + choose = int(choose) except: print("输入错误,请重新输入") continue if 0 <= choose and choose < len(netList): break + +if choose == "exit": + exit() +if len(sys.argv) <= 3: + choice = True +else: + choice = (sys.argv[3] == "1") print(f"您选择了 .net framework {netList[choose][0]}") print(f"如果是 Offline Installer 版本,提示需要连接互联网,其实是不需要的,断网也可以安装") print(f"如果 Offline Installer 版本连接网络时安装失败,提示无法连接服务器或连接超时,可以尝试下载完安装包加载过程中断网以便断网安装") print(f"一般建议 Offline Installer 版本在下载完 exe 安装程序后在加载过程中断网以便提高安装速度") +programName = os.path.split(netList[choose][1])[1] +if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/.netframework/{programName}") and choice: + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") + input("安装结束,按回车键退出") + exit() print("开始下载") -os.system("rm -rf /tmp/wineinstallnetframework") -os.system("mkdir -p /tmp/wineinstallnetframework") -os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstallnetframework -o install.exe \"{netList[choose][1]}\"") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} /tmp/wineinstallnetframework/install.exe") +os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") +os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/.netframework'") +os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.cache/deepin-wine-runner/.netframework\" -o \"{programName}\" \"{netList[choose][1]}\"") +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") input("安装结束,按回车键退出") \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/InstallOther.py b/deb/opt/apps/deepin-wine-runner/InstallOther.py index 6012216..bc589c7 100755 --- a/deb/opt/apps/deepin-wine-runner/InstallOther.py +++ b/deb/opt/apps/deepin-wine-runner/InstallOther.py @@ -21,38 +21,57 @@ if "--help" in sys.argv: if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": print("您未指定需要安装的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二") - print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") sys.exit() +homePath = os.path.expanduser('~') +os.system("toilet Other") msxmlList = [ - ["Windows Script 5.7 for Windows XP", "https://download.microsoft.com/download/f/f/e/ffea3abf-b55f-4924-b5a5-bde0805ad67c/scripten.exe", "exe"], - ["Windows Management Instrumentation 1.50.1131", "https://www.gitlink.org.cn/api/attachments/390680", "exe"] + ["Windows Script 5.7 for Windows XP", "https://download.microsoft.com/download/f/f/e/ffea3abf-b55f-4924-b5a5-bde0805ad67c/scripten.exe", "exe", "scripten.exe"], + ["Windows Management Instrumentation 1.50.1131", "https://www.gitlink.org.cn/api/attachments/390680", "exe", "WMITools.exe"] ] print("请选择以下的应用进行安装(不保证能正常安装运行)") for i in range(0, len(msxmlList)): print(f"{i}、{msxmlList[i][0]}") while True: try: - choose = int(input("请输入要选择要安装的应用:")) + choose = input("请输入要选择要安装的应用(输入“exit”退出):").lower() + choose = int(choose) except: print("输入错误,请重新输入") continue if 0 <= choose and choose < len(msxmlList): break +if choose == "exit": + exit() +if len(sys.argv) <= 3: + choice = True +else: + choice = (sys.argv[3] == "1") print(f"您选择了{msxmlList[choose][0]}") +if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}") and choice: + print("已经缓存,使用本地版本") + if msxmlList[choose][2] == "msi": + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") + input("安装结束,按回车键退出") + sys.exit() + if msxmlList[choose][2] == "exe": + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") + input("安装结束,按回车键退出") + sys.exit() print("开始下载") -os.system("rm -rf /tmp/wineinstall") -os.system("mkdir -p /tmp/wineinstall") +os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") +os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/other'") if msxmlList[choose][2] == "msi": - os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstall -o install.msi \"{msxmlList[choose][1]}\"") + os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/other' -o '{msxmlList[choose][3]}' \"{msxmlList[choose][1]}\"") print("开始安装") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i /tmp/wineinstall/install.msi") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") print("安装结束") sys.exit() if msxmlList[choose][2] == "exe": - os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstall -o install.exe \"{msxmlList[choose][1]}\"") + os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/other' -o '{msxmlList[choose][3]}' \"{msxmlList[choose][1]}\"") print("开始安装") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} /tmp/wineinstall/install.exe") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") input("安装结束,按回车键退出") sys.exit() \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py b/deb/opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py index 2224f61..999f6db 100755 --- a/deb/opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py +++ b/deb/opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py @@ -21,32 +21,45 @@ if "--help" in sys.argv: if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": print("您未指定需要安装 Visual Studio C++ 的容器和使用的 wine,无法继续") print("参数:") - print("XXX 参数一 参数二") - print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") sys.exit() + +homePath = os.path.expanduser('~') +os.system("toilet VC++") netList = [ - ["2005 Service Pack 1 Redistributable Package MFC 安全更新", "https://download.microsoft.com/download/4/A/2/4A22001F-FA3B-4C13-BF4E-42EC249D51C4/vcredist_x86.EXE"], - ["2008 (VC++ 9.0) SP1 (不再支持) ", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe"], - ["2010 (VC++ 10.0) SP1 (不再支持) ", "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe"], - ["2012 (VC++ 11.0) Update 4", "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe"], - ["2013 (VC++ 12.0) ", "https://download.visualstudio.microsoft.com/download/pr/10912113/5da66ddebb0ad32ebd4b922fd82e8e25/vcredist_x86.exe"], - ["2015、2017、2019 和 2022", "https://aka.ms/vs/17/release/vc_redist.x86.exe"] + ["2005 Service Pack 1 Redistributable Package MFC 安全更新", "https://download.microsoft.com/download/4/A/2/4A22001F-FA3B-4C13-BF4E-42EC249D51C4/vcredist_x86.EXE", "vcredist05_x86.exe"], + ["2008 (VC++ 9.0) SP1 (不再支持) ", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe", "vcredist08_x86.exe"], + ["2010 (VC++ 10.0) SP1 (不再支持) ", "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe", "vcredist10_x86.exe"], + ["2012 (VC++ 11.0) Update 4", "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe", "vcredist12_x86.exe"], + ["2013 (VC++ 12.0) ", "https://download.visualstudio.microsoft.com/download/pr/10912113/5da66ddebb0ad32ebd4b922fd82e8e25/vcredist_x86.exe", "vcredist13_x86.exe"], + ["2015、2017、2019 和 2022", "https://aka.ms/vs/17/release/vc_redist.x86.exe", "vcredist15_x86.exe"] ] print("请选择以下的 Visual Studio C++ 进行安装(不保证能正常安装运行)") for i in range(0, len(netList)): print(f"{i} Visual Studio C++ {netList[i][0]}") while True: try: - choose = int(input("请输入要选择的 Visual Studio C++ 版本:")) + choose = input("请输入要选择的 Visual Studio C++ 版本(输入“exit”退出):").lower() + if choose == "exit": + break + choose = int(choose) except: print("输入错误,请重新输入") continue if 0 <= choose and choose < len(netList): break +if choose == "exit": + exit() print(f"您选择了 Visual Studio C++ {netList[choose][0]}") +if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}"): + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") + input("安装结束,按回车键退出") + exit() print("开始下载") -os.system("rm -rf /tmp/wineinstallvisualstudiocplusplus") -os.system("mkdir -p /tmp/wineinstallvisualstudiocplusplus") -os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstallvisualstudiocplusplus -o install.exe \"{netList[choose][1]}\"") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} /tmp/wineinstallvisualstudiocplusplus/install.exe") +os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") +os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/vcpp'") +os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/vcpp' -o '{netList[choose][2]}' \"{netList[choose][1]}\"") +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") input("安装结束,按回车键退出") \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner index 61a9f45..07f027d 100755 --- a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner +++ b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner @@ -296,9 +296,22 @@ def ListToDictionary(list): def CleanProgramHistory(): if QtWidgets.QMessageBox.question(widget, "警告", "删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。") == QtWidgets.QMessageBox.Yes: - shutil.rmtree(get_home() + "/.config/deepin-wine-runner") + try: + shutil.rmtree(get_home() + "/.config/deepin-wine-runner") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) ReStartProgram() +def CleanProgramCache(): + try: + shutil.rmtree(get_home() + "/.cache/deepin-wine-runner") + QtWidgets.QMessageBox.information(widget, "提示", "缓存清理完毕!") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + + # 重启本应用程序 def ReStartProgram(): python = sys.executable @@ -429,35 +442,60 @@ def RunWinetricks(): runWinetricks.signal.connect(QT.ShowWineReturn) runWinetricks.start() - +def FontAppStore(): + if e1.currentText() == "": + wineBottonPath = setting["DefultBotton"] + else: + wineBottonPath = e1.currentText() + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallFont.py' '{wineBottonPath}' {int(setting['RuntimeCache'])}") def InstallMonoGecko(program): if e1.currentText() == "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallMono.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {program}") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{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()]}'") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{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()]}'") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{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()]}'") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallMsxml.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") + +def InstallDXVK(): + if e1.currentText() == "": + 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", "install"]) + +def UninstallDXVK(): + if e1.currentText() == "": + 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"]) def MiniAppStore(): if e1.currentText()== "": @@ -471,7 +509,7 @@ def InstallOther(): wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallOther.py' '{wineBottonPath}' '{wine[o1.currentText()]}'") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallOther.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") def BuildExeDeb(): if e1.currentText() == "": @@ -821,6 +859,8 @@ class ProgramSetting(): message = None theme = None monogeckoInstaller = None + autoWine = None + runtimeCache = None def ShowWindow(): ProgramSetting.message = QtWidgets.QMainWindow() widget = QtWidgets.QWidget() @@ -833,6 +873,8 @@ class ProgramSetting(): widgetLayout.addWidget(QtWidgets.QLabel("自定义 wine 参数:"), 5, 0, 1, 1) widgetLayout.addWidget(QtWidgets.QLabel("程序主题:"), 6, 0, 1, 1) widgetLayout.addWidget(QtWidgets.QLabel("Wine 默认 Mono 和 Gecko 安装器:"), 7, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel("忽略未安装的 Wine:"), 8, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel("下载缓存:"), 9, 0, 1, 1) ProgramSetting.wineBottonA = QtWidgets.QComboBox() ProgramSetting.wineDebug = QtWidgets.QCheckBox("开启 DEBUG 输出") ProgramSetting.defultWine = QtWidgets.QComboBox() @@ -849,6 +891,8 @@ class ProgramSetting(): ProgramSetting.terminalOpen = QtWidgets.QCheckBox("使用终端打开(deepin 终端)") ProgramSetting.wineOption = QtWidgets.QLineEdit() ProgramSetting.monogeckoInstaller = QtWidgets.QCheckBox("屏蔽 Wine 默认 Mono 和 Gecko 安装器") + ProgramSetting.autoWine = QtWidgets.QCheckBox("不显示未检测到的 Wine") + ProgramSetting.runtimeCache = QtWidgets.QCheckBox("开启下载缓存") ProgramSetting.wineBottonA.addItems(["Auto", "win32", "win64"]) ProgramSetting.wineBottonA.setCurrentText(setting["Architecture"]) ProgramSetting.wineDebug.setChecked(setting["Debug"]) @@ -858,6 +902,8 @@ class ProgramSetting(): ProgramSetting.terminalOpen.setChecked(setting["TerminalOpen"]) ProgramSetting.wineOption.setText(setting["WineOption"]) ProgramSetting.monogeckoInstaller.setChecked(setting["MonoGeckoInstaller"]) + ProgramSetting.autoWine.setChecked(setting["AutoWine"]) + ProgramSetting.runtimeCache.setChecked(setting["RuntimeCache"]) widgetLayout.addWidget(ProgramSetting.wineBottonA, 0, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.wineDebug, 1, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.defultWine, 2, 1, 1, 1) @@ -868,12 +914,13 @@ class ProgramSetting(): widgetLayout.addWidget(ProgramSetting.theme, 6, 1, 1, 1) widgetLayout.addWidget(themeTry, 6, 2, 1, 1) widgetLayout.addWidget(ProgramSetting.monogeckoInstaller, 7, 1, 1, 1) - widgetLayout.addWidget(save, 8, 2, 1, 1) + widgetLayout.addWidget(ProgramSetting.autoWine, 8, 1, 1, 1) + widgetLayout.addWidget(ProgramSetting.runtimeCache, 9, 1, 1, 1) + widgetLayout.addWidget(save, 10, 2, 1, 1) widget.setLayout(widgetLayout) ProgramSetting.message.setCentralWidget(widget) ProgramSetting.message.setWindowTitle(f"设置 wine 运行器 {version}") ProgramSetting.message.show() - return def Browser(): path = QtWidgets.QFileDialog.getExistingDirectory(ProgramSetting.message, "选择 Wine 容器", json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"]) @@ -894,6 +941,8 @@ class ProgramSetting(): setting["WineOption"] = ProgramSetting.wineOption.text() setting["Theme"] = ProgramSetting.theme.currentText() setting["MonoGeckoInstaller"] = ProgramSetting.monogeckoInstaller.isChecked() + setting["AutoWine"] = ProgramSetting.autoWine.isChecked() + setting["RuntimeCache"] = ProgramSetting.runtimeCache.isChecked() try: write_txt(get_home() + "/.config/deepin-wine-runner/WineSetting.json", json.dumps(setting)) except: @@ -916,7 +965,8 @@ defultProgramList = { "CenterWindow": False, "Theme": "", "MonoGeckoInstaller": True, - "AutoWine": True + "AutoWine": True, + "RuntimeCache": True } if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹 os.mkdir(get_home() + "/.config/deepin-wine-runner") # 创建配置文件夹 @@ -1013,6 +1063,9 @@ exe路径\' 参数 \' updateThingsString = '''※1、修复了重复路径一直自动重复增加的问题 ※2、修复了两个打包器打包错误的问题(非基于生态活动脚本的为 wine 导入错误,基于生态活动脚本的为架构有误导致打包出的 deb 无法打包) ※3、适配了部分非 i386、amd64 架构计算机的 UOS 系统使用的 wine +※4、支持安装 dxvk(遵守 Zlib 开源协议) +5、支持不显示没有安装的 Wine,方便用户识别 +6、增加字体商店 ''' for i in information["Thank"]: thankText += f"{i}\n" @@ -1143,18 +1196,22 @@ programManager.addWidget(QtWidgets.QLabel("WINE配置:"), 2, 0, 1, 1) wineConfig = QtWidgets.QPushButton("配置容器") wineConfig.clicked.connect(lambda: RunWineProgram("winecfg")) programManager.addWidget(wineConfig, 3, 0, 1, 1) -button_r_6 = QtWidgets.QPushButton("安装字体") +fontAppStore = QtWidgets.QPushButton("字体商店") +fontAppStore.clicked.connect(FontAppStore) +programManager.addWidget(fontAppStore, 3, 2, 1, 1) +button_r_6 = QtWidgets.QPushButton("安装自定义字体") button_r_6.clicked.connect(OpenWineFontPath) -programManager.addWidget(button_r_6, 3, 2, 1, 1) +programManager.addWidget(button_r_6, 3, 4, 1, 1) sparkWineSetting = QtWidgets.QPushButton("星火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, 4, 1, 1) +programManager.addWidget(sparkWineSetting, 3, 6, 1, 1) # 权重 button5.setSizePolicy(size) saveDesktopFileOnLauncher.setSizePolicy(size) label_r_2.setSizePolicy(size) getProgramIcon.setSizePolicy(size) -trasButton.setSizePolicy(size) +#trasButton.setSizePolicy(size) +button_r_6.setSizePolicy(size) wineConfig.setSizePolicy(size) returnText = QtWidgets.QTextBrowser() @@ -1194,18 +1251,22 @@ p1 = QtWidgets.QAction("安装 wine(&I)") installWineOnDeepin23 = QtWidgets.QAction("安装 wine(只限Deepin23)") p2 = QtWidgets.QAction("设置程序(&S)") p3 = QtWidgets.QAction("清空软件历史记录(&C)") +cleanCache = QtWidgets.QAction("清空软件缓存") p4 = QtWidgets.QAction("退出程序(&E)") programmenu.addAction(p1) programmenu.addAction(installWineOnDeepin23) programmenu.addSeparator() programmenu.addAction(p2) +programmenu.addSeparator() programmenu.addAction(p3) +programmenu.addAction(cleanCache) programmenu.addSeparator() programmenu.addAction(p4) p1.triggered.connect(InstallWine) installWineOnDeepin23.triggered.connect(InstallWineOnDeepin23) p2.triggered.connect(ProgramSetting.ShowWindow) p3.triggered.connect(CleanProgramHistory) +cleanCache.triggered.connect(CleanProgramCache) p4.triggered.connect(window.close) wineOption = menu.addMenu("Wine(&W)") @@ -1276,6 +1337,11 @@ wm4_1 = QtWidgets.QAction("安装 winbind") wm4_2 = QtWidgets.QAction("卸载 winbind") wm4.addAction(wm4_1) wm4.addAction(wm4_2) +dxvkMenu = wineOption.addMenu("安装/卸载 DXVK") +installDxvk = QtWidgets.QAction("安装 DXVK") +uninstallDxvk = QtWidgets.QAction("卸载 DXVK") +dxvkMenu.addAction(installDxvk) +dxvkMenu.addAction(uninstallDxvk) w1.triggered.connect(OpenWineBotton) w2.triggered.connect(InstallWineFont) w3.triggered.connect(OpenWineFontPath) @@ -1304,6 +1370,8 @@ wm3_1.triggered.connect(lambda: RunWineProgram(f"regedit.exe' /s '{programPath}/ wm3_2.triggered.connect(lambda: RunWineProgram(f"regedit.exe' /s '{programPath}/DisabledOpengl.reg")) wm4_1.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt install winbind -y' --keep-open")) wm4_2.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt purge winbind -y' --keep-open")) +installDxvk.triggered.connect(InstallDXVK) +uninstallDxvk.triggered.connect(UninstallDXVK) virtualMachine = menu.addMenu("虚拟机(&V)") v1 = QtWidgets.QAction("使用 Virtualbox 虚拟机运行 Windows 应用") diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/setup_dxvk.sh b/deb/opt/apps/deepin-wine-runner/dxvk/setup_dxvk.sh new file mode 100755 index 0000000..4bbaf64 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/dxvk/setup_dxvk.sh @@ -0,0 +1,232 @@ +#!/usr/bin/env bash +function wait(){ + echo Press Enter To Exit + read +} +# default directories +dxvk_lib32=${dxvk_lib32:-"x32"} +dxvk_lib64=${dxvk_lib64:-"x64"} + +# figure out where we are +basedir=$(dirname "$(readlink -f $0)") + +# figure out which action to perform +action="$1" + +case "$action" in +install) + ;; +uninstall) + ;; +*) + echo "Unrecognized action: $action" + echo "Usage: $0 [install|uninstall] [--without-dxgi] [--with-d3d10] [--symlink]" + wait + exit 1 +esac + +# process arguments +shift + +with_dxgi=true +with_d3d10=false +file_cmd="cp -v" + +while (($# > 0)); do + case "$1" in + "--without-dxgi") + with_dxgi=false + ;; + "--with-d3d10") + with_d3d10=true + ;; + "--symlink") + file_cmd="ln -s -v" + ;; + esac + shift +done + +# check wine prefix before invoking wine, so that we +# don't accidentally create one if the user screws up +if [ -n "$WINEPREFIX" ] && ! [ -f "$WINEPREFIX/system.reg" ]; then + echo "$WINEPREFIX:"' Not a valid wine prefix.' >&2 + wait + exit 1 +fi + +# find wine executable +export WINEDEBUG=-all +# disable mscoree and mshtml to avoid downloading +# wine gecko and mono +export WINEDLLOVERRIDES="mscoree,mshtml=" +# 专门添加,为了可以使用自定义的 wine +wine=$WINE +wine64=$WINE64 +wineboot="$WINE wineboot" +if [[ $WINE == "" ]];then + wine="wine" +fi +if [[ $WINE64 == "" ]];then + wine64="wine64" +fi + +# $PATH is the way for user to control where wine is located (including custom Wine versions). +# Pure 64-bit Wine (non Wow64) requries skipping 32-bit steps. +# In such case, wine64 and winebooot will be present, but wine binary will be missing, +# however it can be present in other PATHs, so it shouldn't be used, to avoid versions mixing. +wine_path=$(dirname "$(which $wineboot)") +wow64=true +if ! [ -f "$wine_path/$wine" ]; then + wine=$wine64 + wow64=false + wineboot="$wine64 wineboot" +fi + +# resolve 32-bit and 64-bit system32 path +winever=$($wine --version | grep wine) +if [ -z "$winever" ]; then + echo "$wine:"' Not a wine executable. Check your $wine.' >&2 + wait + exit 1 +fi + +# ensure wine placeholder dlls are recreated +# if they are missing +$wineboot -u + +win64_sys_path=$($wine64 winepath -u 'C:\windows\system32' 2> /dev/null) +win64_sys_path="${win64_sys_path/$'\r'/}" +if $wow64; then + win32_sys_path=$($wine winepath -u 'C:\windows\system32' 2> /dev/null) + win32_sys_path="${win32_sys_path/$'\r'/}" +fi + +if [ -z "$win32_sys_path" ] && [ -z "$win64_sys_path" ]; then + echo 'Failed to resolve C:\windows\system32.' >&2 + wait + exit 1 +fi + +# create native dll override +overrideDll() { + $wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d native /f >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo -e "Failed to add override for $1" + wait + exit 1 + fi +} + +# remove dll override +restoreDll() { + $wine reg delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /f > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Failed to remove override for $1" + fi +} + +# copy or link dxvk dll, back up original file +installFile() { + dstfile="${1}/${3}.dll" + srcfile="${basedir}/${2}/${3}.dll" + + if [ -f "${srcfile}.so" ]; then + srcfile="${srcfile}.so" + fi + + if ! [ -f "${srcfile}" ]; then + echo "${srcfile}: File not found. Skipping." >&2 + return 1 + fi + + if [ -n "$1" ]; then + if [ -f "${dstfile}" ] || [ -h "${dstfile}" ]; then + if ! [ -f "${dstfile}.old" ]; then + mv -v "${dstfile}" "${dstfile}.old" + else + rm -v "${dstfile}" + fi + $file_cmd "${srcfile}" "${dstfile}" + else + echo "${dstfile}: File not found in wine prefix" >&2 + return 1 + fi + fi + return 0 +} + +# remove dxvk dll, restore original file +uninstallFile() { + dstfile="${1}/${3}.dll" + srcfile="${basedir}/${2}/${3}.dll" + + if [ -f "${srcfile}.so" ]; then + srcfile="${srcfile}.so" + fi + + if ! [ -f "${srcfile}" ]; then + echo "${srcfile}: File not found. Skipping." >&2 + return 1 + fi + + if ! [ -f "${dstfile}" ] && ! [ -h "${dstfile}" ]; then + echo "${dstfile}: File not found. Skipping." >&2 + return 1 + fi + + if [ -f "${dstfile}.old" ]; then + rm -v "${dstfile}" + mv -v "${dstfile}.old" "${dstfile}" + return 0 + else + return 1 + fi +} + +install() { + installFile "$win64_sys_path" "$dxvk_lib64" "$1" + inst64_ret="$?" + + inst32_ret=-1 + if $wow64; then + installFile "$win32_sys_path" "$dxvk_lib32" "$1" + inst32_ret="$?" + fi + + if (( ($inst32_ret == 0) || ($inst64_ret == 0) )); then + overrideDll "$1" + fi +} + +uninstall() { + uninstallFile "$win64_sys_path" "$dxvk_lib64" "$1" + uninst64_ret="$?" + + uninst32_ret=-1 + if $wow64; then + uninstallFile "$win32_sys_path" "$dxvk_lib32" "$1" + uninst32_ret="$?" + fi + + if (( ($uninst32_ret == 0) || ($uninst64_ret == 0) )); then + restoreDll "$1" + fi +} + +# skip dxgi during install if not explicitly +# enabled, but always try to uninstall it +if $with_dxgi || [ "$action" == "uninstall" ]; then + $action dxgi +fi + +$action d3d9 + +if $with_d3d10 || [ "$action" == "uninstall" ]; then + $action d3d10 + $action d3d10_1 +fi + +$action d3d10core +$action d3d11 +wait \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10.dll new file mode 100755 index 0000000..7cc8c6c Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10_1.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10_1.dll new file mode 100755 index 0000000..658870b Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10_1.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10core.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10core.dll new file mode 100755 index 0000000..de5ce82 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d10core.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d11.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d11.dll new file mode 100755 index 0000000..11f0602 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d11.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d9.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d9.dll new file mode 100755 index 0000000..e170c8a Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x32/d3d9.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x32/dxgi.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x32/dxgi.dll new file mode 100755 index 0000000..45b2796 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x32/dxgi.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10.dll new file mode 100755 index 0000000..3c9fa15 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10_1.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10_1.dll new file mode 100755 index 0000000..265c0e0 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10_1.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10core.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10core.dll new file mode 100755 index 0000000..6408c73 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d10core.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d11.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d11.dll new file mode 100755 index 0000000..4011e2c Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d11.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d9.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d9.dll new file mode 100755 index 0000000..738f075 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x64/d3d9.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/dxvk/x64/dxgi.dll b/deb/opt/apps/deepin-wine-runner/dxvk/x64/dxgi.dll new file mode 100755 index 0000000..f4cdb85 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dxvk/x64/dxgi.dll differ diff --git a/deb/opt/apps/deepin-wine-runner/information.json b/deb/opt/apps/deepin-wine-runner/information.json index 80ad2f8..40201e6 100755 --- a/deb/opt/apps/deepin-wine-runner/information.json +++ b/deb/opt/apps/deepin-wine-runner/information.json @@ -1,5 +1,5 @@ { - "Version": "1.9.0Alpha1", + "Version": "1.9.0", "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 c3db03d..563a6bf 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/usr/bin/deepin-wine-runner-wine-dxvk-setup b/deb/usr/bin/deepin-wine-runner-wine-dxvk-setup new file mode 120000 index 0000000..51b488f --- /dev/null +++ b/deb/usr/bin/deepin-wine-runner-wine-dxvk-setup @@ -0,0 +1 @@ +/opt/apps/deepin-wine-runner/dxvk/setup_dxvk.sh \ No newline at end of file diff --git a/deb/usr/bin/deepin-wine-runner-wine-font-installer b/deb/usr/bin/deepin-wine-runner-wine-font-installer new file mode 120000 index 0000000..696be11 --- /dev/null +++ b/deb/usr/bin/deepin-wine-runner-wine-font-installer @@ -0,0 +1 @@ +/opt/apps/deepin-wine-runner/InstallFont.py \ No newline at end of file diff --git a/dxvk/setup_dxvk.sh b/dxvk/setup_dxvk.sh new file mode 100755 index 0000000..4bbaf64 --- /dev/null +++ b/dxvk/setup_dxvk.sh @@ -0,0 +1,232 @@ +#!/usr/bin/env bash +function wait(){ + echo Press Enter To Exit + read +} +# default directories +dxvk_lib32=${dxvk_lib32:-"x32"} +dxvk_lib64=${dxvk_lib64:-"x64"} + +# figure out where we are +basedir=$(dirname "$(readlink -f $0)") + +# figure out which action to perform +action="$1" + +case "$action" in +install) + ;; +uninstall) + ;; +*) + echo "Unrecognized action: $action" + echo "Usage: $0 [install|uninstall] [--without-dxgi] [--with-d3d10] [--symlink]" + wait + exit 1 +esac + +# process arguments +shift + +with_dxgi=true +with_d3d10=false +file_cmd="cp -v" + +while (($# > 0)); do + case "$1" in + "--without-dxgi") + with_dxgi=false + ;; + "--with-d3d10") + with_d3d10=true + ;; + "--symlink") + file_cmd="ln -s -v" + ;; + esac + shift +done + +# check wine prefix before invoking wine, so that we +# don't accidentally create one if the user screws up +if [ -n "$WINEPREFIX" ] && ! [ -f "$WINEPREFIX/system.reg" ]; then + echo "$WINEPREFIX:"' Not a valid wine prefix.' >&2 + wait + exit 1 +fi + +# find wine executable +export WINEDEBUG=-all +# disable mscoree and mshtml to avoid downloading +# wine gecko and mono +export WINEDLLOVERRIDES="mscoree,mshtml=" +# 专门添加,为了可以使用自定义的 wine +wine=$WINE +wine64=$WINE64 +wineboot="$WINE wineboot" +if [[ $WINE == "" ]];then + wine="wine" +fi +if [[ $WINE64 == "" ]];then + wine64="wine64" +fi + +# $PATH is the way for user to control where wine is located (including custom Wine versions). +# Pure 64-bit Wine (non Wow64) requries skipping 32-bit steps. +# In such case, wine64 and winebooot will be present, but wine binary will be missing, +# however it can be present in other PATHs, so it shouldn't be used, to avoid versions mixing. +wine_path=$(dirname "$(which $wineboot)") +wow64=true +if ! [ -f "$wine_path/$wine" ]; then + wine=$wine64 + wow64=false + wineboot="$wine64 wineboot" +fi + +# resolve 32-bit and 64-bit system32 path +winever=$($wine --version | grep wine) +if [ -z "$winever" ]; then + echo "$wine:"' Not a wine executable. Check your $wine.' >&2 + wait + exit 1 +fi + +# ensure wine placeholder dlls are recreated +# if they are missing +$wineboot -u + +win64_sys_path=$($wine64 winepath -u 'C:\windows\system32' 2> /dev/null) +win64_sys_path="${win64_sys_path/$'\r'/}" +if $wow64; then + win32_sys_path=$($wine winepath -u 'C:\windows\system32' 2> /dev/null) + win32_sys_path="${win32_sys_path/$'\r'/}" +fi + +if [ -z "$win32_sys_path" ] && [ -z "$win64_sys_path" ]; then + echo 'Failed to resolve C:\windows\system32.' >&2 + wait + exit 1 +fi + +# create native dll override +overrideDll() { + $wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d native /f >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo -e "Failed to add override for $1" + wait + exit 1 + fi +} + +# remove dll override +restoreDll() { + $wine reg delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /f > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Failed to remove override for $1" + fi +} + +# copy or link dxvk dll, back up original file +installFile() { + dstfile="${1}/${3}.dll" + srcfile="${basedir}/${2}/${3}.dll" + + if [ -f "${srcfile}.so" ]; then + srcfile="${srcfile}.so" + fi + + if ! [ -f "${srcfile}" ]; then + echo "${srcfile}: File not found. Skipping." >&2 + return 1 + fi + + if [ -n "$1" ]; then + if [ -f "${dstfile}" ] || [ -h "${dstfile}" ]; then + if ! [ -f "${dstfile}.old" ]; then + mv -v "${dstfile}" "${dstfile}.old" + else + rm -v "${dstfile}" + fi + $file_cmd "${srcfile}" "${dstfile}" + else + echo "${dstfile}: File not found in wine prefix" >&2 + return 1 + fi + fi + return 0 +} + +# remove dxvk dll, restore original file +uninstallFile() { + dstfile="${1}/${3}.dll" + srcfile="${basedir}/${2}/${3}.dll" + + if [ -f "${srcfile}.so" ]; then + srcfile="${srcfile}.so" + fi + + if ! [ -f "${srcfile}" ]; then + echo "${srcfile}: File not found. Skipping." >&2 + return 1 + fi + + if ! [ -f "${dstfile}" ] && ! [ -h "${dstfile}" ]; then + echo "${dstfile}: File not found. Skipping." >&2 + return 1 + fi + + if [ -f "${dstfile}.old" ]; then + rm -v "${dstfile}" + mv -v "${dstfile}.old" "${dstfile}" + return 0 + else + return 1 + fi +} + +install() { + installFile "$win64_sys_path" "$dxvk_lib64" "$1" + inst64_ret="$?" + + inst32_ret=-1 + if $wow64; then + installFile "$win32_sys_path" "$dxvk_lib32" "$1" + inst32_ret="$?" + fi + + if (( ($inst32_ret == 0) || ($inst64_ret == 0) )); then + overrideDll "$1" + fi +} + +uninstall() { + uninstallFile "$win64_sys_path" "$dxvk_lib64" "$1" + uninst64_ret="$?" + + uninst32_ret=-1 + if $wow64; then + uninstallFile "$win32_sys_path" "$dxvk_lib32" "$1" + uninst32_ret="$?" + fi + + if (( ($uninst32_ret == 0) || ($uninst64_ret == 0) )); then + restoreDll "$1" + fi +} + +# skip dxgi during install if not explicitly +# enabled, but always try to uninstall it +if $with_dxgi || [ "$action" == "uninstall" ]; then + $action dxgi +fi + +$action d3d9 + +if $with_d3d10 || [ "$action" == "uninstall" ]; then + $action d3d10 + $action d3d10_1 +fi + +$action d3d10core +$action d3d11 +wait \ No newline at end of file diff --git a/dxvk/x32/d3d10.dll b/dxvk/x32/d3d10.dll new file mode 100755 index 0000000..7cc8c6c Binary files /dev/null and b/dxvk/x32/d3d10.dll differ diff --git a/dxvk/x32/d3d10_1.dll b/dxvk/x32/d3d10_1.dll new file mode 100755 index 0000000..658870b Binary files /dev/null and b/dxvk/x32/d3d10_1.dll differ diff --git a/dxvk/x32/d3d10core.dll b/dxvk/x32/d3d10core.dll new file mode 100755 index 0000000..de5ce82 Binary files /dev/null and b/dxvk/x32/d3d10core.dll differ diff --git a/dxvk/x32/d3d11.dll b/dxvk/x32/d3d11.dll new file mode 100755 index 0000000..11f0602 Binary files /dev/null and b/dxvk/x32/d3d11.dll differ diff --git a/dxvk/x32/d3d9.dll b/dxvk/x32/d3d9.dll new file mode 100755 index 0000000..e170c8a Binary files /dev/null and b/dxvk/x32/d3d9.dll differ diff --git a/dxvk/x32/dxgi.dll b/dxvk/x32/dxgi.dll new file mode 100755 index 0000000..45b2796 Binary files /dev/null and b/dxvk/x32/dxgi.dll differ diff --git a/dxvk/x64/d3d10.dll b/dxvk/x64/d3d10.dll new file mode 100755 index 0000000..3c9fa15 Binary files /dev/null and b/dxvk/x64/d3d10.dll differ diff --git a/dxvk/x64/d3d10_1.dll b/dxvk/x64/d3d10_1.dll new file mode 100755 index 0000000..265c0e0 Binary files /dev/null and b/dxvk/x64/d3d10_1.dll differ diff --git a/dxvk/x64/d3d10core.dll b/dxvk/x64/d3d10core.dll new file mode 100755 index 0000000..6408c73 Binary files /dev/null and b/dxvk/x64/d3d10core.dll differ diff --git a/dxvk/x64/d3d11.dll b/dxvk/x64/d3d11.dll new file mode 100755 index 0000000..4011e2c Binary files /dev/null and b/dxvk/x64/d3d11.dll differ diff --git a/dxvk/x64/d3d9.dll b/dxvk/x64/d3d9.dll new file mode 100755 index 0000000..738f075 Binary files /dev/null and b/dxvk/x64/d3d9.dll differ diff --git a/dxvk/x64/dxgi.dll b/dxvk/x64/dxgi.dll new file mode 100755 index 0000000..f4cdb85 Binary files /dev/null and b/dxvk/x64/dxgi.dll differ diff --git a/information.json b/information.json index 80ad2f8..40201e6 100755 --- a/information.json +++ b/information.json @@ -1,5 +1,5 @@ { - "Version": "1.9.0Alpha1", + "Version": "1.9.0", "Thank": [ "感谢 @a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301", "感谢 @zhangs https://bbs.deepin.org/post/227948", diff --git a/mainwindow.py b/mainwindow.py index 61a9f45..07f027d 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -296,9 +296,22 @@ def ListToDictionary(list): def CleanProgramHistory(): if QtWidgets.QMessageBox.question(widget, "警告", "删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。") == QtWidgets.QMessageBox.Yes: - shutil.rmtree(get_home() + "/.config/deepin-wine-runner") + try: + shutil.rmtree(get_home() + "/.config/deepin-wine-runner") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) ReStartProgram() +def CleanProgramCache(): + try: + shutil.rmtree(get_home() + "/.cache/deepin-wine-runner") + QtWidgets.QMessageBox.information(widget, "提示", "缓存清理完毕!") + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc()) + + # 重启本应用程序 def ReStartProgram(): python = sys.executable @@ -429,35 +442,60 @@ def RunWinetricks(): runWinetricks.signal.connect(QT.ShowWineReturn) runWinetricks.start() - +def FontAppStore(): + if e1.currentText() == "": + wineBottonPath = setting["DefultBotton"] + else: + wineBottonPath = e1.currentText() + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallFont.py' '{wineBottonPath}' {int(setting['RuntimeCache'])}") def InstallMonoGecko(program): if e1.currentText() == "": wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallMono.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {program}") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{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()]}'") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{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()]}'") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{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()]}'") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallMsxml.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") + +def InstallDXVK(): + if e1.currentText() == "": + 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", "install"]) + +def UninstallDXVK(): + if e1.currentText() == "": + 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"]) def MiniAppStore(): if e1.currentText()== "": @@ -471,7 +509,7 @@ def InstallOther(): wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallOther.py' '{wineBottonPath}' '{wine[o1.currentText()]}'") + os.system(f"'{programPath}/launch.sh' deepin-terminal -e '{programPath}/InstallOther.py' '{wineBottonPath}' '{wine[o1.currentText()]}' {int(setting['RuntimeCache'])}") def BuildExeDeb(): if e1.currentText() == "": @@ -821,6 +859,8 @@ class ProgramSetting(): message = None theme = None monogeckoInstaller = None + autoWine = None + runtimeCache = None def ShowWindow(): ProgramSetting.message = QtWidgets.QMainWindow() widget = QtWidgets.QWidget() @@ -833,6 +873,8 @@ class ProgramSetting(): widgetLayout.addWidget(QtWidgets.QLabel("自定义 wine 参数:"), 5, 0, 1, 1) widgetLayout.addWidget(QtWidgets.QLabel("程序主题:"), 6, 0, 1, 1) widgetLayout.addWidget(QtWidgets.QLabel("Wine 默认 Mono 和 Gecko 安装器:"), 7, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel("忽略未安装的 Wine:"), 8, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel("下载缓存:"), 9, 0, 1, 1) ProgramSetting.wineBottonA = QtWidgets.QComboBox() ProgramSetting.wineDebug = QtWidgets.QCheckBox("开启 DEBUG 输出") ProgramSetting.defultWine = QtWidgets.QComboBox() @@ -849,6 +891,8 @@ class ProgramSetting(): ProgramSetting.terminalOpen = QtWidgets.QCheckBox("使用终端打开(deepin 终端)") ProgramSetting.wineOption = QtWidgets.QLineEdit() ProgramSetting.monogeckoInstaller = QtWidgets.QCheckBox("屏蔽 Wine 默认 Mono 和 Gecko 安装器") + ProgramSetting.autoWine = QtWidgets.QCheckBox("不显示未检测到的 Wine") + ProgramSetting.runtimeCache = QtWidgets.QCheckBox("开启下载缓存") ProgramSetting.wineBottonA.addItems(["Auto", "win32", "win64"]) ProgramSetting.wineBottonA.setCurrentText(setting["Architecture"]) ProgramSetting.wineDebug.setChecked(setting["Debug"]) @@ -858,6 +902,8 @@ class ProgramSetting(): ProgramSetting.terminalOpen.setChecked(setting["TerminalOpen"]) ProgramSetting.wineOption.setText(setting["WineOption"]) ProgramSetting.monogeckoInstaller.setChecked(setting["MonoGeckoInstaller"]) + ProgramSetting.autoWine.setChecked(setting["AutoWine"]) + ProgramSetting.runtimeCache.setChecked(setting["RuntimeCache"]) widgetLayout.addWidget(ProgramSetting.wineBottonA, 0, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.wineDebug, 1, 1, 1, 1) widgetLayout.addWidget(ProgramSetting.defultWine, 2, 1, 1, 1) @@ -868,12 +914,13 @@ class ProgramSetting(): widgetLayout.addWidget(ProgramSetting.theme, 6, 1, 1, 1) widgetLayout.addWidget(themeTry, 6, 2, 1, 1) widgetLayout.addWidget(ProgramSetting.monogeckoInstaller, 7, 1, 1, 1) - widgetLayout.addWidget(save, 8, 2, 1, 1) + widgetLayout.addWidget(ProgramSetting.autoWine, 8, 1, 1, 1) + widgetLayout.addWidget(ProgramSetting.runtimeCache, 9, 1, 1, 1) + widgetLayout.addWidget(save, 10, 2, 1, 1) widget.setLayout(widgetLayout) ProgramSetting.message.setCentralWidget(widget) ProgramSetting.message.setWindowTitle(f"设置 wine 运行器 {version}") ProgramSetting.message.show() - return def Browser(): path = QtWidgets.QFileDialog.getExistingDirectory(ProgramSetting.message, "选择 Wine 容器", json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"]) @@ -894,6 +941,8 @@ class ProgramSetting(): setting["WineOption"] = ProgramSetting.wineOption.text() setting["Theme"] = ProgramSetting.theme.currentText() setting["MonoGeckoInstaller"] = ProgramSetting.monogeckoInstaller.isChecked() + setting["AutoWine"] = ProgramSetting.autoWine.isChecked() + setting["RuntimeCache"] = ProgramSetting.runtimeCache.isChecked() try: write_txt(get_home() + "/.config/deepin-wine-runner/WineSetting.json", json.dumps(setting)) except: @@ -916,7 +965,8 @@ defultProgramList = { "CenterWindow": False, "Theme": "", "MonoGeckoInstaller": True, - "AutoWine": True + "AutoWine": True, + "RuntimeCache": True } if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹 os.mkdir(get_home() + "/.config/deepin-wine-runner") # 创建配置文件夹 @@ -1013,6 +1063,9 @@ exe路径\' 参数 \' updateThingsString = '''※1、修复了重复路径一直自动重复增加的问题 ※2、修复了两个打包器打包错误的问题(非基于生态活动脚本的为 wine 导入错误,基于生态活动脚本的为架构有误导致打包出的 deb 无法打包) ※3、适配了部分非 i386、amd64 架构计算机的 UOS 系统使用的 wine +※4、支持安装 dxvk(遵守 Zlib 开源协议) +5、支持不显示没有安装的 Wine,方便用户识别 +6、增加字体商店 ''' for i in information["Thank"]: thankText += f"{i}\n" @@ -1143,18 +1196,22 @@ programManager.addWidget(QtWidgets.QLabel("WINE配置:"), 2, 0, 1, 1) wineConfig = QtWidgets.QPushButton("配置容器") wineConfig.clicked.connect(lambda: RunWineProgram("winecfg")) programManager.addWidget(wineConfig, 3, 0, 1, 1) -button_r_6 = QtWidgets.QPushButton("安装字体") +fontAppStore = QtWidgets.QPushButton("字体商店") +fontAppStore.clicked.connect(FontAppStore) +programManager.addWidget(fontAppStore, 3, 2, 1, 1) +button_r_6 = QtWidgets.QPushButton("安装自定义字体") button_r_6.clicked.connect(OpenWineFontPath) -programManager.addWidget(button_r_6, 3, 2, 1, 1) +programManager.addWidget(button_r_6, 3, 4, 1, 1) sparkWineSetting = QtWidgets.QPushButton("星火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, 4, 1, 1) +programManager.addWidget(sparkWineSetting, 3, 6, 1, 1) # 权重 button5.setSizePolicy(size) saveDesktopFileOnLauncher.setSizePolicy(size) label_r_2.setSizePolicy(size) getProgramIcon.setSizePolicy(size) -trasButton.setSizePolicy(size) +#trasButton.setSizePolicy(size) +button_r_6.setSizePolicy(size) wineConfig.setSizePolicy(size) returnText = QtWidgets.QTextBrowser() @@ -1194,18 +1251,22 @@ p1 = QtWidgets.QAction("安装 wine(&I)") installWineOnDeepin23 = QtWidgets.QAction("安装 wine(只限Deepin23)") p2 = QtWidgets.QAction("设置程序(&S)") p3 = QtWidgets.QAction("清空软件历史记录(&C)") +cleanCache = QtWidgets.QAction("清空软件缓存") p4 = QtWidgets.QAction("退出程序(&E)") programmenu.addAction(p1) programmenu.addAction(installWineOnDeepin23) programmenu.addSeparator() programmenu.addAction(p2) +programmenu.addSeparator() programmenu.addAction(p3) +programmenu.addAction(cleanCache) programmenu.addSeparator() programmenu.addAction(p4) p1.triggered.connect(InstallWine) installWineOnDeepin23.triggered.connect(InstallWineOnDeepin23) p2.triggered.connect(ProgramSetting.ShowWindow) p3.triggered.connect(CleanProgramHistory) +cleanCache.triggered.connect(CleanProgramCache) p4.triggered.connect(window.close) wineOption = menu.addMenu("Wine(&W)") @@ -1276,6 +1337,11 @@ wm4_1 = QtWidgets.QAction("安装 winbind") wm4_2 = QtWidgets.QAction("卸载 winbind") wm4.addAction(wm4_1) wm4.addAction(wm4_2) +dxvkMenu = wineOption.addMenu("安装/卸载 DXVK") +installDxvk = QtWidgets.QAction("安装 DXVK") +uninstallDxvk = QtWidgets.QAction("卸载 DXVK") +dxvkMenu.addAction(installDxvk) +dxvkMenu.addAction(uninstallDxvk) w1.triggered.connect(OpenWineBotton) w2.triggered.connect(InstallWineFont) w3.triggered.connect(OpenWineFontPath) @@ -1304,6 +1370,8 @@ wm3_1.triggered.connect(lambda: RunWineProgram(f"regedit.exe' /s '{programPath}/ wm3_2.triggered.connect(lambda: RunWineProgram(f"regedit.exe' /s '{programPath}/DisabledOpengl.reg")) wm4_1.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt install winbind -y' --keep-open")) wm4_2.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt purge winbind -y' --keep-open")) +installDxvk.triggered.connect(InstallDXVK) +uninstallDxvk.triggered.connect(UninstallDXVK) virtualMachine = menu.addMenu("虚拟机(&V)") v1 = QtWidgets.QAction("使用 Virtualbox 虚拟机运行 Windows 应用") diff --git a/package-script.zip b/package-script.zip index c3db03d..563a6bf 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 9f5cf38..6175d4f 100755 --- a/package-script/information.json +++ b/package-script/information.json @@ -1,3 +1,3 @@ { - "Version": "1.9.0Alpha1" + "Version": "1.9.0" }