From 746173b3bfe66ccc89835cacb25e88c2e9ff47ed Mon Sep 17 00:00:00 2001
From: gfdgd xi <3025613752@qq.com>
Date: Sat, 22 May 2021 16:54:16 +0800
Subject: [PATCH] =?UTF-8?q?1.3.0=E2=80=94=E2=80=941=E3=80=81=E4=BF=AE?=
 =?UTF-8?q?=E6=94=B9=E4=BA=86=E7=AA=97=E5=8F=A3=E6=98=BE=E7=A4=BA=E6=8E=A7?=
 =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=BA=93=EF=BC=88=E4=BB=8E=20tkinter=20?=
 =?UTF-8?q?=E5=88=B0=20tkinter.ttk=EF=BC=89=EF=BC=9B2=E3=80=81=E6=B7=BB?=
 =?UTF-8?q?=E5=8A=A0=E4=BA=86=E6=9B=B4=E5=A4=9A=20wine=20=E5=8F=AF?=
 =?UTF-8?q?=E4=BB=A5=E9=80=89=E6=8B=A9=EF=BC=88deepin-wine=E3=80=81deepin-?=
 =?UTF-8?q?wine5=E3=80=81wine=E3=80=81wine64=E3=80=81deepin-wine5-stable?=
 =?UTF-8?q?=E3=80=81deepin-wine6-stable=EF=BC=89=EF=BC=9B3=E3=80=81?=
 =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=A8=8B=E5=BA=8F=E7=9A=84=E6=8F=90?=
 =?UTF-8?q?=E7=A4=BA=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md | 23 +++++++++++++++++------
 main.py   | 54 +++++++++++++++++++++++++++++-------------------------
 2 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/README.md b/README.md
index 271005c..b6f0341 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-# deepin-wine 运行器
+# wine 运行器
 
 #### 介绍
 一个图形化了以下命令的程序
 
 ```
-WINEPREFIX=容器路径 deepin-wine 可执行文件路径
+WINEPREFIX=容器路径 wine(wine的路径) 可执行文件路径
 ```
 让你的 deepin-wine 打包轻松一点
 
@@ -12,10 +12,10 @@ WINEPREFIX=容器路径 deepin-wine 可执行文件路径
 
 (自己美术功底太差,图标只能在网络上找了)
 
-(测试平台:deepin 20.1 1030)
+(测试平台:deepin 20.1 1030;UOS 家庭版 21)
 
 #### 软件架构
-i386 和 amd64,deepin-wine 和 deepin-wine5 运行在哪就运行在哪
+i386 和 amd64,deepin-wine、deepin-wine5、wine、wine64、deepin-wine5-stable、deepin-wine6-stable 运行在哪就运行在哪
 
 
 #### 安装教程
@@ -23,7 +23,9 @@ i386 和 amd64,deepin-wine 和 deepin-wine5 运行在哪就运行在哪
 1.  安装所需依赖
 
 ```
-sudo apt install deepin-wine python3 python3-tk git
+sudo apt install python3 python3-tk git 
+# 可选
+# sudo apt install deepin-wine deepin-wine5 wine wine64
 ```
 
 2.  下载本程序
@@ -44,9 +46,18 @@ chmod 777 main.py
 #### 使用说明
 
 (均在软件的“小提示”里有说明)
-1.  使用终端运行该程序,可以看到 deepin-wine(deepin-wine5)以及程序本身的提示和报错
+1、使用终端运行该程序,可以看到 wine 以及程序本身的提示和报错
+2、wine 32 位和 64 位的容器互不兼容
 
 #### 更新日志
+
+1.3.0 更新内容:
+    1、修改了窗口显示控件的库(从 tkinter 到 tkinter.ttk)
+
+    2、添加了更多 wine 可以选择(deepin-wine、deepin-wine5、wine、wine64、deepin-wine5-stable、deepin-wine6-stable)
+
+    3、修改了程序的提示信息
+
 1.2.0 更新内容:
     1、修改布局方式
 
diff --git a/main.py b/main.py
index c74bba9..9a9a0b1 100755
--- a/main.py
+++ b/main.py
@@ -1,20 +1,24 @@
 #!/usr/bin/env python3
-#########################################################################
+# 使用系统默认的 python3 运行
+###########################################################################################
 # 作者:gfdgd xi
-# 版本:1.2.0
-# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序
+# 版本:1.3.0
+# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
 # 基于 Python3 的 tkinter 构建
-#########################################################################
+###########################################################################################
 #################
 # 引入所需的库
 #################
 import tkinter as tk
+import tkinter.ttk as ttk
 import tkinter.filedialog
 import tkinter.messagebox
 import os
 import threading
 import webbrowser
 
