冲刺最后一个打包器界面

This commit is contained in:
gfdgd xi 2022-07-18 20:32:01 +08:00
parent 590701a873
commit 99d1255d93
14 changed files with 293 additions and 510 deletions

View File

@ -10,13 +10,11 @@
################# #################
# 引入所需的库 # 引入所需的库
################# #################
import json
import os import os
import sys import sys
import ttkthemes import json
import threading import threading
import tkinter as tk import PyQt5.QtWidgets as QtWidgets
import tkinter.ttk as ttk
# 读取文本文档 # 读取文本文档
def readtxt(path): def readtxt(path):
@ -29,7 +27,6 @@ def Unzip():
os.system("mkdir -p ~") os.system("mkdir -p ~")
os.chdir(f"{homePath}") os.chdir(f"{homePath}")
os.system(f"unzip -o \"{programPath}/package-script.zip\"") os.system(f"unzip -o \"{programPath}/package-script.zip\"")
window.quit()
print("Unzip Done") print("Unzip Done")
ReStartProgram() ReStartProgram()
@ -43,30 +40,23 @@ homePath = os.path.expanduser('~')
information = json.loads(readtxt(f"{programPath}/information.json")) information = json.loads(readtxt(f"{programPath}/information.json"))
version = information["Version"] version = information["Version"]
if not os.path.exists(f"{homePath}/package-script") or not json.loads(readtxt(f"{homePath}/package-script/information.json"))["Version"] == version: if not os.path.exists(f"{homePath}/package-script") or not json.loads(readtxt(f"{homePath}/package-script/information.json"))["Version"] == version:
print("未检测到指定文件,解压文件") app = QtWidgets.QApplication(sys.argv)
# 读取主题 widget = QtWidgets.QWidget()
try: widgetLayout = QtWidgets.QVBoxLayout()
theme = not ("dark" in readtxt(homePath + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(homePath + "/.gtkrc-2.0")) widget.setWindowTitle("解压中")
except: widgetLayout.addWidget(QtWidgets.QLabel("正在解压所需程序,请稍后……"))
print("主题读取错误,默认使用浅色主题") progress = QtWidgets.QProgressBar()
theme = True progress.setMaximum(0)
if theme: progress.setMinimum(0)
window = tk.Tk() progress.update()
themes = ttkthemes.ThemedStyle(window) widgetLayout.addWidget(progress)
themes.set_theme("breeze") widget.setLayout(widgetLayout)
else: widget.show()
import ttkbootstrap
style = ttkbootstrap.Style(theme="darkly")
window = style.master # 创建窗口
window.title("解压中")
ttk.Label(window, text="正在解压所需程序,请稍后……").pack()
progress = ttk.Progressbar(window, mode='indeterminate')
progress.start()
progress.pack()
# 解压流程 # 解压流程
QtWidgets.QProgressDialog(None)
t = threading.Thread(target=Unzip) t = threading.Thread(target=Unzip)
t.start() t.start()
window.mainloop() sys.exit(app.exec_())
os.chdir(f"{homePath}/package-script") os.chdir(f"{homePath}/package-script")
os.system("python3 main.py") os.system("./package.py")
print("End") print("End")

View File

@ -21,6 +21,7 @@ import subprocess
from PIL import Image from PIL import Image
import tkinter as tk import tkinter as tk
import tkinter.ttk as ttk import tkinter.ttk as ttk
import PyQt5.QtWidgets as QtWidgets
import tkinter.messagebox as messagebox import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog import tkinter.filedialog as filedialog
@ -487,7 +488,8 @@ else:
style = ttkbootstrap.Style(theme="darkly") style = ttkbootstrap.Style(theme="darkly")
window = style.master # 创建窗口 window = style.master # 创建窗口
# 设置变量以修改和获取值项 # 设置变量以修改和获取值项
wineVersion = tk.StringVar() wineVersion = QtWidgets.QComboBox()
wineVersion.addItems
wineVersion.set("deepin-wine6 stable") wineVersion.set("deepin-wine6 stable")
e1_text = tk.StringVar() e1_text = tk.StringVar()
e2_text = tk.StringVar() e2_text = tk.StringVar()

View File

@ -1,15 +1,14 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import sys
import json import json
import base64 import base64
import requests import requests
import ttkthemes
import traceback import traceback
import webbrowser import webbrowser
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
import urllib.parse as parse import urllib.parse as parse
import PyQt5.QtGui as QtGui
import PyQt5.QtWidgets as QtWidgets
# 读取文本文档 # 读取文本文档
def readtxt(path: "路径")->"读取文本文档": def readtxt(path: "路径")->"读取文本文档":
@ -28,17 +27,17 @@ def Update(name, stars, contact, things, version):
"Version": version "Version": version
} }
try: try:
messagebox.showinfo(message=requests.post(parse.unquote(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9idWcvdXBsb2FkLnBocA==").decode("utf-8")), data=data).text) QtWidgets.QMessageBox.information(widget, "提示", requests.post(parse.unquote(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9idWcvdXBsb2FkLnBocA==").decode("utf-8")), data=data).text)
except: except:
traceback.print_exc() traceback.print_exc()
messagebox.showerror(title="错误", message="服务器疑似出现错误,可以进行以下尝试:①多尝试几次;②使用其他反馈途径\n错误信息{}".format(traceback.format_exc())) QtWidgets.QMessageBox.critical(widget, "错误", f"服务器疑似出现错误,可以进行以下尝试:①多尝试几次;②使用其他反馈途径\n错误信息{traceback.format_exc()}")
def UpdateButtonClick(): def UpdateButtonClick():
#判断是否为空 #判断是否为空
if nameThings.get() == "" or starValue.get() == "" or contactThings.get() == "" or updateThings.get(1.0, "end").replace(" ", "").replace("\n", "") == "": if nameThings.text() == "" or starMenu.currentText() == "" or contactThings.text() == "" or updateThings.toPlainText().replace(" ", "").replace("\n", "") == "":
messagebox.showerror(title="错误", message="反馈信息未填写完整!") QtWidgets.QMessageBox.critical(widget, "错误", "反馈信息未填写完整!")
return return
Update(name=nameThings.get(), stars=starValue.get(), contact=contactThings.get(), things=updateThings.get(1.0, "end"), version=version) Update(name=nameThings.text(), stars=starMenu.currentText(), contact=contactThings.text(), things=updateThings.toPlainText(), version=version)
def OpenGiteeIssues(): def OpenGiteeIssues():
webbrowser.open_new_tab("https://gitee.com/gfdgd-xi/deep-wine-runner/issues") webbrowser.open_new_tab("https://gitee.com/gfdgd-xi/deep-wine-runner/issues")
@ -64,70 +63,42 @@ version = information["Version"]
########################### ###########################
# 窗口创建 # 窗口创建
########################### ###########################
# 读取主题 app = QtWidgets.QApplication(sys.argv)
try: window = QtWidgets.QMainWindow()
theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0")) widget = QtWidgets.QWidget()
except: widgetLayout = QtWidgets.QGridLayout()
print("主题读取错误,默认使用浅色主题") nameThings = QtWidgets.QLineEdit()
theme = True contactThings = QtWidgets.QLineEdit()
if theme: starMenu = QtWidgets.QComboBox()
window = tk.Tk() updateThings = QtWidgets.QTextEdit()
themes = ttkthemes.ThemedStyle(window) updateButton = QtWidgets.QPushButton("提交")
themes.set_theme("breeze") otherUpload = QtWidgets.QHBoxLayout()
else: giteeButton = QtWidgets.QPushButton("Gitee Issues")
import ttkbootstrap githubButton = QtWidgets.QPushButton("Github Issues")
style = ttkbootstrap.Style(theme="darkly") gitlinkButton = QtWidgets.QPushButton("Gitlink Issues")
window = style.master # 创建窗口 otherUpload.addWidget(QtWidgets.QLabel("如果无法正常反馈,可以用其他方式反馈:"))
win = ttk.Frame() otherUpload.addWidget(giteeButton)
otherUpload.addWidget(githubButton)
starValue = tk.StringVar() otherUpload.addWidget(gitlinkButton)
starValue.set("5分") otherUpload.addSpacerItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum))
starMenu.addItems(["5分", "4分", "3分", "2分", "1分"])
name = ttk.Label(win, text="你的昵称:") widgetLayout.addWidget(QtWidgets.QLabel("你的昵称:"), 0, 0, 1, 1)
nameThings = ttk.Entry(win, width=25) widgetLayout.addWidget(QtWidgets.QLabel("联系方式(电子邮箱):"), 0, 2, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("评分:"), 0, 4, 1, 1)
contact = ttk.Label(win, text="联系方式(电子邮箱):") widgetLayout.addWidget(QtWidgets.QLabel("反馈内容(支持 Markdown 格式):"), 1, 0, 1, 2)
contactThings = ttk.Entry(win, width=25) widgetLayout.addWidget(nameThings, 0, 1, 1, 1)
widgetLayout.addWidget(contactThings, 0, 3, 1, 1)
star = ttk.Label(win, text="评分:") widgetLayout.addWidget(starMenu, 0, 5, 1, 1)
starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分") widgetLayout.addWidget(updateThings, 2, 0, 1, 6)
widgetLayout.addLayout(otherUpload, 3, 0, 1, 5)
updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):") widgetLayout.addWidget(updateButton, 3, 5, 1, 1)
updateThings = tk.Text(win, width=100) giteeButton.clicked.connect(OpenGiteeIssues)
githubButton.clicked.connect(OpenGithubIssues)
otherUpload = ttk.Frame(win) gitlinkButton.clicked.connect(OpenGitlinkIssues)
# 所属内容 updateButton.clicked.connect(UpdateButtonClick)
tips = ttk.Label(otherUpload, text="如果无法正常反馈,可以用其他方式反馈:") widget.setLayout(widgetLayout)
giteeButton = ttk.Button(otherUpload, text="Gitee Issues", command=OpenGiteeIssues) window.setCentralWidget(widget)
githubButton = ttk.Button(otherUpload, text="Github Issues", command=OpenGithubIssues) window.setWindowTitle(f"Wine 运行器 {version} 问题/建议反馈")
gitlinkButton = ttk.Button(otherUpload, text="Gitlink Issues", command=OpenGitlinkIssues) window.setWindowIcon(QtGui.QIcon(iconPath))
window.show()
updateButton = ttk.Button(win, text="提交", command=UpdateButtonClick) sys.exit(app.exec_())
# 设置窗口
window.title("Wine 运行器 {} 问题/建议反馈".format(version))
window.resizable(0, 0)
window.iconphoto(False, tk.PhotoImage(file=iconPath))
tips.grid(row=0, column=0)
giteeButton.grid(row=0, column=1)
githubButton.grid(row=0, column=2)
gitlinkButton.grid(row=0, column=3)
name.grid(row=0, column=0)
nameThings.grid(row=0, column=1)
contact.grid(row=0, column=2)
contactThings.grid(row=0, column=3)
star.grid(row=0, column=4)
starMenu.grid(row=0, column=5)
updateThingsTips.grid(row=1, column=0, columnspan=2)
updateThings.grid(row=2, column=0, columnspan=6)
otherUpload.grid(row=3, column=0, columnspan=4, sticky=tk.W)
updateButton.grid(row=3, column=5)
win.pack(expand="yes", fill="both")
window.mainloop()

