mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-06-04 14:19:50 +08:00
1.4.0
This commit is contained in:
parent
8f021870d5
commit
f003a29e48
@ -1,9 +1,9 @@
|
|||||||
Package: spark-deepin-wine-runner
|
Package: spark-deepin-wine-runner
|
||||||
Version: 1.3.1
|
Version: 1.4.0
|
||||||
Maintainer: gfdgd xi <3025613752@qq.com>
|
Maintainer: gfdgd xi <3025613752@qq.com>
|
||||||
Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner
|
Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Depends: python3, python3-tk
|
Depends: python3, python3-tk, python3-pip
|
||||||
Description: gfdgd xi make's wine runner
|
Description: gfdgd xi make's wine runner
|
||||||
|
|
||||||
|
3
deb/DEBIAN/postinst
Executable file
3
deb/DEBIAN/postinst
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
# !/bin/sh
|
||||||
|
python3 -m pip install --upgrade pillow
|
||||||
|
python3 -m pip install --upgrade ttkthemes
|
303
deb/opt/apps/deepin-wine-runner/deepin-wine-runner
Executable file
303
deb/opt/apps/deepin-wine-runner/deepin-wine-runner
Executable file
@ -0,0 +1,303 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# 使用系统默认的 python3 运行
|
||||||
|
###########################################################################################
|
||||||
|
# 作者:gfdgd xi
|
||||||
|
# 版本:1.4.0
|
||||||
|
# 更新时间:2021年07月27日
|
||||||
|
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
|
||||||
|
# 基于 Python3 的 tkinter 构建
|
||||||
|
###########################################################################################
|
||||||
|
#################
|
||||||
|
# 引入所需的库
|
||||||
|
#################
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import json
|
||||||
|
import shutil
|
||||||
|
import threading
|
||||||
|
import ttkthemes
|
||||||
|
import webbrowser
|
||||||
|
import tkinter as tk
|
||||||
|
import tkinter.ttk as ttk
|
||||||
|
import tkinter.filedialog
|
||||||
|
import tkinter.messagebox
|
||||||
|
import PIL.Image as Image
|
||||||
|
import PIL.ImageTk as ImageTk
|
||||||
|
|
||||||
|
###################
|
||||||
|
# 程序所需事件
|
||||||
|
###################
|
||||||
|
|
||||||
|
# 打开程序官网
|
||||||
|
def OpenProgramURL():
|
||||||
|
webbrowser.open_new_tab(programUrl)
|
||||||
|
|
||||||
|
# 读取文本文档
|
||||||
|
def readtxt(path):
|
||||||
|
f = open(path, "r") # 设置文件对象
|
||||||
|
str = f.read() # 获取内容
|
||||||
|
f.close() # 关闭文本对象
|
||||||
|
return str # 返回结果
|
||||||
|
|
||||||
|
# 写入文本文档
|
||||||
|
def write_txt(path, things):
|
||||||
|
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||||
|
file.write(things) # 写入文本
|
||||||
|
file.close() # 关闭文本对象
|
||||||
|
|
||||||
|
# 获取用户桌面目录
|
||||||
|
def get_desktop_path():
|
||||||
|
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||||
|
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||||
|
if desktop_index != -1: # 如果有对应项
|
||||||
|
break # 结束循环
|
||||||
|
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||||
|
return -1
|
||||||
|
else:
|
||||||
|
get = line[17:-2] # 截取桌面目录路径
|
||||||
|
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||||
|
if get != -1: # 如果有
|
||||||
|
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||||
|
return get # 返回目录
|
||||||
|
|
||||||
|
# 获取用户主目录
|
||||||
|
def get_home():
|
||||||
|
return os.path.expanduser('~')
|
||||||
|
|
||||||
|
# 第一个浏览按钮事件
|
||||||
|
def liulanbutton():
|
||||||
|
|
||||||
|
path = tkinter.filedialog.askdirectory(title="选择 wine 容器", initialdir=json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"])
|
||||||
|
if path != "" and path != "()":
|
||||||
|
e1.set(path)
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/WineBotton.json", json.dumps({"path": path})) # 写入配置文件
|
||||||
|
|
||||||
|
# 第二个浏览按钮事件
|
||||||
|
def liulanexebutton():
|
||||||
|
path = tkinter.filedialog.askopenfilename(title="选择 exe 可执行文件", filetypes=[("exe 可执行文件", "*.exe"), ("EXE 可执行文件", "*.EXE"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExe.json"))["path"])
|
||||||
|
if path != "" and path != "()":
|
||||||
|
e2.set(path) # 显示路径
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/FindExe.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
|
||||||
|
|
||||||
|
|
||||||
|
# 使用多线程运行可执行文件
|
||||||
|
def runexebutton():
|
||||||
|
run = threading.Thread(target=runexebutton_threading)
|
||||||
|
run.start()
|
||||||
|
|
||||||
|
def DisableButton(things):
|
||||||
|
a = {True: tk.DISABLED, False: tk.NORMAL}
|
||||||
|
button1.configure(state=a[things])
|
||||||
|
button2.configure(state=a[things])
|
||||||
|
button3.configure(state=a[things])
|
||||||
|
e1.configure(state=a[things])
|
||||||
|
e2.configure(state=a[things])
|
||||||
|
o1.configure(state=a[things])
|
||||||
|
|
||||||
|
# 运行可执行文件的线程
|
||||||
|
def runexebutton_threading():
|
||||||
|
DisableButton(True)
|
||||||
|
if e1.get() == "" or e2.get() == "": # 判断文本框是否有内容
|
||||||
|
tkinter.messagebox.showinfo(title="提示", message="没有填写需要使用的 wine 容器或需要运行的 exe 应用")
|
||||||
|
else: # 如果都有
|
||||||
|
os.system("WINEPREFIX='" + e1.get() + "' " + wine[o1_text.get()] + " '" + e2.get() + "'") # 运行
|
||||||
|
findExeHistory.append(e1.get()) # 将记录写进数组
|
||||||
|
wineBottonHistory.append(e2.get()) # 将记录写进数组
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", str(json.dumps(ListToDictionary(findExeHistory)))) # 将历史记录的数组转换为字典并写入
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", str(json.dumps(ListToDictionary(wineBottonHistory)))) # 将历史记录的数组转换为字典并写入
|
||||||
|
e1['value'] = findExeHistory
|
||||||
|
e2['value'] = wineBottonHistory
|
||||||
|
DisableButton(False)
|
||||||
|
|
||||||
|
# 显示“关于这个程序”窗口
|
||||||
|
def about_this_program()->"显示“关于这个程序”窗口":
|
||||||
|
global about
|
||||||
|
global title
|
||||||
|
global iconPath
|
||||||
|
mess = tk.Toplevel()
|
||||||
|
message = ttk.Frame(mess)
|
||||||
|
mess.resizable(0, 0)
|
||||||
|
mess.title("关于 {}".format(title))
|
||||||
|
mess.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||||
|
img = ImageTk.PhotoImage(Image.open(iconPath))
|
||||||
|
label1 = ttk.Label(message, image=img)
|
||||||
|
label2 = ttk.Label(message, text=about)
|
||||||
|
button1 = ttk.Button(message, text="确定", command=mess.withdraw)
|
||||||
|
label1.pack()
|
||||||
|
label2.pack()
|
||||||
|
button1.pack(side="bottom")
|
||||||
|
message.pack()
|
||||||
|
mess.mainloop()
|
||||||
|
|
||||||
|
# 显示“提示”窗口
|
||||||
|
def helps():
|
||||||
|
global tips
|
||||||
|
tkinter.messagebox.showinfo(title="提示", message=tips)
|
||||||
|
|
||||||
|
# 显示更新内容窗口
|
||||||
|
def UpdateThings():
|
||||||
|
tkinter.messagebox.showinfo(title="更新内容", message=updateThings)
|
||||||
|
|
||||||
|
# 生成 shell 文件在桌面
|
||||||
|
# (第四个按钮的事件)
|
||||||
|
def make_desktop_on_desktop():
|
||||||
|
if combobox1.get() == "" or e2.get() == "" or e1.get() == "": # 判断文本框是否有内容
|
||||||
|
tkinter.messagebox.showinfo(title="提示", message="没有填写需要使用的 wine 容器或需要运行的 exe 应用或保存的文件名")
|
||||||
|
else: # 如果都有
|
||||||
|
if os.path.exists(get_desktop_path() + "/" + combobox1.get() + ".sh"): # 判断目录是否有该文件,如果有
|
||||||
|
choose = tkinter.messagebox.askokcancel(title="提示", message="文件已经存在,是否覆盖?") # 询问用户是否覆盖
|
||||||
|
if choose: # 如要覆盖
|
||||||
|
os.remove(get_desktop_path() + "/" + combobox1.get() + ".sh") # 删除该文件
|
||||||
|
else: # 如不覆盖
|
||||||
|
return # 结束
|
||||||
|
os.mknod(get_desktop_path() + "/" + combobox1.get() + ".sh") # 创建文本文档
|
||||||
|
write_txt(get_desktop_path() + "/" + combobox1.get() + ".sh", "#!/bin/bash\n" + "WINEPREFIX='" + e1.get() + "' " + wine[o1_text.get()] + " '" + e2.get() + "'") # 写入文本文档
|
||||||
|
os.system("chmod 777 '" + get_desktop_path() + "/" + combobox1.get() + ".sh" + "'") # 赋予可执行权限
|
||||||
|
shellHistory.append(combobox1.get()) # 将记录写进数组
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json", str(json.dumps(ListToDictionary(shellHistory)))) # 将历史记录的数组转换为字典并写入
|
||||||
|
combobox1['value'] = shellHistory
|
||||||
|
tkinter.messagebox.showinfo(title="提示", message="生成完成!") # 显示完成对话框
|
||||||
|
|
||||||
|
# 数组转字典
|
||||||
|
def ListToDictionary(list):
|
||||||
|
dictionary = {}
|
||||||
|
for i in range(len(list)):
|
||||||
|
dictionary[i] = list[i]
|
||||||
|
return dictionary
|
||||||
|
|
||||||
|
def CleanProgramHistory():
|
||||||
|
if tkinter.messagebox.askokcancel(title="警告", message="删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。"):
|
||||||
|
shutil.rmtree(get_home() + "/.config/deepin-wine-runner")
|
||||||
|
ReStartProgram()
|
||||||
|
|
||||||
|
# 重启本应用程序
|
||||||
|
def ReStartProgram():
|
||||||
|
python = sys.executable
|
||||||
|
os.execl(python, python, * sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# 加载配置
|
||||||
|
###########################
|
||||||
|
if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹
|
||||||
|
os.mkdir(get_home() + "/.config/deepin-wine-runner") # 创建配置文件夹
|
||||||
|
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/ShellHistory.json"): # 如果没有配置文件
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json", json.dumps({})) # 创建配置文件
|
||||||
|
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json"): # 如果没有配置文件
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", json.dumps({})) # 创建配置文件
|
||||||
|
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json"): # 如果没有配置文件
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", json.dumps({})) # 创建配置文件
|
||||||
|
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindExe.json"): # 如果没有配置文件
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/FindExe.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
|
||||||
|
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBotton.json"): # 如果没有配置文件
|
||||||
|
write_txt(get_home() + "/.config/deepin-wine-runner/WineBotton.json", json.dumps({"path": "~/.deepinwine"})) # 写入(创建)一个配置文件
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# 设置变量
|
||||||
|
###########################
|
||||||
|
# 如果要添加其他 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"}
|
||||||
|
shellHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json")).values())
|
||||||
|
findExeHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json")).values())
|
||||||
|
wineBottonHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json")).values())
|
||||||
|
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# 程序信息
|
||||||
|
###########################
|
||||||
|
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||||
|
programUrl = "https://gitee.com/gfdgd-xi/deep-wine-runner"
|
||||||
|
version = "1.4.0"
|
||||||
|
goodRunSystem = "Linux"
|
||||||
|
about = '''一个基于 Python3 的 tkinter 制作的 wine 运行器
|
||||||
|
版本:{}
|
||||||
|
适用平台:{}
|
||||||
|
tkinter 版本:{}
|
||||||
|
程序官网:{}
|
||||||
|
©2020-{} gfdgd xi'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
|
||||||
|
tips = '''提示:
|
||||||
|
1、使用终端运行该程序,可以看到 wine 以及程序本身的提示和报错;
|
||||||
|
2、wine 32 位和 64 位的容器互不兼容;
|
||||||
|
3、部分 wine 系统没有预装,本程序没有设置任何 wine 的依赖项,如果需要使用请自行安装'''
|
||||||
|
updateThingsString = '''*1、修改了 wine 选项的说明和 wine 的启动方式;
|
||||||
|
*2、设置了窗口主题;
|
||||||
|
*3、修改了打包以及 .desktop 文件
|
||||||
|
4、删除了以前的残略调试代码;
|
||||||
|
5、优化了 wine 列表的显示流程;
|
||||||
|
6、更新了“关于”窗口
|
||||||
|
7、更新了提示内容
|
||||||
|
8、在 gitee/github 仓库上添加了 wine 安装脚本
|
||||||
|
'''
|
||||||
|
title = "wine 运行器 {}".format(version)
|
||||||
|
updateTime = "2021年07月27日"
|
||||||
|
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
|
||||||
|
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# 窗口创建
|
||||||
|
###########################
|
||||||
|
win = tk.Tk() # 创建窗口
|
||||||
|
win.title(title) # 设置标题
|
||||||
|
window = ttk.Frame()
|
||||||
|
# 设置变量以修改和获取值项
|
||||||
|
o1_text = tk.StringVar()
|
||||||
|
combobox1 = tk.StringVar()
|
||||||
|
o1_text.set("deepin-wine")
|
||||||
|
# 创建控件
|
||||||
|
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.Combobox(window, width=100) # 创建文本框控件
|
||||||
|
e2 = ttk.Combobox(window, width=100) # 创建文本框控件
|
||||||
|
combobox1 = ttk.Combobox(window, width=100)
|
||||||
|
o1 = ttk.OptionMenu(window, o1_text, *list(wine)) # 创建选择框控件
|
||||||
|
menu = tk.Menu(window, background="white") # 设置菜单栏
|
||||||
|
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
|
||||||
|
menu.add_cascade(label="程序", menu=programmenu)
|
||||||
|
programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
|
||||||
|
programmenu.add_separator() # 设置分界线
|
||||||
|
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项
|
||||||
|
help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏
|
||||||
|
menu.add_cascade(label="帮助", menu=help)
|
||||||
|
help.add_command(label="程序官网", command=OpenProgramURL) # 设置“程序官网”项
|
||||||
|
help.add_separator()
|
||||||
|
help.add_command(label="小提示", command=helps) # 设置“小提示”项
|
||||||
|
help.add_command(label="更新内容", command=UpdateThings) # 设置“更新内容”项
|
||||||
|
help.add_command(label="关于这个程序", command=about_this_program) # 设置“关于这个程序”项
|
||||||
|
# 设置窗口
|
||||||
|
win.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||||
|
themes = ttkthemes.ThemedStyle(win)
|
||||||
|
themes.set_theme("adapta")
|
||||||
|
win.config(bg="white")
|
||||||
|
# 设置控件
|
||||||
|
menu.configure(activebackground="white")
|
||||||
|
programmenu.configure(activebackground="white")
|
||||||
|
help.configure(activebackground="white")
|
||||||
|
e1['value'] = findExeHistory
|
||||||
|
e2['value'] = wineBottonHistory
|
||||||
|
combobox1['value'] = shellHistory
|
||||||
|
# 添加控件
|
||||||
|
win.config(menu=menu) # 显示菜单栏
|
||||||
|
label1.grid(row=0, column=0)
|
||||||
|
label2.grid(row=1, column=0)
|
||||||
|
label3.grid(row=2, column=0)
|
||||||
|
label4.grid(row=4, column=0)
|
||||||
|
e1.grid(row=0, column=1)
|
||||||
|
e2.grid(row=1, column=1)
|
||||||
|
#combobox1.grid(row=4, column=1)
|
||||||
|
combobox1.grid(row=4, column=1)
|
||||||
|
button1.grid(row=0, column=2)
|
||||||
|
button2.grid(row=1, column=2)
|
||||||
|
button3.grid(row=3, column=0, columnspan=3)
|
||||||
|
button5.grid(row=5, column=0, columnspan=3)
|
||||||
|
o1.grid(row=2, column=1)
|
||||||
|
# 启动窗口
|
||||||
|
window.pack()
|
||||||
|
win.mainloop()
|
Before ![]() (image error) Size: 35 KiB After ![]() (image error) Size: 35 KiB ![]() ![]() |
55
deb/opt/apps/deepin-wine-runner/wine install
Executable file
55
deb/opt/apps/deepin-wine-runner/wine install
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# 使用系统默认的 python3 运行
|
||||||
|
###########################################################################################
|
||||||
|
# 作者:gfdgd xi
|
||||||
|
# 版本:1.4.0
|
||||||
|
# 更新时间:2021年07月27日
|
||||||
|
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
|
||||||
|
# 基于 Python3 的 tkinter 构建
|
||||||
|
###########################################################################################
|
||||||
|
#################
|
||||||
|
# 引入所需的库
|
||||||
|
#################
|
||||||
|
import os
|
||||||
|
|
||||||
|
###################
|
||||||
|
# 程序功能
|
||||||
|
###################
|
||||||
|
print("请保证你能有 root 权限以便安装")
|
||||||
|
print("如果有请按回车,否则按 [Ctrl+C] 退出", end=' ')
|
||||||
|
input()
|
||||||
|
os.system("sudo apt update")
|
||||||
|
print("请问是否要更新操作系统?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt upgrade -y")
|
||||||
|
print("请问是否要安装原版 wine(wine64)?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt install wine -y")
|
||||||
|
print("请问是否要安装 deepin-wine?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt install deepin-wine -y")
|
||||||
|
print("请问是否要安装 deepin-wine5(需要添加星火应用商店的源)?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
if os.path.exists("/etc/apt/sources.list.d/sparkstore-temp.list"):
|
||||||
|
os.system("sudo rm -v /etc/apt/sources.list.d/sparkstore-temp.list")
|
||||||
|
if not os.path.exists("/etc/apt/sources.list.d/sparkstore.list"):
|
||||||
|
os.system("sudo touch /etc/apt/sources.list.d/sparkstore-temp.list")
|
||||||
|
os.system("echo 'deb [by-hash=force] https://d.store.deepinos.org.cn / ' | sudo tee '/etc/apt/sources.list.d/sparkstore-temp.list'")
|
||||||
|
os.system("sudo apt update")
|
||||||
|
os.system("sudo apt install deepin-wine5 -y")
|
||||||
|
if os.path.exists("/etc/apt/sources.list.d/sparkstore-temp.list"):
|
||||||
|
os.system("sudo rm -v /etc/apt/sources.list.d/sparkstore-temp.list")
|
||||||
|
os.system("sudo apt update")
|
||||||
|
print("请问是否要安装 deepin-wine5-stable?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt install deepin-wine5-stable -y")
|
||||||
|
print("请问是否要安装 deepin-wine6-stable?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt install deepin-wine6-stable -y")
|
||||||
|
print("全部完成!")
|
@ -1,273 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# 使用系统默认的 python3 运行
|
|
||||||
###########################################################################################
|
|
||||||
# 作者:gfdgd xi
|
|
||||||
# 版本:1.3.1
|
|
||||||
# 更新时间:2021年05月23日
|
|
||||||
# 感谢:感谢 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 sys
|
|
||||||
import time
|
|
||||||
import json
|
|
||||||
import shutil
|
|
||||||
import threading
|
|
||||||
import webbrowser
|
|
||||||
|
|
||||||
###################
|
|
||||||
# 程序所需事件
|
|
||||||
###################
|
|
||||||
|
|
||||||
# 打开程序官网
|
|
||||||
def OpenProgramURL():
|
|
||||||
webbrowser.open_new_tab(programUrl)
|
|
||||||
|
|
||||||
# 读取文本文档
|
|
||||||
def readtxt(path):
|
|
||||||
f = open(path, "r") # 设置文件对象
|
|
||||||
str = f.read() # 获取内容
|
|
||||||
f.close() # 关闭文本对象
|
|
||||||
return str # 返回结果
|
|
||||||
|
|
||||||
# 写入文本文档
|
|
||||||
def write_txt(path, things):
|
|
||||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
|
||||||
file.write(things) # 写入文本
|
|
||||||
file.close() # 关闭文本对象
|
|
||||||
|
|
||||||
# 获取用户桌面目录
|
|
||||||
def get_desktop_path():
|
|
||||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
|
||||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
|
||||||
if desktop_index != -1: # 如果有对应项
|
|
||||||
break # 结束循环
|
|
||||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
|
||||||
return -1
|
|
||||||
else:
|
|
||||||
get = line[17:-2] # 截取桌面目录路径
|
|
||||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
|
||||||
if get != -1: # 如果有
|
|
||||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
|
||||||
return get # 返回目录
|
|
||||||
|
|
||||||
# 获取用户主目录
|
|
||||||
def get_home():
|
|
||||||
return os.path.expanduser('~')
|
|
||||||
|
|
||||||
# 第一个浏览按钮事件
|
|
||||||
def liulanbutton():
|
|
||||||
|
|
||||||
path = tkinter.filedialog.askdirectory(title="选择 wine 容器", initialdir=json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"])
|
|
||||||
if path != "" and path != "()":
|
|
||||||
e1.set(path)
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/WineBotton.json", json.dumps({"path": path})) # 写入配置文件
|
|
||||||
|
|
||||||
# 第二个浏览按钮事件
|
|
||||||
def liulanexebutton():
|
|
||||||
path = tkinter.filedialog.askopenfilename(title="选择 exe 可执行文件", filetypes=[("exe 可执行文件", "*.exe"), ("EXE 可执行文件", "*.EXE"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExe.json"))["path"])
|
|
||||||
if path != "" and path != "()":
|
|
||||||
e2.set(path) # 显示路径
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/FindExe.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
|
|
||||||
|
|
||||||
|
|
||||||
# 使用多线程运行可执行文件
|
|
||||||
def runexebutton():
|
|
||||||
run = threading.Thread(target=runexebutton_threading)
|
|
||||||
run.start()
|
|
||||||
|
|
||||||
def DisableButton(things):
|
|
||||||
a = {True: tk.DISABLED, False: tk.NORMAL}
|
|
||||||
button1.configure(state=a[things])
|
|
||||||
button2.configure(state=a[things])
|
|
||||||
button3.configure(state=a[things])
|
|
||||||
e1.configure(state=a[things])
|
|
||||||
e2.configure(state=a[things])
|
|
||||||
o1.configure(state=a[things])
|
|
||||||
|
|
||||||
# 运行可执行文件的线程
|
|
||||||
def runexebutton_threading():
|
|
||||||
DisableButton(True)
|
|
||||||
if e1.get() == "" or e2.get() == "": # 判断文本框是否有内容
|
|
||||||
tkinter.messagebox.showinfo(title="提示", message="没有填写需要使用的 wine 容器或需要运行的 exe 应用")
|
|
||||||
else: # 如果都有
|
|
||||||
os.system("WINEPREFIX='" + e1.get() + "' " + wine[o1_text.get()] + " '" + e2.get() + "'") # 运行
|
|
||||||
findExeHistory.append(e1.get()) # 将记录写进数组
|
|
||||||
wineBottonHistory.append(e2.get()) # 将记录写进数组
|
|
||||||
print(ListToDictionary(findExeHistory))
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", str(json.dumps(ListToDictionary(findExeHistory)))) # 将历史记录的数组转换为字典并写入
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", str(json.dumps(ListToDictionary(wineBottonHistory)))) # 将历史记录的数组转换为字典并写入
|
|
||||||
e1['value'] = findExeHistory
|
|
||||||
e2['value'] = wineBottonHistory
|
|
||||||
DisableButton(False)
|
|
||||||
|
|
||||||
# 显示“关于这个程序”窗口
|
|
||||||
def about_this_program():
|
|
||||||
global about
|
|
||||||
tkinter.messagebox.showinfo(title="关于这个程序", message=about)
|
|
||||||
|
|
||||||
# 显示“提示”窗口
|
|
||||||
def helps():
|
|
||||||
global tips
|
|
||||||
tkinter.messagebox.showinfo(title="提示", message=tips)
|
|
||||||
|
|
||||||
# 显示更新内容窗口
|
|
||||||
def UpdateThings():
|
|
||||||
tkinter.messagebox.showinfo(title="更新内容", message=updateThings)
|
|
||||||
|
|
||||||
# 生成 shell 文件在桌面
|
|
||||||
# (第四个按钮的事件)
|
|
||||||
def make_desktop_on_desktop():
|
|
||||||
if combobox1.get() == "" or e2.get() == "" or e1.get() == "": # 判断文本框是否有内容
|
|
||||||
tkinter.messagebox.showinfo(title="提示", message="没有填写需要使用的 wine 容器或需要运行的 exe 应用或保存的文件名")
|
|
||||||
else: # 如果都有
|
|
||||||
if os.path.exists(get_desktop_path() + "/" + combobox1.get() + ".sh"): # 判断目录是否有该文件,如果有
|
|
||||||
choose = tkinter.messagebox.askokcancel(title="提示", message="文件已经存在,是否覆盖?") # 询问用户是否覆盖
|
|
||||||
if choose: # 如要覆盖
|
|
||||||
os.remove(get_desktop_path() + "/" + combobox1.get() + ".sh") # 删除该文件
|
|
||||||
else: # 如不覆盖
|
|
||||||
return # 结束
|
|
||||||
os.mknod(get_desktop_path() + "/" + combobox1.get() + ".sh") # 创建文本文档
|
|
||||||
write_txt(get_desktop_path() + "/" + combobox1.get() + ".sh", "#!/bin/bash\n" + "WINEPREFIX='" + e1.get() + "' " + wine[o1_text.get()] + " '" + e2.get() + "'") # 写入文本文档
|
|
||||||
os.system("chmod 777 '" + get_desktop_path() + "/" + combobox1.get() + ".sh" + "'") # 赋予可执行权限
|
|
||||||
shellHistory.append(combobox1.get()) # 将记录写进数组
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json", str(json.dumps(ListToDictionary(shellHistory)))) # 将历史记录的数组转换为字典并写入
|
|
||||||
combobox1['value'] = shellHistory
|
|
||||||
tkinter.messagebox.showinfo(title="提示", message="生成完成!") # 显示完成对话框
|
|
||||||
|
|
||||||
# 数组转字典
|
|
||||||
def ListToDictionary(list):
|
|
||||||
dictionary = {}
|
|
||||||
for i in range(len(list)):
|
|
||||||
dictionary[i] = list[i]
|
|
||||||
return dictionary
|
|
||||||
|
|
||||||
def CleanProgramHistory():
|
|
||||||
if tkinter.messagebox.askokcancel(title="警告", message="删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。"):
|
|
||||||
shutil.rmtree(get_home() + "/.config/deepin-wine-runner")
|
|
||||||
ReStartProgram()
|
|
||||||
|
|
||||||
# 重启本应用程序
|
|
||||||
def ReStartProgram():
|
|
||||||
python = sys.executable
|
|
||||||
os.execl(python, python, * sys.argv)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# 加载配置
|
|
||||||
###########################
|
|
||||||
if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹
|
|
||||||
os.mkdir(get_home() + "/.config/deepin-wine-runner") # 创建配置文件夹
|
|
||||||
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/ShellHistory.json"): # 如果没有配置文件
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json", json.dumps({})) # 创建配置文件
|
|
||||||
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json"): # 如果没有配置文件
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", json.dumps({})) # 创建配置文件
|
|
||||||
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json"): # 如果没有配置文件
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", json.dumps({})) # 创建配置文件
|
|
||||||
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindExe.json"): # 如果没有配置文件
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/FindExe.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
|
|
||||||
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBotton.json"): # 如果没有配置文件
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/WineBotton.json", json.dumps({"path": "~/.deepinwine"})) # 写入(创建)一个配置文件
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# 设置变量
|
|
||||||
###########################
|
|
||||||
# 如果要添加其他 wine,请在字典添加其名称和执行路径
|
|
||||||
# 在数组添加其名称
|
|
||||||
wineName = ["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 打包的应用后才能使用)"]
|
|
||||||
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"}
|
|
||||||
shellHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json")).values())
|
|
||||||
findExeHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json")).values())
|
|
||||||
wineBottonHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json")).values())
|
|
||||||
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# 程序信息
|
|
||||||
###########################
|
|
||||||
programUrl = "https://gitee.com/gfdgd-xi/deep-wine-runner"
|
|
||||||
version = "1.3.1"
|
|
||||||
goodRunSystem = "Linux"
|
|
||||||
about = '''一个基于 Python3 的 tkinter 制作的 wine 运行器
|
|
||||||
版本:{}
|
|
||||||
适用平台:{}
|
|
||||||
tkinter 版本:{}
|
|
||||||
程序官网:{}
|
|
||||||
©2020-{} gfdgd xi'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
|
|
||||||
tips = '''提示:
|
|
||||||
1、使用终端运行该程序,可以看到 wine 以及程序本身的提示和报错
|
|
||||||
2、wine 32 位和 64 位的容器互不兼容'''
|
|
||||||
updateThingsString = '''1、添加了历史记录,使用更加方便
|
|
||||||
2、增加“更新内容”项
|
|
||||||
3、支持浏览窗口的默认路径为上次访问的路径
|
|
||||||
4、支持清空历史记录
|
|
||||||
5、代码结构优化
|
|
||||||
6、修改了控件大小'''
|
|
||||||
title = "wine 运行器 {}".format(version)
|
|
||||||
updateTime = "2021年05月23日"
|
|
||||||
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
|
|
||||||
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# 窗口创建
|
|
||||||
###########################
|
|
||||||
window = tk.Tk() # 创建窗口
|
|
||||||
window.title(title) # 设置标题
|
|
||||||
# 设置变量以修改和获取值项
|
|
||||||
o1_text = tk.StringVar()
|
|
||||||
combobox1 = tk.StringVar()
|
|
||||||
o1_text.set("deepin-wine")
|
|
||||||
# 创建控件
|
|
||||||
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.Combobox(window, width=100) # 创建文本框控件
|
|
||||||
e2 = ttk.Combobox(window, width=100) # 创建文本框控件
|
|
||||||
combobox1 = ttk.Combobox(window, width=100)
|
|
||||||
o1 = ttk.OptionMenu(window, o1_text, *wineName) # 创建选择框控件
|
|
||||||
menu = tk.Menu(window) # 设置菜单栏
|
|
||||||
programmenu = tk.Menu(menu, tearoff=0) # 设置“程序”菜单栏
|
|
||||||
menu.add_cascade(label="程序", menu=programmenu)
|
|
||||||
programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
|
|
||||||
programmenu.add_separator() # 设置分界线
|
|
||||||
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项
|
|
||||||
help = tk.Menu(menu, tearoff=0) # 设置“帮助”菜单栏
|
|
||||||
menu.add_cascade(label="帮助", menu=help)
|
|
||||||
help.add_command(label="程序官网", command=OpenProgramURL) # 设置“程序官网”项
|
|
||||||
help.add_separator()
|
|
||||||
help.add_command(label="小提示", command=helps) # 设置“小提示”项
|
|
||||||
help.add_command(label="更新内容", command=UpdateThings) # 设置“更新内容”项
|
|
||||||
help.add_command(label="关于这个程序", command=about_this_program) # 设置“关于这个程序”项
|
|
||||||
# 设置控件
|
|
||||||
e1['value'] = findExeHistory
|
|
||||||
e2['value'] = wineBottonHistory
|
|
||||||
combobox1['value'] = shellHistory
|
|
||||||
# 添加控件
|
|
||||||
window.config(menu=menu) # 显示菜单栏
|
|
||||||
label1.grid(row=0, column=0)
|
|
||||||
label2.grid(row=1, column=0)
|
|
||||||
label3.grid(row=2, column=0)
|
|
||||||
label4.grid(row=4, column=0)
|
|
||||||
e1.grid(row=0, column=1)
|
|
||||||
e2.grid(row=1, column=1)
|
|
||||||
#combobox1.grid(row=4, column=1)
|
|
||||||
combobox1.grid(row=4, column=1)
|
|
||||||
button1.grid(row=0, column=2)
|
|
||||||
button2.grid(row=1, column=2)
|
|
||||||
button3.grid(row=3, column=0, columnspan=3)
|
|
||||||
button5.grid(row=5, column=0, columnspan=3)
|
|
||||||
o1.grid(row=2, column=1)
|
|
||||||
# 启动窗口
|
|
||||||
window.mainloop()
|
|
1
deb/usr/bin/deepin-wine-runner
Symbolic link
1
deb/usr/bin/deepin-wine-runner
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/opt/apps/deepin-wine-runner/deepin-wine-runner
|
@ -1,8 +1,8 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Name=deepin-wine 运行器
|
Name=wine 运行器
|
||||||
Version=1.1.1
|
Version=1.4.0
|
||||||
Exec=/usr/bin/deepin-wine-runner
|
Exec=/usr/bin/deepin-wine-runner
|
||||||
Icon=/usr/share/icons/hicolor/256x256/apps/spark-deepin-wine-runner.png
|
Icon=/opt/apps/deepin-wine-runner/icon.png
|
||||||
Type=Application
|
Type=Application
|
||||||
Terminal=false
|
Terminal=false
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
|
BIN
icon.png
Executable file
BIN
icon.png
Executable file
Binary file not shown.
After ![]() (image error) Size: 35 KiB |
79
main.py
79
main.py
@ -2,7 +2,7 @@
|
|||||||
# 使用系统默认的 python3 运行
|
# 使用系统默认的 python3 运行
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
# 作者:gfdgd xi
|
# 作者:gfdgd xi
|
||||||
# 版本:1.3.2
|
# 版本:1.4.0
|
||||||
# 更新时间:2021年07月27日
|
# 更新时间:2021年07月27日
|
||||||
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
|
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
|
||||||
# 基于 Python3 的 tkinter 构建
|
# 基于 Python3 的 tkinter 构建
|
||||||
@ -10,17 +10,20 @@
|
|||||||
#################
|
#################
|
||||||
# 引入所需的库
|
# 引入所需的库
|
||||||
#################
|
#################
|
||||||
import tkinter as tk
|
|
||||||
import tkinter.ttk as ttk
|
|
||||||
import tkinter.filedialog
|
|
||||||
import tkinter.messagebox
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
import threading
|
import threading
|
||||||
|
import ttkthemes
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
import tkinter as tk
|
||||||
|
import tkinter.ttk as ttk
|
||||||
|
import tkinter.filedialog
|
||||||
|
import tkinter.messagebox
|
||||||
|
import PIL.Image as Image
|
||||||
|
import PIL.ImageTk as ImageTk
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# 程序所需事件
|
# 程序所需事件
|
||||||
@ -101,7 +104,6 @@ def runexebutton_threading():
|
|||||||
os.system("WINEPREFIX='" + e1.get() + "' " + wine[o1_text.get()] + " '" + e2.get() + "'") # 运行
|
os.system("WINEPREFIX='" + e1.get() + "' " + wine[o1_text.get()] + " '" + e2.get() + "'") # 运行
|
||||||
findExeHistory.append(e1.get()) # 将记录写进数组
|
findExeHistory.append(e1.get()) # 将记录写进数组
|
||||||
wineBottonHistory.append(e2.get()) # 将记录写进数组
|
wineBottonHistory.append(e2.get()) # 将记录写进数组
|
||||||
print(ListToDictionary(findExeHistory))
|
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", str(json.dumps(ListToDictionary(findExeHistory)))) # 将历史记录的数组转换为字典并写入
|
write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", str(json.dumps(ListToDictionary(findExeHistory)))) # 将历史记录的数组转换为字典并写入
|
||||||
write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", str(json.dumps(ListToDictionary(wineBottonHistory)))) # 将历史记录的数组转换为字典并写入
|
write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", str(json.dumps(ListToDictionary(wineBottonHistory)))) # 将历史记录的数组转换为字典并写入
|
||||||
e1['value'] = findExeHistory
|
e1['value'] = findExeHistory
|
||||||
@ -109,9 +111,24 @@ def runexebutton_threading():
|
|||||||
DisableButton(False)
|
DisableButton(False)
|
||||||
|
|
||||||
# 显示“关于这个程序”窗口
|
# 显示“关于这个程序”窗口
|
||||||
def about_this_program():
|
def about_this_program()->"显示“关于这个程序”窗口":
|
||||||
global about
|
global about
|
||||||
tkinter.messagebox.showinfo(title="关于这个程序", message=about)
|
global title
|
||||||
|
global iconPath
|
||||||
|
mess = tk.Toplevel()
|
||||||
|
message = ttk.Frame(mess)
|
||||||
|
mess.resizable(0, 0)
|
||||||
|
mess.title("关于 {}".format(title))
|
||||||
|
mess.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||||
|
img = ImageTk.PhotoImage(Image.open(iconPath))
|
||||||
|
label1 = ttk.Label(message, image=img)
|
||||||
|
label2 = ttk.Label(message, text=about)
|
||||||
|
button1 = ttk.Button(message, text="确定", command=mess.withdraw)
|
||||||
|
label1.pack()
|
||||||
|
label2.pack()
|
||||||
|
button1.pack(side="bottom")
|
||||||
|
message.pack()
|
||||||
|
mess.mainloop()
|
||||||
|
|
||||||
# 显示“提示”窗口
|
# 显示“提示”窗口
|
||||||
def helps():
|
def helps():
|
||||||
@ -181,8 +198,6 @@ if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBotton.json"
|
|||||||
# 设置变量
|
# 设置变量
|
||||||
###########################
|
###########################
|
||||||
# 如果要添加其他 wine,请在字典添加其名称和执行路径
|
# 如果要添加其他 wine,请在字典添加其名称和执行路径
|
||||||
# 在数组添加其名称
|
|
||||||
wineName = ["deepin-wine", "deepin-wine","deepin-wine5", "wine", "wine64", "deepin-wine5 stable", "deepin-wine6 stable 32 位"]
|
|
||||||
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"}
|
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"}
|
||||||
shellHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json")).values())
|
shellHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json")).values())
|
||||||
findExeHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json")).values())
|
findExeHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json")).values())
|
||||||
@ -192,8 +207,9 @@ wineBottonHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-r
|
|||||||
###########################
|
###########################
|
||||||
# 程序信息
|
# 程序信息
|
||||||
###########################
|
###########################
|
||||||
|
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||||
programUrl = "https://gitee.com/gfdgd-xi/deep-wine-runner"
|
programUrl = "https://gitee.com/gfdgd-xi/deep-wine-runner"
|
||||||
version = "1.3.2"
|
version = "1.4.0"
|
||||||
goodRunSystem = "Linux"
|
goodRunSystem = "Linux"
|
||||||
about = '''一个基于 Python3 的 tkinter 制作的 wine 运行器
|
about = '''一个基于 Python3 的 tkinter 制作的 wine 运行器
|
||||||
版本:{}
|
版本:{}
|
||||||
@ -202,9 +218,18 @@ tkinter 版本:{}
|
|||||||
程序官网:{}
|
程序官网:{}
|
||||||
©2020-{} gfdgd xi'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
|
©2020-{} gfdgd xi'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
|
||||||
tips = '''提示:
|
tips = '''提示:
|
||||||
1、使用终端运行该程序,可以看到 wine 以及程序本身的提示和报错
|
1、使用终端运行该程序,可以看到 wine 以及程序本身的提示和报错;
|
||||||
2、wine 32 位和 64 位的容器互不兼容'''
|
2、wine 32 位和 64 位的容器互不兼容;
|
||||||
updateThingsString = '''1、修改了 wine 选项的说明和 wine 的启动方式'''
|
3、部分 wine 系统没有预装,本程序没有设置任何 wine 的依赖项,如果需要使用请自行安装'''
|
||||||
|
updateThingsString = '''*1、修改了 wine 选项的说明和 wine 的启动方式;
|
||||||
|
*2、设置了窗口主题;
|
||||||
|
*3、修改了打包以及 .desktop 文件
|
||||||
|
4、删除了以前的残略调试代码;
|
||||||
|
5、优化了 wine 列表的显示流程;
|
||||||
|
6、更新了“关于”窗口
|
||||||
|
7、更新了提示内容
|
||||||
|
8、在 gitee/github 仓库上添加了 wine 安装脚本
|
||||||
|
'''
|
||||||
title = "wine 运行器 {}".format(version)
|
title = "wine 运行器 {}".format(version)
|
||||||
updateTime = "2021年07月27日"
|
updateTime = "2021年07月27日"
|
||||||
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
|
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
|
||||||
@ -213,8 +238,9 @@ updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updat
|
|||||||
###########################
|
###########################
|
||||||
# 窗口创建
|
# 窗口创建
|
||||||
###########################
|
###########################
|
||||||
window = tk.Tk() # 创建窗口
|
win = tk.Tk() # 创建窗口
|
||||||
window.title(title) # 设置标题
|
win.title(title) # 设置标题
|
||||||
|
window = ttk.Frame()
|
||||||
# 设置变量以修改和获取值项
|
# 设置变量以修改和获取值项
|
||||||
o1_text = tk.StringVar()
|
o1_text = tk.StringVar()
|
||||||
combobox1 = tk.StringVar()
|
combobox1 = tk.StringVar()
|
||||||
@ -231,26 +257,34 @@ label4 = ttk.Label(window, text="设置文件名,以便把上方填写的信
|
|||||||
e1 = ttk.Combobox(window, width=100) # 创建文本框控件
|
e1 = ttk.Combobox(window, width=100) # 创建文本框控件
|
||||||
e2 = ttk.Combobox(window, width=100) # 创建文本框控件
|
e2 = ttk.Combobox(window, width=100) # 创建文本框控件
|
||||||
combobox1 = ttk.Combobox(window, width=100)
|
combobox1 = ttk.Combobox(window, width=100)
|
||||||
o1 = ttk.OptionMenu(window, o1_text, *wineName) # 创建选择框控件
|
o1 = ttk.OptionMenu(window, o1_text, *list(wine)) # 创建选择框控件
|
||||||
menu = tk.Menu(window) # 设置菜单栏
|
menu = tk.Menu(window, background="white") # 设置菜单栏
|
||||||
programmenu = tk.Menu(menu, tearoff=0) # 设置“程序”菜单栏
|
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
|
||||||
menu.add_cascade(label="程序", menu=programmenu)
|
menu.add_cascade(label="程序", menu=programmenu)
|
||||||
programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
|
programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
|
||||||
programmenu.add_separator() # 设置分界线
|
programmenu.add_separator() # 设置分界线
|
||||||
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项
|
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项
|
||||||
help = tk.Menu(menu, tearoff=0) # 设置“帮助”菜单栏
|
help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏
|
||||||
menu.add_cascade(label="帮助", menu=help)
|
menu.add_cascade(label="帮助", menu=help)
|
||||||
help.add_command(label="程序官网", command=OpenProgramURL) # 设置“程序官网”项
|
help.add_command(label="程序官网", command=OpenProgramURL) # 设置“程序官网”项
|
||||||
help.add_separator()
|
help.add_separator()
|
||||||
help.add_command(label="小提示", command=helps) # 设置“小提示”项
|
help.add_command(label="小提示", command=helps) # 设置“小提示”项
|
||||||
help.add_command(label="更新内容", command=UpdateThings) # 设置“更新内容”项
|
help.add_command(label="更新内容", command=UpdateThings) # 设置“更新内容”项
|
||||||
help.add_command(label="关于这个程序", command=about_this_program) # 设置“关于这个程序”项
|
help.add_command(label="关于这个程序", command=about_this_program) # 设置“关于这个程序”项
|
||||||
|
# 设置窗口
|
||||||
|
win.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||||
|
themes = ttkthemes.ThemedStyle(win)
|
||||||
|
themes.set_theme("adapta")
|
||||||
|
win.config(bg="white")
|
||||||
# 设置控件
|
# 设置控件
|
||||||
|
menu.configure(activebackground="white")
|
||||||
|
programmenu.configure(activebackground="white")
|
||||||
|
help.configure(activebackground="white")
|
||||||
e1['value'] = findExeHistory
|
e1['value'] = findExeHistory
|
||||||
e2['value'] = wineBottonHistory
|
e2['value'] = wineBottonHistory
|
||||||
combobox1['value'] = shellHistory
|
combobox1['value'] = shellHistory
|
||||||
# 添加控件
|
# 添加控件
|
||||||
window.config(menu=menu) # 显示菜单栏
|
win.config(menu=menu) # 显示菜单栏
|
||||||
label1.grid(row=0, column=0)
|
label1.grid(row=0, column=0)
|
||||||
label2.grid(row=1, column=0)
|
label2.grid(row=1, column=0)
|
||||||
label3.grid(row=2, column=0)
|
label3.grid(row=2, column=0)
|
||||||
@ -265,4 +299,5 @@ button3.grid(row=3, column=0, columnspan=3)
|
|||||||
button5.grid(row=5, column=0, columnspan=3)
|
button5.grid(row=5, column=0, columnspan=3)
|
||||||
o1.grid(row=2, column=1)
|
o1.grid(row=2, column=1)
|
||||||
# 启动窗口
|
# 启动窗口
|
||||||
window.mainloop()
|
window.pack()
|
||||||
|
win.mainloop()
|
||||||
|
55
wine install/AllInstall.py
Executable file
55
wine install/AllInstall.py
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# 使用系统默认的 python3 运行
|
||||||
|
###########################################################################################
|
||||||
|
# 作者:gfdgd xi
|
||||||
|
# 版本:1.4.0
|
||||||
|
# 更新时间:2021年07月27日
|
||||||
|
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
|
||||||
|
# 基于 Python3 的 tkinter 构建
|
||||||
|
###########################################################################################
|
||||||
|
#################
|
||||||
|
# 引入所需的库
|
||||||
|
#################
|
||||||
|
import os
|
||||||
|
|
||||||
|
###################
|
||||||
|
# 程序功能
|
||||||
|
###################
|
||||||
|
print("请保证你能有 root 权限以便安装")
|
||||||
|
print("如果有请按回车,否则按 [Ctrl+C] 退出", end=' ')
|
||||||
|
input()
|
||||||
|
os.system("sudo apt update")
|
||||||
|
print("请问是否要更新操作系统?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt upgrade -y")
|
||||||
|
print("请问是否要安装原版 wine(wine64)?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt install wine -y")
|
||||||
|
print("请问是否要安装 deepin-wine?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt install deepin-wine -y")
|
||||||
|
print("请问是否要安装 deepin-wine5(需要添加星火应用商店的源)?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
if os.path.exists("/etc/apt/sources.list.d/sparkstore-temp.list"):
|
||||||
|
os.system("sudo rm -v /etc/apt/sources.list.d/sparkstore-temp.list")
|
||||||
|
if not os.path.exists("/etc/apt/sources.list.d/sparkstore.list"):
|
||||||
|
os.system("sudo touch /etc/apt/sources.list.d/sparkstore-temp.list")
|
||||||
|
os.system("echo 'deb [by-hash=force] https://d.store.deepinos.org.cn / ' | sudo tee '/etc/apt/sources.list.d/sparkstore-temp.list'")
|
||||||
|
os.system("sudo apt update")
|
||||||
|
os.system("sudo apt install deepin-wine5 -y")
|
||||||
|
if os.path.exists("/etc/apt/sources.list.d/sparkstore-temp.list"):
|
||||||
|
os.system("sudo rm -v /etc/apt/sources.list.d/sparkstore-temp.list")
|
||||||
|
os.system("sudo apt update")
|
||||||
|
print("请问是否要安装 deepin-wine5-stable?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt install deepin-wine5-stable -y")
|
||||||
|
print("请问是否要安装 deepin-wine6-stable?[Y/N]", end=' ')
|
||||||
|
choose = input().upper()
|
||||||
|
if not choose == "N":
|
||||||
|
os.system("sudo apt install deepin-wine6-stable -y")
|
||||||
|
print("全部完成!")
|
BIN
截图/截图_dde-desktop_20210727150437.png
Normal file
BIN
截图/截图_dde-desktop_20210727150437.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 285 KiB |
BIN
截图/截图_tk_20210727145617.png
Normal file
BIN
截图/截图_tk_20210727145617.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 36 KiB |
BIN
截图/截图_选择区域_20210727145639.png
Normal file
BIN
截图/截图_选择区域_20210727145639.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 529 KiB |
Loading…
x
Reference in New Issue
Block a user