+wine = {"deepin-wine": "deepin-wine", "deepin-wine5": "deepin-wine5", "wine": "wine", "wine64": "wine64", "deepin-wine5 stable(需运行使用 deepin-wine5 stable 打包的应用后才能使用)": "~/.deepinwine/deepin-wine5-stable/bin/wine", "deepin-wine6 stable 32 位(需运行使用 deepin-wine6 stable 打包的应用后才能使用)": "~/.deepinwine/deepin-wine6-stable/bin/wine", "deepin-wine6 stable 64 位(需运行使用 deepin-wine6 stable 打包的应用后才能使用)": "~/.deepinwine/deepin-wine6-stable/bin/wine64"}
+
 ###################
 # 程序所需事件
 ###################
@@ -56,13 +60,13 @@ def get_home():
 
 # 第一个浏览按钮事件
 def liulanbutton():
-    path = tkinter.filedialog.askdirectory(title="选择 deepin-wine 容器", initialdir="~/.deepinwine/")
+    path = tkinter.filedialog.askdirectory(title="选择 wine 容器", initialdir="~/.deepinwine/")
     if path != "":
         e1_text.set(path)
 
 # 第二个浏览按钮事件
 def liulanexebutton():
-    path = tkinter.filedialog.askopenfilename(title="选择 exe 可执行文件", filetypes=[("exe 可执行文件", "*.exe"), ("所有文件", "*.*")], initialdir="~/")
+    path = tkinter.filedialog.askopenfilename(title="选择 exe 可执行文件", filetypes=[("exe 可执行文件", "*.exe"), ("EXE 可执行文件", "*.EXE"), ("所有文件", "*.*")], initialdir="~/")
     if path != "":
         e2_text.set(path)
 
@@ -84,24 +88,24 @@ def DisableButton(things):
 def runexebutton_threading():
     DisableButton(True)
     if e1_text.get() == "" or e2_text.get() == "":  # 判断文本框是否有内容
-        tkinter.messagebox.showinfo(title="提示", message="没有填写需要使用的 deepin-wine 容器或需要运行的 exe 应用")
+        tkinter.messagebox.showinfo(title="提示", message="没有填写需要使用的 wine 容器或需要运行的 exe 应用")
     else:  # 如果都有
-        os.system("WINEPREFIX='" + e1_text.get() + "' " + o1_text.get() + " '" + e2_text.get() + "'")  # 运行
+        os.system("WINEPREFIX='" + e1_text.get() + "' " + wine[o1_text.get()] + " '" + e2_text.get() + "'")  # 运行
     DisableButton(False)
 
 # 显示“关于这个程序”窗口
 def about_this_program():
-    tkinter.messagebox.showinfo(title="关于这个程序", message="一个基于 Python3 的 tkinter 制作的 deepin-wine(deepin-wine5) 运行器\n版本:1.2.0\n适用平台:Linux\ntkinter 版本:" + str(tk.TkVersion) + "\n程序官网:https://gitee.com/gfdgd-xi/deep-wine-runner")
+    tkinter.messagebox.showinfo(title="关于这个程序", message="一个基于 Python3 的 tkinter 制作的 wine 运行器\n版本:1.3.0\n适用平台:Linux\ntkinter 版本:" + str(tk.TkVersion) + "\n程序官网:https://gitee.com/gfdgd-xi/deep-wine-runner")
 
 # 显示“提示”窗口
 def helps():
-    tkinter.messagebox.showinfo(title="提示", message="提示:\n1、使用终端运行该程序,可以看到 deepin-wine(deepin-wine5) 以及程序本身的提示和报错")
+    tkinter.messagebox.showinfo(title="提示", message="提示:\n1、使用终端运行该程序,可以看到 wine 以及程序本身的提示和报错\n2、wine 32 位和 64 位的容器互不兼容")
 
 # 生成 shell 文件在桌面
 # (第四个按钮的事件)
 def make_desktop_on_desktop():
     if e3_text.get() == "" or e2_text.get() == "" or e1_text.get() == "":  # 判断文本框是否有内容
-        tkinter.messagebox.showinfo(title="提示", message="没有填写需要使用的 deepin-wine 容器或需要运行的 exe 应用或保存的文件名")
+        tkinter.messagebox.showinfo(title="提示", message="没有填写需要使用的 wine 容器或需要运行的 exe 应用或保存的文件名")
     else:  # 如果都有
         if os.path.exists(get_desktop_path() + "/" + e3_text.get() + ".sh"): # 判断目录是否有该文件,如果有
             choose = tkinter.messagebox.askokcancel(title="提示", message="文件已经存在,是否覆盖?")  # 询问用户是否覆盖