View File

@ -8,7 +8,7 @@
"感谢 @星火应用商店 提供部分安装包的源以及本程序的下载地址", "感谢 @星火应用商店 提供部分安装包的源以及本程序的下载地址",
"感谢 @delsin 和 @神末shenmo 在 deepin 论坛提供打包器打包的 deb 包自动删除容器的建议", "感谢 @delsin 和 @神末shenmo 在 deepin 论坛提供打包器打包的 deb 包自动删除容器的建议",
"感谢 @GershonWang 在 https://github.com/gfdgd-xi/deep-wine-runner/issues/1 提供窗口居中的建议", "感谢 @GershonWang 在 https://github.com/gfdgd-xi/deep-wine-runner/issues/1 提供窗口居中的建议",
"感谢 @134******28 提供的新程序 GUI 布局和实现代码", "感谢 @134******28 和 @sgb76 提供的新程序 GUI 布局和实现代码",
"感谢统信在 wine 生态适配活动中提供的打包脚本", "感谢统信在 wine 生态适配活动中提供的打包脚本",
"", "",
"可以从上面的各种解决方案更好的学习 Wine 生态适配,也可以看 deepin 论坛板块 https://bbs.deepin.org/module/detail/116 进行学习,最后也向各位有进行 Wine 生态适配的大佬进行由衷的更新!", "可以从上面的各种解决方案更好的学习 Wine 生态适配,也可以看 deepin 论坛板块 https://bbs.deepin.org/module/detail/116 进行学习,最后也向各位有进行 Wine 生态适配的大佬进行由衷的更新!",

