优化deepin-terminal在其它发行版的显示

This commit is contained in:
gfdgd xi 2022-07-05 20:58:46 +08:00
parent e2385b3511
commit b87cca719e
4 changed files with 85 additions and 14 deletions

52
InstallVisualCPlusPlus.py Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本1.5.1
# 更新时间2022年07月04日
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 的 tkinter 构建
###########################################################################################
#################
# 引入所需的库
#################
import os
import sys
if "--help" in sys.argv:
print("作者gfdgd xi、为什么您不喜欢熊出没和阿布呢")
print("版本1.0.0")
print("本程序可以更方便的在 wine 容器中安装 Visual Studio C++")
sys.exit()
if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "":
print("您未指定需要安装 Visual Studio C++ 的容器和使用的 wine无法继续")
print("参数:")
print("XXX 参数一 参数二")
print("参数一为需要安装的容器参数二为需要使用的wine两个参数位置不能颠倒")
sys.exit()
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"]
]
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++ 版本:"))
except:
print("输入错误,请重新输入")
continue
if 0 <= choose and choose < len(netList):
break
print(f"您选择了 Visual Studio C++ {netList[choose][0]}")
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")
print("安装结束")

View File

@ -417,6 +417,7 @@ def readtxt(path):
# 如果要添加其他 wine请在字典添加其名称和执行路径
wine = {"deepin-wine": "deepin-wine", "deepin-wine5": "deepin-wine5", "wine": "wine", "wine64": "wine64", "deepin-wine5 stable": "deepin-wine5-stable", "deepin-wine6 stable": "deepin-wine6-stable", "spark-wine7-devel": "spark-wine7-devel", "ukylin-wine": "ukylin-wine"}
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
iconPath = "{}/icon.png".format(programPath)
information = json.loads(readtxt(f"{programPath}/information.json"))
version = information["Version"]
tips = """提示:
@ -431,14 +432,9 @@ tips = """提示:
# 窗口创建
###############
window = tk.Tk()
# 设置窗口
style = ttkthemes.ThemedStyle(window)
style.set_theme("breeze")
window.title(f"wine 应用打包器 {version}")
# 设置变量以修改和获取值项
wineVersion = tk.StringVar()
wineVersion.set("deepin-wine6 stable")
#
e1_text = tk.StringVar()
e2_text = tk.StringVar()
e3_text = tk.StringVar()
@ -455,6 +451,7 @@ label13_text = tk.StringVar()
option1_text = tk.StringVar()
option1_text.set("Network")
label13_text.set("当前 deb 打包情况:暂未打包")
# 创建控件
label1 = ttk.Label(window, text="要打包的 deb 包的包名(※必填)")
label2 = ttk.Label(window, text="要打包的 deb 包的版本号(※必填)")
label3 = ttk.Label(window, text="要打包的 deb 包的说明(※必填)")
@ -500,11 +497,16 @@ programmenu.add_command(label="退出程序", command=window.quit) # 设置“
help = tk.Menu(menu, tearoff=0) # 设置“帮助”菜单栏
menu.add_cascade(label="帮助", menu=help)
help.add_command(label="小提示", command=helps) # 设置“小提示”项
# 设置窗口
style = ttkthemes.ThemedStyle(window)
style.set_theme("breeze")
window.title(f"wine 应用打包器 {version}")
window.iconphoto(False, tk.PhotoImage(file=iconPath))
# 控件配置
try:
#e6_text.set(sys.argv[1])
#wineVersion.set(sys.argv[2])
#print(os.path.splitext(sys.argv[1]))
pass
e6_text.set(sys.argv[1])
e5_text.set(pathlib.PurePath(sys.argv[1]).name)
wineVersion.set(sys.argv[2])
except:
pass
# 添加控件

3
launch.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
XDG_CURRENT_DESKTOP="Deepin"
$1 -platformtheme deepin "$@"

24
main.py
View File

@ -240,7 +240,7 @@ def KillProgram():
os.system("killall winedbg -9")
def InstallWine():
threading.Thread(target=os.system, args=[f"deepin-terminal -e \"{programPath}/AllInstall.py\""]).start()
threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e \"{programPath}/AllInstall.py\""]).start()
def OpenWineBotton():
if e1.get() == "":
@ -326,7 +326,7 @@ def InstallMonoGecko(program):
wineBottonPath = get_home() + "/.wine"
else:
wineBottonPath = e1.get()
os.system(f"deepin-terminal -C \"'{programPath}/InstallMono.py' '{wineBottonPath}' {wine[o1_text.get()]} {program}\" --keep-open")
os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"'{programPath}/InstallMono.py' '{wineBottonPath}' {wine[o1_text.get()]} {program}\" --keep-open")
DisableButton(False)
def InstallNetFramework():
@ -335,11 +335,24 @@ def InstallNetFramework():
wineBottonPath = get_home() + "/.wine"
else:
wineBottonPath = e1.get()
os.system(f"deepin-terminal -C \"'{programPath}/InstallNetFramework.py' '{wineBottonPath}' {wine[o1_text.get()]}\" --keep-open")
os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"'{programPath}/InstallNetFramework.py' '{wineBottonPath}' {wine[o1_text.get()]}\" --keep-open")
DisableButton(False)
def InstallVisualStudioCPlusPlus():
DisableButton(True)
if e1.get() == "":
wineBottonPath = get_home() + "/.wine"
else:
wineBottonPath = e1.get()
os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"'{programPath}/InstallVisualCPlusPlus.py' '{wineBottonPath}' {wine[o1_text.get()]}\" --keep-open")
DisableButton(False)
def BuildExeDeb():
pass
if e1.get() == "":
wineBottonPath = get_home() + "/.wine"
else:
wineBottonPath = e1.get()
threading.Thread(target=os.system, args=[f"python3 '{programPath}/deepin-wine-packager.py' '{wineBottonPath}' '{wine[o1_text.get()]}'"]).start()
###########################
# 加载配置
@ -401,7 +414,7 @@ updateThingsString = '''※1、支持打开 spark-wine7-devel 的专门缩放设
9双击使用 wine 运行器打开 exe不知道能不能生效
'''
title = "wine 运行器 {}".format(version)
updateTime = "2022年07月04"
updateTime = "2022年07月05"
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
@ -453,6 +466,7 @@ menu.add_cascade(label="Wine", menu=wineOption)
wineOption.add_command(label="打包 wine 应用", command=BuildExeDeb)
wineOption.add_separator()
wineOption.add_command(label="在指定wine、指定容器安装 .net framework", command=lambda: threading.Thread(target=InstallNetFramework).start())
wineOption.add_command(label="在指定wine、指定容器安装 Visual Studio C++", command=lambda: threading.Thread(target=InstallVisualStudioCPlusPlus).start())
wineOption.add_command(label="在指定wine、指定容器安装 gecko", command=lambda: threading.Thread(target=InstallMonoGecko, args=["gecko"]).start())
wineOption.add_command(label="在指定wine、指定容器安装 mono", command=lambda: threading.Thread(target=InstallMonoGecko, args=["mono"]).start())
wineOption.add_command(label="打开指定wine、指定容器的注册表", command=lambda: threading.Thread(target=RunWineProgram, args=["regedit"]).start())