@@ -110,7 +114,7 @@ def make_desktop_on_desktop():
             else:  # 如不覆盖
                 return  # 结束
         os.mknod(get_desktop_path() + "/" + e3_text.get() + ".sh")  # 创建文本文档
-        write_txt(get_desktop_path() + "/" + e3_text.get() + ".sh", "#!/bin/bash\n" + "WINEPREFIX='" + e1_text.get() + "' " + o1_text.get() + " '" + e2_text.get() + "'") # 写入文本文档
+        write_txt(get_desktop_path() + "/" + e3_text.get() + ".sh", "#!/bin/bash\n" + "WINEPREFIX='" + e1_text.get() + "' " + wine[o1_text.get()] + " '" + e2_text.get() + "'") # 写入文本文档
         os.system("chmod 777 '" + get_desktop_path() + "/" + e3_text.get() + ".sh" + "'")  # 赋予可执行权限
         tkinter.messagebox.showinfo(title="提示", message="生成完成!")  # 显示完成对话框
 
@@ -118,7 +122,7 @@ def make_desktop_on_desktop():
 # 窗口创建
 ###########################
 window = tk.Tk()  # 创建窗口
-window.title("deepin-wine 运行器")  # 设置标题
+window.title("wine 运行器")  # 设置标题
 # 设置变量以修改和获取值项
 e1_text = tk.StringVar()
 e2_text = tk.StringVar()
@@ -126,18 +130,18 @@ o1_text = tk.StringVar()
 e3_text = tk.StringVar()
 o1_text.set("deepin-wine")
 # 创建控件
-button1 = tk.Button(window, text="浏览", command=liulanbutton)  # 创建按钮控件
-button2 = tk.Button(window, text="浏览", command=liulanexebutton)  # 创建按钮控件
-button3 = tk.Button(window, text="启动", command=runexebutton)  # 创建按钮控件
-button5 = tk.Button(window, text="创建用于运行的 shell 文件到桌面", command=make_desktop_on_desktop)  # 创建按钮控件
-label1 = tk.Label(window, text="选择你想要使用的 deepin-wine 容器:")  # 创建标签控件
-label2 = tk.Label(window, text="选择要启动的 Windows 应用")  # 创建标签控件
-label3 = tk.Label(window, text="选择要使用的 deepin-wine 版本")  # 创建标签控件
-label4 = tk.Label(window, text="设置文件名,以便把上方填写的信息写入到 shell 文件里")  # 创建标签控件
-e1 = tk.Entry(window, textvariable=e1_text, width=50)  # 创建文本框控件
-e2 = tk.Entry(window, textvariable=e2_text, width=50)  # 创建文本框控件
-e3 = tk.Entry(window, textvariable=e3_text, width=50)  # 创建文本框控件
-o1 = tk.OptionMenu(window, o1_text, "deepin-wine", "deepin-wine5")  # 创建选择框控件
+button1 = ttk.Button(window, text="浏览", command=liulanbutton)  # 创建按钮控件
+button2 = ttk.Button(window, text="浏览", command=liulanexebutton)  # 创建按钮控件
+button3 = ttk.Button(window, text="启动", command=runexebutton)  # 创建按钮控件
+button5 = ttk.Button(window, text="创建用于运行的 shell 文件到桌面", command=make_desktop_on_desktop)  # 创建按钮控件
+label1 = ttk.Label(window, text="选择你想要使用的 wine 容器:")  # 创建标签控件
+label2 = ttk.Label(window, text="选择要启动的 Windows 应用")  # 创建标签控件
+label3 = ttk.Label(window, text="选择要使用的 wine 版本")  # 创建标签控件
+label4 = ttk.Label(window, text="设置文件名,以便把上方填写的信息写入到 shell 文件里")  # 创建标签控件
+e1 = ttk.Entry(window, textvariable=e1_text, width=50)  # 创建文本框控件
+e2 = ttk.Entry(window, textvariable=e2_text, width=50)  # 创建文本框控件
+e3 = ttk.Entry(window, textvariable=e3_text, width=50)  # 创建文本框控件
+o1 = ttk.OptionMenu(window, o1_text, "deepin-wine", "deepin-wine","deepin-wine5", "wine", "wine64", "deepin-wine5 stable(需运行使用 deepin-wine5 stable 打包的应用后才能使用)", "deepin-wine6 stable 32 位(需运行使用 deepin-wine6 stable 打包的应用后才能使用)", "deepin-wine6 stable 64 位(需运行使用 deepin-wine6 stable 打包的应用后才能使用)")  # 创建选择框控件
 menu = tk.Menu(window)  # 设置菜单栏
 programmenu = tk.Menu(menu, tearoff=0)  # 设置“程序”菜单栏
 menu.add_cascade(label="程序", menu=programmenu)