View File

@ -18,12 +18,9 @@ import shutil
import requests import requests
import threading import threading
import traceback import traceback
import ttkthemes
import webbrowser import webbrowser
import subprocess import subprocess
import ttkbootstrap
import tkinter as tk import tkinter as tk
#import tkinter.ttk as ttk
import tkinter.filedialog import tkinter.filedialog
import tkinter.messagebox import tkinter.messagebox
import PyQt5.QtGui as QtGui import PyQt5.QtGui as QtGui
@ -82,7 +79,6 @@ def liulanbutton():
# 第二个浏览按钮事件 # 第二个浏览按钮事件
def liulanexebutton(): def liulanexebutton():
path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 exe 可执行文件", json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExe.json"))["path"], "exe 可执行文件(*.exe);;EXE 可执行文件(*.EXE);;所有文件(*.*)") path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 exe 可执行文件", json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExe.json"))["path"], "exe 可执行文件(*.exe);;EXE 可执行文件(*.EXE);;所有文件(*.*)")
#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 != "()": if path != "" and path != "()":
e2.setEditText(path[0]) # 显示路径 e2.setEditText(path[0]) # 显示路径
write_txt(get_home() + "/.config/deepin-wine-runner/FindExe.json", json.dumps({"path": os.path.dirname(path[0])})) # 写入配置文件 write_txt(get_home() + "/.config/deepin-wine-runner/FindExe.json", json.dumps({"path": os.path.dirname(path[0])})) # 写入配置文件
@ -93,7 +89,6 @@ def runexebutton(self):
global run global run
DisableButton(True) DisableButton(True)
if not CheckProgramIsInstall(wine[o1.currentText()]): if not CheckProgramIsInstall(wine[o1.currentText()]):
#if not tkinter.messagebox.askyesno(title="提示", message="检查到您未安装这个 wine是否继续使用这个 wine 运行?"):
if QtWidgets.QMessageBox.question(widget, "提示", "检查到您未安装这个 wine是否继续使用这个 wine 运行?") == QtWidgets.QMessageBox.No: if QtWidgets.QMessageBox.question(widget, "提示", "检查到您未安装这个 wine是否继续使用这个 wine 运行?") == QtWidgets.QMessageBox.No:
DisableButton(False) DisableButton(False)
return return
@ -286,7 +281,7 @@ def ListToDictionary(list):
return dictionary return dictionary
def CleanProgramHistory(): def CleanProgramHistory():
if tkinter.messagebox.askokcancel(title="警告", message="删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。"): if QtWidgets.QMessageBox.question(title="警告", message="删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。") == QtWidgets.QMessageBox.Yes:
shutil.rmtree(get_home() + "/.config/deepin-wine-runner") shutil.rmtree(get_home() + "/.config/deepin-wine-runner")
ReStartProgram() ReStartProgram()
@ -365,7 +360,7 @@ def RunWineProgram(wineProgram, history = False, Disbled = True):
global runProgram global runProgram
DisableButton(True) DisableButton(True)
if not CheckProgramIsInstall(wine[o1.currentText()]): if not CheckProgramIsInstall(wine[o1.currentText()]):
if not tkinter.messagebox.askyesno(title="提示", message="检查到您未安装这个 wine是否继续使用这个 wine 运行?"): if QtWidgets.QMessageBox.question(title="提示", message="检查到您未安装这个 wine是否继续使用这个 wine 运行?") == QtWidgets.QMessageBox.No:
DisableButton(False) DisableButton(False)
return return
returnText.setText("") returnText.setText("")
@ -407,7 +402,7 @@ def RunWinetricks():
global runWinetricks global runWinetricks
DisableButton(True) DisableButton(True)
if not CheckProgramIsInstall(wine[o1.currentText()]): if not CheckProgramIsInstall(wine[o1.currentText()]):
if not tkinter.messagebox.askyesno(title="提示", message="检查到您未安装这个 wine是否继续使用这个 wine 运行?"): if QtWidgets.QMessageBox.question(widget, "提示", "检查到您未安装这个 wine是否继续使用这个 wine 运行?") == QtWidgets.QMessageBox.No:
DisableButton(False) DisableButton(False)
return return
returnText.setText("") returnText.setText("")
@ -676,7 +671,6 @@ class GetDllFromWindowsISO:
widgetLayout.addWidget(GetDllFromWindowsISO.foundButton, 3, 2, 1, 1) widgetLayout.addWidget(GetDllFromWindowsISO.foundButton, 3, 2, 1, 1)
widgetLayout.addWidget(GetDllFromWindowsISO.dllList, 4, 1, 1, 1) widgetLayout.addWidget(GetDllFromWindowsISO.dllList, 4, 1, 1, 1)
widgetLayout.addWidget(dllControl, 5, 1, 1, 1) widgetLayout.addWidget(dllControl, 5, 1, 1, 1)
#widgetLayout.addWidget(GetDllFromWindowsISO.setWineBotton, 5, 2, 1, 1)
widget.setLayout(widgetLayout) widget.setLayout(widgetLayout)
GetDllFromWindowsISO.browser.clicked.connect(GetDllFromWindowsISO.Browser) GetDllFromWindowsISO.browser.clicked.connect(GetDllFromWindowsISO.Browser)
GetDllFromWindowsISO.mountButton.clicked.connect(GetDllFromWindowsISO.MountDisk) GetDllFromWindowsISO.mountButton.clicked.connect(GetDllFromWindowsISO.MountDisk)
@ -689,6 +683,8 @@ class GetDllFromWindowsISO:
GetDllFromWindowsISO.dllListModel.setStringList([]) GetDllFromWindowsISO.dllListModel.setStringList([])
GetDllFromWindowsISO.dllList.setModel(GetDllFromWindowsISO.dllListModel) GetDllFromWindowsISO.dllList.setModel(GetDllFromWindowsISO.dllListModel)
GetDllFromWindowsISO.isoPath.currentText() GetDllFromWindowsISO.isoPath.currentText()
GetDllFromWindowsISO.message.setWindowTitle(f"Wine 运行器 {version}——从 ISO 提取 DLL")
GetDllFromWindowsISO.message.setWindowIcon(iconPath)
GetDllFromWindowsISO.message.show() GetDllFromWindowsISO.message.show()
def DisbledUp(state): def DisbledUp(state):
@ -733,13 +729,6 @@ class GetDllFromWindowsISO:
QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, "错误", traceback.format_exc()) QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, "错误", traceback.format_exc())
def ExitWindow():
if GetDllFromWindowsISO.mount:
tkinter.messagebox.showinfo(title="提示", message="请关闭/卸载镜像后再关闭本窗口")
return
DisableButton(False)
GetDllFromWindowsISO.message.quit()
def MountDisk(): def MountDisk():
if not os.path.exists(GetDllFromWindowsISO.isoPath.currentText()): if not os.path.exists(GetDllFromWindowsISO.isoPath.currentText()):
QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, "错误", "您选择的 ISO 镜像文件不存在") QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, "错误", "您选择的 ISO 镜像文件不存在")
@ -856,7 +845,7 @@ class ProgramSetting():
return return
def Browser(): def Browser():
path = QtWidgets.QFileDialog.getExistingDirectory(ProgramSetting.message, "选择 Wine 容器", json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"])#tkinter.filedialog.askdirectory(title="选择 Wine 容器", initialdir=json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"]) path = QtWidgets.QFileDialog.getExistingDirectory(ProgramSetting.message, "选择 Wine 容器", json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"])
if path == "" or path == None or path == "()" or path == (): if path == "" or path == None or path == "()" or path == ():
return return
ProgramSetting.defultBotton.setText(path) ProgramSetting.defultBotton.setText(path)

Binary file not shown.

View File

@ -1,29 +0,0 @@
#!/bin/sh
case $1 in
"configure")
echo "most recently configured version $2"
;;
"abort-upgrade")
echo "Old: abort upgrade to $2"
;;
"abort-remove")
if [ "#$2" == "#in-favour" ]; then
echo "Conflictor: try to install package $3 version $4"
else
echo "abort-remove"
fi
;;
"abort-deconfigure")
# $2 == "in-favour"
echo "Conflictor: failed install package:$3 version $4"
if [ "#$5" == "removing" ]; then
echo "Deconfigured: removing conflicting package $6 version $7"
fi
*)
esac
# Make sure the script returns 0
true
#DEBHELPER#

View File

@ -1,39 +0,0 @@
#!/bin/sh
case $1 in
"remove")
if [ "#$2" = "in-favour" ]; then
echo "Conflictor: install $3 version $4 to remove me"
else
echo "normal remove me"
fi
;;
"purge")
echo "purge"
;;
"upgrade")
echo "Old: upgrade to $2"
;;
"abort-upgrade")
echo "abort to upgrade to $2"
;;
"failed-upgrade")
echo "failed upgrade from version $2"
;;
"abort-install")
if [ ! -z "$2" ]; then
echo "abort install form version $3"
else
echo "abort-install"
fi
;;
"disappear")
echo "Disappearer: overwirte by $3 version $4"
;;
*)
esac
# Make sure the script returns 0
true
#DEBHELPER#

View File

@ -1,23 +0,0 @@
#!/bin/sh
case $1 in
"install")
if [ ! -z "$2" ]; then
echo "try to install from version $2"
else
echo "normal install"
fi
;;
"upgrade")
echo "upgrade from version $2"
;;
"abort-upgrade")
echo "Old: abort upgrade to version $2"
;;
*)
esac
# Make sure the script returns 0
true
#DEBHELPER#

View File

@ -1,30 +0,0 @@
#!/bin/sh
case $1 in
"remove")
if [ "#$2" == "#in-favour" ]; then
echo "Conflictor: install $3 version $4 to remove me"
else
echo "normal remove"
fi
;;
"upgrade")
echo "Old: upgrade to version $2"
;;
"failed-upgrade")
echo "failed to upgrade from $3"
;;
"deconfigure")
# $2 == "in-favour"
echo "Deconfigured: install package:$3 version $4"
if [ "#$5" == "removing" ]; then
echo "Deconfigured: removing conflicting package $6 version $7"
fi
;;
*)
esac
# Make sure the script returns 0
true
#DEBHELPER#

View File

@ -1,227 +0,0 @@
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本1.6.1
# 更新时间2022年07月14日
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 的 tkinter 构建
###########################################################################################
#################
# 引入所需的库
#################
import os
import json
import easygui
import ttkthemes
import subprocess
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox
###################
# 程序所需事件
###################
# 读取文本文档
def readtxt(path):
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
# 获取用户主目录
def get_home():
return os.path.expanduser('~')
# 写入文本文档
def WriteTXT(path, things):
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
def DisbledOrEnabled(choose: bool):
state = [tk.NORMAL, tk.DISABLED]
choose = int(choose)
e1.config(state=state[choose])
e2.config(state=state[choose])
e3.config(state=state[choose])
e4.config(state=state[choose])
e5.config(state=state[choose])
e6.config(state=state[choose])
e7.config(state=state[choose])
buildDeb.config(state=state[choose])
def PackageDeb():
DisbledOrEnabled(True)
for i in windowFrameInputValueList:
if i.get() == "":
tkinter.messagebox.showinfo(title="提示", message="您未填完所有信息,无法继续")
return
startupWMClassName = os.path.basename(exePath.get().replace("\\", "/"))
print(startupWMClassName)
WriteTXT(f"{programPath}/package-hshw.sh", f"""#!/bin/bash
#最终生成的包的描述
export app_description="{debDescription.get()}"
#应用程序英文名
export app_name="{englishName.get()}"
#应用程序中文名
export app_name_zh_cn="{chineseName.get()}"
#desktop文件中的分类
export desktop_file_categories="{typeName.get()};"
#desktop文件中StartupWMClass字段。用于让桌面组件将窗口类名与desktop文件相对应。这个值为实际运行的主程序EXE的文件名wine/crossover在程序运行后会将文件名设置为窗口类名
export desktop_file_main_exe="{startupWMClassName}"
export exec_path="{exePath.get()}"
#最终生成的包的包名,包名的命名规则以deepin开头加官网域名需要前后对调位置如还不能区分再加上应用名
export deb_package_name="{packageName.get()}"
#最终生成的包的版本号,版本号命名规则:应用版本号+deepin+数字
export deb_version_string="{versionName.get()}"
export package_depends="deepin-wine6-stable:amd64 (>= 6.0.0.12-1), deepin-wine-helper (>= 5.1.25-1)"
export apprun_cmd="deepin-wine6-stable"
#export package_depends="deepin-wine5-stable:amd64 (>= 5.0.29-1), deepin-wine-helper (>= 5.1.25-1)"
#export apprun_cmd="deepin-wine5-stable"
# rm -fr final.dir/
# rm -fr icons/
# rm -fr staging.dir/
./script-packager.sh $@
""")
os.chdir(programPath)
RunCommand(f"./package-hshw.sh")
DisbledOrEnabled(False)
def RunCommand(command):
res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# 清空文本框内容
commandReturn.config(state=tk.NORMAL)
commandReturn.delete(1.0, "end")
commandReturn.config(state=tk.DISABLED)
# 实时读取程序返回
while res.poll() is None:
commandReturn.config(state=tk.NORMAL)
try:
text = res.stdout.readline().decode("utf8")
except:
text = ""
commandReturn.insert("end", text)
print(text, end="")
commandReturn.config(state=tk.DISABLED)
def ShowHelp():
easygui.textbox(title="帮助", msg="下面是有关打包器的各个输入框的意义以及有关的 UOS 填写标准", text=tips)
def OpenPackageFolder():
os.system(f"xdg-open '{programPath}/package_save/uos'")
###########################
# 程序信息
###########################
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(f"{programPath}/information.json"))
version = information["Version"]
iconPath = "{}/icon.png".format(programPath)
tips = """第一个文本框是应用程序中文名
第二个文本框是应用程序英文名
第三个文本框是最终生成的包的描述
第四个选择框是desktop文件中的分类
第五个输入框是程序在 Wine 容器的位置 c:\\XXX 的形式盘符必须小写用反斜杠如果路径带用户名的话会自动替换为$USER
StartupWMClass 字段将会由程序自动生成作用如下
desktop文件中StartupWMClass字段用于让桌面组件将窗口类名与desktop文件相对应这个值为实际运行的主程序EXE的文件名wine/crossover在程序运行后会将文件名设置为窗口类名
第六个输入框是最终生成的包的包名,包名的命名规则以deepin开头加官网域名需要前后对调位置如还不能区分再加上应用名
最后一个是最终生成的包的版本号版本号命名规则应用版本号+deepin+数字
"""
###########################
# 窗口创建
###########################
# 读取主题
try:
theme = not ("dark" in readtxt(get_home() + "/.gtkrc-2.0") and "gtk-theme-name=" in readtxt(get_home() + "/.gtkrc-2.0"))
except:
print("主题读取错误,默认使用浅色主题")
theme = True
if theme:
win = tk.Tk()
themes = ttkthemes.ThemedStyle(win)
themes.set_theme("breeze")
else:
import ttkbootstrap
style = ttkbootstrap.Style(theme="darkly")
win = style.master # 创建窗口
# 变量声明
chineseName = tk.StringVar()
englishName = tk.StringVar()
debDescription = tk.StringVar()
typeName = tk.StringVar()
exePath = tk.StringVar()
packageName = tk.StringVar()
versionName = tk.StringVar()
commandReturn = tk.Text()
typeName.set("Network")
windowFrameInputValueList = [
chineseName,
englishName,
debDescription,
typeName,
exePath,
packageName,
versionName
]
# Line 1
ttk.Label(win, text="程序中文名:").grid(row=0, column=0)
e1 = ttk.Entry(win, textvariable=chineseName, width=100)
e1.grid(row=0, column=1)
# Line 2
ttk.Label(win, text="程序英文名:").grid(row=1, column=0)
e2 = ttk.Entry(win, textvariable=englishName, width=100)
e2.grid(row=1, column=1)
# Line 3
ttk.Label(win, text="包描述:").grid(row=2, column=0)
e3 = ttk.Entry(win, textvariable=debDescription, width=100)
e3.grid(row=2, column=1)
# Line 4
ttk.Label(win, text="程序分类").grid(row=3, column=0)
e4 = ttk.OptionMenu(win, typeName, "Network", "Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility", "System")
e4.grid(row=3, column=1)
# Line 5
ttk.Label(win, text="程序在 Wine 容器的位置").grid(row=4, column=0)
e5 = ttk.Entry(win, textvariable=exePath, width=100)
e5.grid(row=4, column=1)
# Line 6
ttk.Label(win, text="包名:").grid(row=5, column=0)
e6 = ttk.Entry(win, textvariable=packageName, width=100)
e6.grid(row=5, column=1)
# Line 7
ttk.Label(win, text="版本号:").grid(row=6, column=0)
e7 = ttk.Entry(win, textvariable=versionName, width=100)
e7.grid(row=6, column=1)
# Line 8
controlFrame = ttk.Frame(win)
buildDeb = ttk.Button(controlFrame, text="打包", command=PackageDeb)
debPath = ttk.Button(controlFrame, text="deb 包生成目录", command=OpenPackageFolder)
buildDeb.grid(row=0, column=1)
debPath.grid(row=0, column=0)
controlFrame.grid(row=7, column=0, columnspan=2)
# Line 9
commandReturn = tk.Text(win, width=100, height=5)
commandReturn.grid(row=8, column=0, columnspan=2)
# Menu
menu = tk.Menu()
programMenu = tk.Menu()
menu.add_cascade(label="程序", menu=programMenu)
programMenu.add_command(label="退出", command=win.destroy)
menu.add_command(label="帮助", command=ShowHelp)
# 设置控件
win.config(menu=menu)
win.iconphoto(False, tk.PhotoImage(file=iconPath))
win.title(f"Wine 打包器 {version}——基于统信 Wine 生态活动打包脚本制作")
commandReturn.config(state=tk.DISABLED)
win.mainloop()

View File

@ -1,20 +1,20 @@
#!/bin/bash #!/bin/bash
#最终生成的包的描述 #最终生成的包的描述
export app_description="3" export app_description="Deepin-plantsvszombies"
#应用程序英文名 #应用程序英文名
export app_name="2" export app_name="Deepin-plantsvszombies"
#应用程序中文名 #应用程序中文名
export app_name_zh_cn="1" export app_name_zh_cn="Deepin-plantsvszombies"
#desktop文件中的分类 #desktop文件中的分类
export desktop_file_categories="Network;" export desktop_file_categories="Network;"
#desktop文件中StartupWMClass字段。用于让桌面组件将窗口类名与desktop文件相对应。这个值为实际运行的主程序EXE的文件名wine/crossover在程序运行后会将文件名设置为窗口类名 #desktop文件中StartupWMClass字段。用于让桌面组件将窗口类名与desktop文件相对应。这个值为实际运行的主程序EXE的文件名wine/crossover在程序运行后会将文件名设置为窗口类名
export desktop_file_main_exe="a" export desktop_file_main_exe="PlantsVsZombies.exe"
export exec_path="c:\\a" export exec_path="c:/Program Files/plantsvszombies/PlantsVsZombies.exe"
#最终生成的包的包名,包名的命名规则以deepin开头加官网域名需要前后对调位置如还不能区分再加上应用名 #最终生成的包的包名,包名的命名规则以deepin开头加官网域名需要前后对调位置如还不能区分再加上应用名
export deb_package_name="1" export deb_package_name="Deepin-plantsvszombies"
#最终生成的包的版本号,版本号命名规则:应用版本号+deepin+数字 #最终生成的包的版本号,版本号命名规则:应用版本号+deepin+数字
export deb_version_string="2" export deb_version_string="1"
export package_depends="deepin-wine6-stable:amd64 (>= 6.0.0.12-1), deepin-wine-helper (>= 5.1.25-1)" export package_depends="deepin-wine6-stable:amd64 (>= 6.0.0.12-1), deepin-wine-helper (>= 5.1.25-1)"
export apprun_cmd="deepin-wine6-stable" export apprun_cmd="deepin-wine6-stable"

212
package-script/package.py Executable file
View File

@ -0,0 +1,212 @@
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本1.7.0
# 更新时间2022年07月18日
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 的 tkinter 构建
###########################################################################################
#################
# 引入所需的库
#################
import os
import sys
import json
import subprocess
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
###################
# 程序所需事件
###################
# 读取文本文档
def readtxt(path):
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
# 获取用户主目录
def get_home():
return os.path.expanduser('~')
# 写入文本文档
def WriteTXT(path, things):
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
def DisbledOrEnabled(choose: bool):
chineseName.setDisabled(choose)
englishName.setDisabled(choose),
debDescription.setDisabled(choose)
typeName.setDisabled(choose)
exePath.setDisabled(choose)
packageName.setDisabled(choose)
versionName.setDisabled(choose)
class PackageDebThread(QtCore.QThread):
signal = QtCore.pyqtSignal(str)
def __init__(self) -> None:
super().__init__()
def run(self):
startupWMClassName = os.path.basename(exePath.text().replace("\\", "/"))
print(startupWMClassName)
WriteTXT(f"{programPath}/package-hshw.sh", f"""#!/bin/bash
#最终生成的包的描述
export app_description="{debDescription.text()}"
#应用程序英文名
export app_name="{englishName.text()}"
#应用程序中文名
export app_name_zh_cn="{chineseName.text()}"
#desktop文件中的分类
export desktop_file_categories="{typeName.currentText()};"
#desktop文件中StartupWMClass字段。用于让桌面组件将窗口类名与desktop文件相对应。这个值为实际运行的主程序EXE的文件名wine/crossover在程序运行后会将文件名设置为窗口类名
export desktop_file_main_exe="{startupWMClassName}"
export exec_path="{exePath.text()}"
#最终生成的包的包名,包名的命名规则以deepin开头加官网域名需要前后对调位置如还不能区分再加上应用名
export deb_package_name="{packageName.text()}"
#最终生成的包的版本号,版本号命名规则:应用版本号+deepin+数字
export deb_version_string="{versionName.text()}"
export package_depends="deepin-wine6-stable:amd64 (>= 6.0.0.12-1), deepin-wine-helper (>= 5.1.25-1)"
export apprun_cmd="deepin-wine6-stable"
#export package_depends="deepin-wine5-stable:amd64 (>= 5.0.29-1), deepin-wine-helper (>= 5.1.25-1)"
#export apprun_cmd="deepin-wine5-stable"
# rm -fr final.dir/
# rm -fr icons/
# rm -fr staging.dir/
./script-packager.sh $@
""")
os.chdir(programPath)
res = subprocess.Popen(["./package-hshw.sh"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# 实时读取程序返回
while res.poll() is None:
try:
text = res.stdout.readline().decode("utf8")
except:
text = ""
self.signal.emit(text)
print(text, end="")
DisbledOrEnabled(False)
class QT:
run = None
def PackageDeb():
DisbledOrEnabled(True)
for i in [chineseName.text(), englishName.text(), debDescription.text(), typeName.currentText(), exePath.text(), packageName.text(), versionName.text()]:
if i == "":
QtWidgets.QMessageBox.information(widget, "提示", "您未填完所有信息,无法继续")
DisbledOrEnabled(False)
return
commandReturn.setText("")
QT.run = PackageDebThread()
QT.run.signal.connect(RunCommand)
QT.run.start()
def RunCommand(command):
commandReturn.append(command)
def ShowHelp():
QtWidgets.QMessageBox.information(widget, "帮助", f"下面是有关打包器的各个输入框的意义以及有关的 UOS 填写标准\n{tips}")
def OpenPackageFolder():
os.system(f"xdg-open '{programPath}/package_save/uos'")
###########################
# 程序信息
###########################
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(f"{programPath}/information.json"))
version = information["Version"]
iconPath = "{}/icon.png".format(programPath)
tips = """第一个文本框是应用程序中文名
第二个文本框是应用程序英文名
第三个文本框是最终生成的包的描述
第四个选择框是desktop文件中的分类
第五个输入框是程序在 Wine 容器的位置 c:\\XXX 的形式盘符必须小写用反斜杠如果路径带用户名的话会自动替换为$USER
StartupWMClass 字段将会由程序自动生成作用如下
desktop文件中StartupWMClass字段用于让桌面组件将窗口类名与desktop文件相对应这个值为实际运行的主程序EXE的文件名wine/crossover在程序运行后会将文件名设置为窗口类名
第六个输入框是最终生成的包的包名,包名的命名规则以deepin开头加官网域名需要前后对调位置如还不能区分再加上应用名
最后一个是最终生成的包的版本号版本号命名规则应用版本号+deepin+数字
"""
###########################
# 窗口创建
###########################
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
widget = QtWidgets.QWidget()
widgetLayout = QtWidgets.QGridLayout()
size = QtWidgets.QSizePolicy()
size.setHorizontalPolicy(0)
chineseName = QtWidgets.QLineEdit()
englishName = QtWidgets.QLineEdit()
debDescription = QtWidgets.QLineEdit()
typeName = QtWidgets.QComboBox()
exePath = QtWidgets.QLineEdit()
packageName = QtWidgets.QLineEdit()
versionName = QtWidgets.QLineEdit()
controlFrame = QtWidgets.QHBoxLayout()
buildDeb = QtWidgets.QPushButton("打包")
debPath = QtWidgets.QPushButton("deb 包生成目录")
buildDeb.setSizePolicy(size)
debPath.setSizePolicy(size)
commandReturn = QtWidgets.QTextBrowser()
typeName.addItems(["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility", "System"])
controlFrame.addWidget(buildDeb)
controlFrame.addWidget(debPath)
widgetLayout.addWidget(QtWidgets.QLabel("程序中文名:"), 0, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("程序英文名:"), 1, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("包描述:"), 2, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("程序分类:"), 3, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("程序在 Wine 容器的位置:"), 4, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("包名:"), 5, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("版本号:"), 6, 0, 1, 1)
widgetLayout.addWidget(chineseName, 0, 1, 1, 1)
widgetLayout.addWidget(englishName, 1, 1, 1, 1)
widgetLayout.addWidget(debDescription, 2, 1, 1, 1)
widgetLayout.addWidget(typeName, 3, 1, 1, 1)
widgetLayout.addWidget(exePath, 4, 1, 1, 1)
widgetLayout.addWidget(packageName, 5, 1, 1, 1)
widgetLayout.addWidget(versionName, 6, 1, 1, 1)
widgetLayout.addLayout(controlFrame, 7, 0, 1, 2)
widgetLayout.addWidget(commandReturn, 8, 0, 1, 2)
buildDeb.clicked.connect(PackageDeb)
debPath.clicked.connect(OpenPackageFolder)
widget.setLayout(widgetLayout)
window.setCentralWidget(widget)
window.resize(window.frameGeometry().width() * 1.5, window.frameGeometry().height())
window.setWindowIcon(QtGui.QIcon(iconPath))
menu = window.menuBar()
programMenu = menu.addMenu("程序")
exit = QtWidgets.QAction("退出")
exit.triggered.connect(window.close)
help = QtWidgets.QAction("帮助")
help.triggered.connect(ShowHelp)
menu.addAction(help)
programMenu.addAction(exit)
print(iconPath)
window.show()
window.setWindowTitle(f"Wine 打包器 {version}——基于统信 Wine 生态活动打包脚本制作")
windowFrameInputValueList = [
chineseName,
englishName,
debDescription,
typeName,
exePath,
packageName,
versionName
]
sys.exit(app.exec_())

View File

@ -1,33 +0,0 @@
[File]
;;=============================================================
;; Registry - Mask this file is a registry file.
;; Keep - Default. Use template file.
;; Override - Use file in current prefix.
;; Replace - If it's different type in current prefix and
;; in template, use template one to replace it.
;; Ingore - Ingore file when copy.
;; Ingore update.policy itself.
"^update.policy$" = "Ingore"
"^.update-timestamp$" = "Ingore"
;; System registry files.
"^(system|userdef|user).reg$" = "Registry"
;; Addtional assist files.
"^drive_c/Deepin" = "Keep"
;; Microsoft Office files.
"^drive_c/Windows/(?:control\.ini|hh\.dat|mapiuid\.ini|Reg Save Log\.txt)$" = "Override"
[Registry]
;;=============================================================
;; Keep - Use template key section
;; Override - Use user current key section
;; Merge - Default. Merge two section, user current values
override template
"^Software\\Wine\\DllOverrides$" = "Keep"
"^Software\\Wine\\Fonts\\Replacements$" = "Keep"