deb包构建完成,即将测试

This commit is contained in:
gfdgd xi 2022-07-18 22:50:39 +08:00
parent e9f24c2cc0
commit 3c25c54aca
28 changed files with 1524 additions and 1007 deletions

View File

@ -4,18 +4,17 @@ Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿
Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner
Architecture: all
Priority: optional
Depends: python3, python3-tk, python3-pip, python3-pil, python3-pil.imagetk, python3-pyquery, deepin-terminal, aria2, curl, unrar, unzip, python3-requests, fakeroot, bash
Depends: python3, python3-pil, python3-pil.imagetk, python3-pyquery, deepin-terminal, aria2, curl, unrar, unzip, python3-requests, fakeroot, bash, python3-pyqt5
Conflicts: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer
Replaces: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer
Description: gfdgd xi 制作的 wine 运行器
更新内容:
※1、新增程序感谢、谢明以及程序的建议和问题反馈和内置更新程序
※2、支持 winetricks 指定 Wine 打开
※3、新增窗口透明工具感谢@a2035274 和 @虚幻的早晨 在论坛的讨论
※4、支持在指定容器、Wine 安装 MSXML
※5、支持启用/关闭 opengl感谢@zhangs 在论坛发帖)以及支持安装/卸载 winbind
※6、添加云沙箱的网站链接快捷方式
※7、支持从星火应用商店源安装 Windows 常见字体
8、优化窗口布局以及默认显示位置
9、支持打开指定容器、Wine 的资源管理器
※1、界面大改造从使用 Tkinter 改为 Qt参考了 @134******28 和 @sgb76 提供的设计方案和代码
※2、添加了基于 UOS 生态适配活动打包脚本的打包器,以及基于 Virtualbox 的简易 Windows 镜像安装工具
※3、将 pip 由阿里源改为华为源,提升下载安装速度,并删除使用 pip 下载库的功能(已不需要,废弃)
4、添加 @delsin 和 @神末shenmo 建议的 postrm 脚本
5、优化多屏窗口居中问题
6、修复 1.6.0 程序无法保存设置的问题
7、修复 1.6.0 的更新程序无法正常更新的问题
8、升级 Geek Uninstaller 版本
作者gfdgd xi、为什么您不喜欢熊出没和阿布呢

View File

@ -0,0 +1,17 @@
#!/bin/bash
# 使用系统默认的 bash 运行
###########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本1.7.0
# 更新时间2022年07月15日
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 的 tkinter 构建
###########################################################################################
cd `dirname $0`
which VBoxManage
if test $? == 0 ; then
VM/VirtualMachine
exit
fi
echo 未安装 VirtualBox开始安装安装结束重新运行即可
./launch.sh deepin-terminal -C "pkexec apt install virtualbox-6.1 -y && zenity --info --text=\"安装完毕,关闭此对话框和安装终端重新运行程序即可\" --no-wrap" --keep-open

View File

@ -0,0 +1,22 @@
#!/bin/bash
# 使用系统默认的 bash 运行
###########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本1.7.0
# 更新时间2022年07月15日
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 的 tkinter 构建
###########################################################################################
VBoxManage showvminfo Windows
if test 0 == $?; then
# 检测到虚拟机存在,启动虚拟机
VBoxManage startvm Windows
exit
fi
zenity --question --no-wrap --text="检查到您未创建所指定的虚拟机,是否创建虚拟机并继续?\n如果不创建将无法使用"
if test 1 == $?; then
# 用户不想创建虚拟机,结束
exit
fi
cd `dirname $0`
./VM/VirtualMachine

View File

@ -0,0 +1,24 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
/usr/include/c++/8 \
/usr/include/x86_64-linux-gnu/c++/8 \
/usr/include/c++/8/backward \
/usr/lib/gcc/x86_64-linux-gnu/8/include \
/usr/local/include \
/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed \
/usr/include/x86_64-linux-gnu \
/usr/include
QMAKE_CXX.LIBDIRS = \
/usr/lib/gcc/x86_64-linux-gnu/8 \
/usr/lib/x86_64-linux-gnu \
/usr/lib \
/lib/x86_64-linux-gnu \
/lib

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,125 @@
################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本1.0
# 依照 GPL V3 协议开源
################################################
# 参考文献:
# https://juejin.cn/post/7080484519328874510
################################################
import os
import subprocess
homePath = os.path.expanduser('~')
programPath = os.path.split(os.path.realpath(__file__))[0]
class File:
def __init__(self, path) -> None:
self.path = path
def getFileFolderSize(self):
"""get size for file or folder"""
totalSize = 0
if not os.path.exists(self.path):
return totalSize
if os.path.isfile(self.path):
totalSize = os.path.getsize(self.path) # 5041481
return totalSize
if os.path.isdir(self.path):
with os.scandir(self.path) as dirEntryList:
for curSubEntry in dirEntryList:
curSubEntryFullPath = os.path.join(self.path, curSubEntry.name)
if curSubEntry.is_dir():
curSubFolderSize = self.path(curSubEntryFullPath) # 5800007
totalSize += curSubFolderSize
elif curSubEntry.is_file():
curSubFileSize = os.path.getsize(curSubEntryFullPath) # 1891
totalSize += curSubFileSize
return totalSize
class Manager:
def __init__(self, name: str, managerPath: str="VBoxManage") -> None:
self.name = name
self.managerPath = managerPath
self.vboxVersion = subprocess.getoutput(f"\"{self.managerPath}\" -v")
def Create(self, type: str="Windows7") -> None:
os.system(f"\"{self.managerPath}\" createvm --name \"{self.name}\" --ostype \"{type}\" --register")
def CreateDisk(self, path: str, size: int) -> None:
os.system(f"\"{self.managerPath}\" createvdi --filename \"{path}\" --size \"{size}\"")
def CreateDiskControl(self, controlName: str="storage_controller_1") -> None:
os.system(f"\"{self.managerPath}\" storagectl \"{self.name}\" --name \"{controlName}\" --add ide")
def MountDisk(self, diskPath: str, controlName: str="storage_controller_1", port: int=0, device: int=0) -> None:
os.system(f"\"{self.managerPath}\" storageattach \"{self.name}\" --storagectl \"{controlName}\" --type hdd --port {port} --device {device} --medium \"{diskPath}\"")
def MountISO(self, isoPath: str, controlName: str="storage_controller_1", port: int=1, device: int=0) -> None:
os.system(f"\"{self.managerPath}\" storageattach \"{self.name}\" --storagectl \"{controlName}\" --type dvddrive --port {port} --device {device} --medium \"{isoPath}\"")
def BootFirst(self, bootDrive: str) -> None:
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --boot1 {bootDrive}")
def SetNetBridge(self, netDriver: str) -> None:
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --nic1 bridged --cableconnected1 on --nictype1 82540EM --bridgeadapter1 \"{netDriver}\" --intnet1 brigh1 --macaddress1 auto")
#os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --nic1 hostif")
pass
def SetCPU(self, number: int) -> None:
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --cpus {number}")
def SetMemory(self, memory: int) -> None:
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --memory {memory}")
def SetRemote(self, setting: bool) -> None:
if setting:
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrde on")
return
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrde off")
def SetRemoteConnectSetting(self, port: int=5540) -> None:
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrdeport {port} --vrdeaddress """)
def Start(self, unShown: bool = False) -> None:
if unShown:
os.system(f"\"{self.managerPath}\" startvm \"{self.name}\" -type headless")
return
os.system(f"\"{self.managerPath}\" startvm \"{self.name}\"")
def Stop(self) -> None:
os.system(f"\"{self.managerPath}\" controlvm \"{self.name}\" poweroff")
def Delete(self) -> None:
os.system(f"\"{self.managerPath}\" unregistervm --delete \"{self.name}\"")
def SetDisplayMemory(self, memory: int) -> None:
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vram {memory}")
def InstallGuessAdditions(self, controlName: str="storage_controller_1", port: int=1, device: int=0) -> None:
self.MountISO("/usr/share/virtualbox/VBoxGuestAdditions.iso", controlName, port, device)
def EnabledAudio(self) -> None:
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --audio pulse --audiocontroller hda --audioin on --audioout on")
#os.system("")
def EnabledClipboardMode(self):
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --clipboard-mode bidirectional")
def EnabledDraganddrop(self):
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --draganddrop bidirectional")
def ShareFile(self, name, path):
os.system(f"\"{self.managerPath}\" sharedfolder add \"{self.name}\" -name \"{name}\" -hostpath \"{path}\"")
def SetVBoxSVGA(self):
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --graphicscontroller vboxsvga")
def SetMousePS2(self):
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --mouse usb")
def SetKeyboardPS2(self):
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --keyboard usb")
def OpenUSB(self):
os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --usbohci on")
pass

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -0,0 +1,50 @@
#!/usr/bin/env python3
import os
import api
import sys
import psutil
if __name__ == "__main__":
os.system("clear")
programPath = os.path.split(os.path.realpath(__file__))[0]
if len(sys.argv) < 3 :
print("参数不齐!")
exit()
net = ""
for k, v in psutil.net_if_addrs().items():
for item in v:
if item[0] == 2 and not item[1] == "127.0.0.1" and not item[1] == "192.168.250.1":
net = k
break
if net == "":
exit()
# 创建一个叫Windows的虚拟机
vm = api.Manager("Windows")
if sys.argv[2] == "0":
vm.Create("Windows7")
elif sys.argv[2] == "1":
vm.Create("Windows7_64")
else:
vm.Create("WindowsNT_64")
vm.CreateDisk(f"{api.homePath}/VirtualBox VMs/Windows/Windows.vdi", 131072)
vm.CreateDiskControl()
vm.MountDisk(f"{api.homePath}/VirtualBox VMs/Windows/Windows.vdi")
vm.MountISO(sys.argv[1])
if sys.argv[2] == "0":
vm.MountISO(f"{programPath}/Windows7X86Auto.iso", device=1)
elif sys.argv[2] == "1":
vm.MountISO(f"{programPath}/Windows7X64Auto.iso", device=1)
vm.SetCPU(1)
vm.SetMemory(psutil.virtual_memory().total // 1024 // 1024 // 3)
vm.SetDisplayMemory(32)
vm.SetNetBridge(net)
vm.EnabledAudio()
vm.EnabledClipboardMode()
vm.EnabledDraganddrop()
vm.SetVBoxSVGA()
vm.SetMousePS2()
vm.SetKeyboardPS2()
vm.OpenUSB()
vm.ShareFile("ROOT", "/")
vm.ShareFile("HOME", api.homePath)
vm.Start()

View File

@ -0,0 +1,62 @@
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本1.6.1
# 更新时间2022年07月14日
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 的 tkinter 构建
###########################################################################################
#################
# 引入所需的库
#################
import os
import sys
import json
import threading
import PyQt5.QtWidgets as QtWidgets
# 读取文本文档
def readtxt(path):
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
def Unzip():
os.system("mkdir -p ~")
os.chdir(f"{homePath}")
os.system(f"unzip -o \"{programPath}/package-script.zip\"")
print("Unzip Done")
ReStartProgram()
# 重启本应用程序
def ReStartProgram():
python = sys.executable
os.execl(python, python, * sys.argv)
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
homePath = os.path.expanduser('~')
information = json.loads(readtxt(f"{programPath}/information.json"))
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:
app = QtWidgets.QApplication(sys.argv)
widget = QtWidgets.QWidget()
widgetLayout = QtWidgets.QVBoxLayout()
widget.setWindowTitle("解压中")
widgetLayout.addWidget(QtWidgets.QLabel("正在解压所需程序,请稍后……"))
progress = QtWidgets.QProgressBar()
progress.setMaximum(0)
progress.setMinimum(0)
progress.update()
widgetLayout.addWidget(progress)
widget.setLayout(widgetLayout)
widget.show()
# 解压流程
QtWidgets.QProgressDialog(None)
t = threading.Thread(target=Unzip)
t.start()
sys.exit(app.exec_())
os.chdir(f"{homePath}/package-script")
os.system("./package.py")
print("End")

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
#########################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布
# 版本1.5.3
# 版本1.7.0
# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 的 tkinter 构建
#########################################################################
@ -14,95 +14,103 @@ import json
import shutil
import random
import pathlib
import ttkthemes
import threading
import traceback
import subprocess
from PIL import Image
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
#################
# 程序所需事件
#################
def button1_cl():
path = filedialog.askdirectory(title="选择 wine 容器", initialdir="~/.deepinwine")
path = QtWidgets.QFileDialog.getExistingDirectory(widget, "选择 wine 容器", f"{get_home()}/.deepinwine")
if path != "":
e6_text.set(path)
e6_text.setText(path)
def button2_cl():
path = filedialog.askopenfilename(filetypes=[("PNG图标", "*.png"), ("SVG图标", "*.svg"), ("全部文件", "*.*")], title="选择图标文件", initialdir="~")
path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择图标文件", get_home(), "PNG图标(*.png);;SVG图标(*.svg);;全部文件(*.*)")[0]
if path != "":
e9_text.set(path)
e9_text.setText(path)
def button4_cl():
path = filedialog.asksaveasfilename(filetypes=[("deb 文件", "*.deb"), ("所有文件", "*.*")], title="保存 deb 包", initialdir="~", initialfile="{}_{}_i386.deb".format(e1_text.get(), e2_text.get()))
path = QtWidgets.QFileDialog.getSaveFileName(widget, "保存 deb 包", get_home(), "deb 文件(*.deb);;所有文件(*.*)", "{}_{}_i386.deb".format(e1_text.text(), e2_text.text()))[0]
if path != "":
e12_text.set(path)
e12_text.setText(path)
def disabled_or_NORMAL_all(choose):
chooses = {True: tk.NORMAL, False: tk.DISABLED}
a = chooses[choose]
label1.configure(state=a)
label2.configure(state=a)
label3.configure(state=a)
label4.configure(state=a)
label5.configure(state=a)
label6.configure(state=a)
label7.configure(state=a)
label8.configure(state=a)
label9.configure(state=a)
label10.configure(state=a)
label12.configure(state=a)
label14.configure(state=a)
label15.configure(state=a)
e1.configure(state=a)
e2.configure(state=a)
e3.configure(state=a)
e4.configure(state=a)
e5.configure(state=a)
e6.configure(state=a)
e7.configure(state=a)
e8.configure(state=a)
e9.configure(state=a)
e10.configure(state=a)
e12.configure(state=a)
e15.configure(state=a)
button1.config(state=a)
button2.config(state=a)
button4.config(state=a)
button5.config(state=a)
option1.config(state=a)
chooseWineHelper.config(state=a)
chooseWineVersion.config(state=a)
choose = not choose
e1_text.setDisabled(choose)
e2_text.setDisabled(choose)
e3_text.setDisabled(choose)
e4_text.setDisabled(choose)
e5_text.setDisabled(choose)
e6_text.setDisabled(choose)
e7_text.setDisabled(choose)
e8_text.setDisabled(choose)
e9_text.setDisabled(choose)
e10_text.setDisabled(choose)
e12_text.setDisabled(choose)
e15_text.setDisabled(choose)
button1.setDisabled(choose)
button2.setDisabled(choose)
button4.setDisabled(choose)
button5.setDisabled(choose)
option1_text.setDisabled(choose)
chooseWineHelperValue.setDisabled(choose)
wineVersion.setDisabled(choose)
class QT:
thread = None
def make_deb():
clean_textbox1_things()
disabled_or_NORMAL_all(False)
if e1_text.get() == "" or e2_text.get() == "" or e3_text.get() == "" or e4_text.get() == "" or e5_text.get() == "" or e6_text.get() == "" or e7_text.get() == "" or e8_text.get() == "" or e12_text.get() == "":
messagebox.showinfo(title="提示", message="必填信息没有填写完整,无法继续构建 deb 包")
if e1_text.text() == "" or e2_text.text() == "" or e3_text.text() == "" or e4_text.text() == "" or e5_text.text() == "" or e6_text.text() == "" or e7_text.text() == "" or e8_text.text() == "" or e12_text.text() == "":
QtWidgets.QMessageBox.critical(widget, "错误", "必填信息没有填写完整,无法继续构建 deb 包")
disabled_or_NORMAL_all(True)
label13_text_change("必填信息没有填写完整,无法继续构建 deb 包")
return
if not messagebox.askyesno(title="提示", message="打包将会改动现在选择的容器,是否继续?"):
if QtWidgets.QMessageBox.question(widget, "提示", "打包将会改动现在选择的容器,是否继续?") == QtWidgets.QMessageBox.No:
disabled_or_NORMAL_all(True)
return
thread = threading.Thread(target=make_deb_threading)
thread.start()
#thread = threading.Thread(target=make_deb_threading)
QT.thread = make_deb_threading()
QT.thread.signal.connect(chang_textbox1_things)
QT.thread.label.connect(label13_text_change)
QT.thread.start()
#thread.start()
def label13_text_change(thing):
label13_text.set("当前 deb 打包情况:{}".format(thing))
label13_text.setText(f"<p align='center'>当前 deb 打包情况:{thing}</p>")
def make_deb_threading():
class make_deb_threading(QtCore.QThread):
signal = QtCore.pyqtSignal(str)
label = QtCore.pyqtSignal(str)
def __init__(self) -> None:
super().__init__()
def run_command(self, command):
res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# 实时读取程序返回
while res.poll() is None:
try:
text = res.stdout.readline().decode("utf8")
except:
text = ""
print(text, end="")
self.signal.emit(text)
def run(self):
#####################################
# 程序创建的 deb 构建临时文件夹目录树:
# /XXX
# ├── DEBIAN
# │ └── control
# │ ├── control
# │ └── postrm
# └── opt
# └── apps
# └── XXX
@ -119,89 +127,89 @@ def make_deb_threading():
# │ └── run.sh
# └── info
#
# 11 directories, 6 files
# 11 directories, 7 files
#####################################
try:
#####################
# 判断文件是否存在
#####################
label13_text_change("正在检查文件是否存在并为后面步骤准备……")
self.label.emit("正在检查文件是否存在并为后面步骤准备……")
a = ""
if e6_text.get() == "/":
b = e6_text.get()[:-1]
if e6_text.text() == "/":
b = e6_text.text()[:-1]
else:
b = e6.get()
if e9_text.get() != "":
b = e6_text.text()
if e9_text.text() != "":
# 获取图片格式(不太准)
try:
im = Image.open(e9_text.get())
im = Image.open(e9_text.text())
imms = im.format.lower()
except: # 未知(就直接设置为 svg 后缀)
imms = ".svg"
a = "/opt/apps/{}/entries/icons/hicolor/scalable/apps/{}.{}".format(e1_text.get(), e1_text.get(), imms)
if not os.path.exists(e9_text.get()):
messagebox.showerror(title="提示", message="图标的路径填写错误,无法进行构建 deb 包")
a = "/opt/apps/{}/entries/icons/hicolor/scalable/apps/{}.{}".format(e1_text.text(), e1_text.text(), imms)
if not os.path.exists(e9_text.text()):
QtWidgets.QMessageBox.critical(widget, "错误", "图标的路径填写错误,无法进行构建 deb 包")
disabled_or_NORMAL_all(True)
label13_text_change("图标的路径填写错误,无法进行构建 deb 包")
return
if not os.path.exists(e6_text.get()):
messagebox.showerror(title="提示", message="路径填写错误,无法继续构建 deb 包")
if not os.path.exists(e6_text.text()):
QtWidgets.QMessageBox.critical(widget, "错误", "路径填写错误,无法继续构建 deb 包")
disabled_or_NORMAL_all(True)
label13_text_change("图标的路径填写错误,无法进行构建 deb 包")
return
#############
# 删除文件
#############
label13_text_change("正在删除对构建 deb 包有影响的文件……")
self.label.emit("正在删除对构建 deb 包有影响的文件……")
debPackagePath = f"/tmp/{random.randint(0, 9999)}"
run_command(f"rm -rfv /tmp/{debPackagePath}")
self.run_command(f"rm -rfv /tmp/{debPackagePath}")
###############
# 创建目录
###############
label13_text_change("正在创建目录……")
self.label.emit("正在创建目录……")
os.makedirs("{}/DEBIAN".format(debPackagePath))
os.makedirs("{}/opt/apps/{}/entries/applications".format(debPackagePath, e1_text.get()))
os.makedirs("{}/opt/apps/{}/entries/icons/hicolor/scalable/apps".format(debPackagePath, e1_text.get()))
os.makedirs("{}/opt/apps/{}/files".format(debPackagePath, e1_text.get()))
os.makedirs("{}/opt/apps/{}/entries/applications".format(debPackagePath, e1_text.text()))
os.makedirs("{}/opt/apps/{}/entries/icons/hicolor/scalable/apps".format(debPackagePath, e1_text.text()))
os.makedirs("{}/opt/apps/{}/files".format(debPackagePath, e1_text.text()))
###############
# 创建文件
###############
label13_text_change("正在创建文件……")
self.label.emit("正在创建文件……")
os.mknod("{}/DEBIAN/control".format(debPackagePath))
os.mknod("{}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.get(), e1_text.get()))
os.mknod("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get()))
os.mknod("{}/opt/apps/{}/info".format(debPackagePath, e1_text.get()))
os.mknod("{}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.text(), e1_text.text()))
os.mknod("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.text()))
os.mknod("{}/opt/apps/{}/info".format(debPackagePath, e1_text.text()))
###############
# 设置容器
###############
label13_text_change("正在设置 wine 容器")
self.label.emit("正在设置 wine 容器")
os.chdir(b)
run_command("sed -i \"s#$USER#@current_user@#\" ./*.reg")
self.run_command("sed -i \"s#$USER#@current_user@#\" ./*.reg")
os.chdir(f"{b}/drive_c/users")
run_command(f"mv -v '{os.getlogin()}' @current_user@")
self.run_command(f"mv -v '{os.getlogin()}' @current_user@")
os.chdir(programPath)
###############
# 压缩容器
###############
label13_text_change("正在打包 wine 容器")
run_command("7z a {}/opt/apps/{}/files/files.7z {}/*".format(debPackagePath, e1_text.get(), b))
self.label.emit("正在打包 wine 容器")
self.run_command("7z a {}/opt/apps/{}/files/files.7z {}/*".format(debPackagePath, e1_text.text(), b))
###############
# 复制图片
###############
label13_text_change("正在复制文件……")
run_command(f"cp -rv '{programPath}/dlls' {debPackagePath}/opt/apps/{e1_text.get()}/files/")
if e9_text.get() != "":
shutil.copy(e9_text.get(), "{}/opt/apps/{}/entries/icons/hicolor/scalable/apps/{}.{}".format(debPackagePath, e1_text.get(), e1_text.get(), imms))
self.label.emit("正在复制文件……")
self.run_command(f"cp -rv '{programPath}/dlls' {debPackagePath}/opt/apps/{e1_text.text()}/files/")
if e9_text.text() != "":
shutil.copy(e9_text.text(), "{}/opt/apps/{}/entries/icons/hicolor/scalable/apps/{}.{}".format(debPackagePath, e1_text.text(), e1_text.text(), imms))
################
# 获取文件大小
################
label13_text_change("正在计算文件大小……")
self.label.emit("正在计算文件大小……")
size = getFileFolderSize(debPackagePath) / 1024
################
# 写入文本文档
################
label13_text_change("正在写入文件……")
if not bool(chooseWineHelperValue.get()):
self.label.emit("正在写入文件……")
if not chooseWineHelperValue.isChecked():
write_txt("{}/DEBIAN/control".format(debPackagePath), '''Package: {}
Version: {}
Architecture: i386
@ -211,9 +219,9 @@ Section: non-free/otherosfs
Priority: optional
Multi-Arch: foreign
Description: {}
'''.format(e1_text.get(), e2_text.get(), e4_text.get(), wineVersion.get(), e3_text.get()))
'''.format(e1_text.text(), e2_text.text(), e4_text.text(), wineVersion.currentText(), e3_text.text()))
else:
write_txt("{}/DEBIAN/control".format(debPackagePath), '''Package: {}
write_txt("{}/DEBIAN/postrm".format(debPackagePath), '''Package: {}
Version: {}
Architecture: i386
Maintainer: {}
@ -222,10 +230,28 @@ Section: non-free/otherosfs
Priority: optional
Multi-Arch: foreign
Description: {}
'''.format(e1_text.get(), e2_text.get(), e4_text.get(), wineVersion.get(), e3_text.get()))
write_txt("{}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.get(), e1_text.get()), '#!/usr/bin/env xdg-open\n[Desktop Entry]\nEncoding=UTF-8\nType=Application\nX-Created-By={}\nCategories={};\nIcon={}\nExec="/opt/apps/{}/files/run.sh" {}\nName={}\nComment={}\nMimeType={}\nGenericName={}\nTerminal=false\nStartupNotify=false\n'.format(e4_text.get(), option1_text.get(), a, e1_text.get(), e15_text.get(), e8_text.get(), e3_text.get(), e10_text.get(), e1_text.get()))
if not bool(chooseWineHelperValue.get()):
write_txt("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get()), '''#!/bin/sh
'''.format(e1_text.text(), e2_text.text(), e4_text.text(), wineVersion.currentText(), e3_text.text()))
if rmBash.isChecked():
write_txt("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.text()), f'''#!/bin/bash
if [ "$1" = "remove" ] || [ "$1" = "purge" ];then
echo"清理卸载残留"
for username in ls /home
do
echo /home/$username
if [ -d "/home/$username/.deepinwine/{e5_text.text()}" ]
then
rm -rf "/home/$username/.deepinwine/{e5_text.text()}"
fi
done
else
echo"非卸载,跳过清理"
fi
''')
write_txt("{}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.text(), e1_text.text()), '#!/usr/bin/env xdg-open\n[Desktop Entry]\nEncoding=UTF-8\nType=Application\nX-Created-By={}\nCategories={};\nIcon={}\nExec="/opt/apps/{}/files/run.sh" {}\nName={}\nComment={}\nMimeType={}\nGenericName={}\nTerminal=false\nStartupNotify=false\n'.format(e4_text.text(), option1_text.currentText(), a, e1_text.text(), e15_text.text(), e8_text.text(), e3_text.text(), e10_text.text(), e1_text.text()))
if not bool(chooseWineHelperValue.text()):
write_txt("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.text()), '''#!/bin/sh
# Copyright (C) 2016 Deepin, Inc.
#
@ -269,9 +295,9 @@ if [ -n "$EXEC_PATH" ];then
else
$START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@"
fi
'''.format(e5_text.get(), e2_text.get(), e7_text.get(), e1_text.get(), wineVersion.get()))
'''.format(e5_text.text(), e2_text.text(), e7_text.text(), e1_text.text(), wineVersion.currentText()))
else:
write_txt("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get()), '''#!/bin/sh
write_txt("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.text()), '''#!/bin/sh
# Copyright (C) 2016 Deepin, Inc.
#
@ -341,32 +367,32 @@ if [ -n "$EXEC_PATH" ];then
else
$START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@"
fi
'''.format(e5_text.get(), e2_text.get(), e7_text.get(), e1_text.get(), wineVersion.get()))
write_txt("{}/opt/apps/{}/info".format(debPackagePath, e1_text.get()), '{\n "appid": "' + e1_text.get() + '",\n "name": "' + e8_text.get() + '",\n "version": "' + e2_text.get() + '",\n "arch": ["i386"],\n "permissions": {\n "autostart": false,\n "notification": false,\n "trayicon": true,\n "clipboard": true,\n "account": false,\n "bluetooth": false,\n "camera": false,\n "audio_record": false,\n "installed_apps": false\n }\n}')
'''.format(e5_text.text(), e2_text.text(), e7_text.text(), e1_text.text(), wineVersion.currentText()))
write_txt("{}/opt/apps/{}/info".format(debPackagePath, e1_text.text()), '{\n "appid": "' + e1_text.text() + '",\n "name": "' + e8_text.text() + '",\n "version": "' + e2_text.text() + '",\n "arch": ["i386"],\n "permissions": {\n "autostart": false,\n "notification": false,\n "trayicon": true,\n "clipboard": true,\n "account": false,\n "bluetooth": false,\n "camera": false,\n "audio_record": false,\n "installed_apps": false\n }\n}')
################
# 修改文件权限
################
label13_text_change("正在修改文件权限……")
run_command("chmod -Rv 644 {}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get()))
run_command("chmod -Rv 644 {}/opt/apps/{}/info".format(debPackagePath, e1_text.get()))
run_command("chmod -Rv 755 {}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get()))
run_command("chmod -Rv 755 {}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.get(), e1_text.get()))
self.label.emit("正在修改文件权限……")
self.run_command("chmod -Rv 644 {}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.text()))
self.run_command("chmod -Rv 644 {}/opt/apps/{}/info".format(debPackagePath, e1_text.text()))
self.run_command("chmod -Rv 755 {}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.text()))
self.run_command("chmod -Rv 755 {}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.text(), e1_text.text()))
################
# 构建 deb 包
################
label13_text_change("正在构建 deb 包……")
run_command("dpkg -b {} {}".format(debPackagePath, e12_text.get()))
self.label.emit("正在构建 deb 包……")
self.run_command("dpkg -b {} {}".format(debPackagePath, e12_text.text()))
################
# 完成构建
################
label13_text_change("完成构建!")
self.label.emit("完成构建!")
disabled_or_NORMAL_all(True)
messagebox.showinfo(title="提示", message="打包完毕!")
QtWidgets.QMessageBox.information(widget, "提示", "打包完毕!")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message="程序出现错误,错误信息:\n{}".format(traceback.format_exc()))
label13_text_change("deb 包构建出现错误")
chang_textbox1_things(traceback.format_exc())
QtWidgets.QMessageBox.critical(widget, "错误", "程序出现错误,错误信息:\n{}".format(traceback.format_exc()))
self.label.emit("deb 包构建出现错误")
self.signal.emit(traceback.format_exc())
disabled_or_NORMAL_all(True)
# 写入文本文档
@ -376,25 +402,12 @@ def write_txt(path, things):
file.close() # 关闭文本对象
def chang_textbox1_things(things):
textbox1.configure(state=tk.NORMAL)
textbox1.insert('end', things)
textbox1.configure(state=tk.DISABLED)
if things.replace("\n", "").replace(" ", "") == "":
return
textbox1.append(things)
def clean_textbox1_things():
textbox1.configure(state=tk.NORMAL)
textbox1.delete('1.0','end')
textbox1.configure(state=tk.DISABLED)
def run_command(command):
res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# 实时读取程序返回
while res.poll() is None:
try:
text = res.stdout.readline().decode("utf8")
except:
text = ""
print(text)
chang_textbox1_things(text)
textbox1.setText("")
def getFileFolderSize(fileOrFolderPath):
@ -419,7 +432,7 @@ def getFileFolderSize(fileOrFolderPath):
# 显示“提示”窗口
def helps():
messagebox.showinfo(title="提示", message=tips)
QtWidgets.QMessageBox.information(widget, "提示", tips)
# 读取文本文档
def readtxt(path):
@ -448,136 +461,106 @@ tips = """提示:
2如果要填写路径浏览按钮的是要填本计算机对应文件的路径否则就是填写安装到其他计算机使用的路径
3输入 wine 的容器路径时最后面请不要输入/
4输入可执行文件的运行路径时是以C:/XXX/XXX.exe的格式进行输入默认是以 C 为开头不用\做命令的分隔而是用/
5.desktop 的图标只支持 PNG 格式和 SVG 格式其他格式无法显示图标"""
5.desktop 的图标只支持 PNG 格式和 SVG 格式其他格式无法显示图标
6路径建议不要带空格容易出问题"""
###############
# 窗口创建
###############
# 读取主题
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:
window = tk.Tk()
themes = ttkthemes.ThemedStyle(window)
themes.set_theme("breeze")
else:
import ttkbootstrap
style = ttkbootstrap.Style(theme="darkly")
window = style.master # 创建窗口
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
widget = QtWidgets.QWidget()
widgetLayout = QtWidgets.QGridLayout()
# 设置变量以修改和获取值项
wineVersion = tk.StringVar()
wineVersion.set("deepin-wine6 stable")
e1_text = tk.StringVar()
e2_text = tk.StringVar()
e3_text = tk.StringVar()
e4_text = tk.StringVar()
e5_text = tk.StringVar()
e6_text = tk.StringVar()
e7_text = tk.StringVar()
e8_text = tk.StringVar()
e9_text = tk.StringVar()
e10_text = tk.StringVar()
e12_text = tk.StringVar()
e15_text = tk.StringVar()
label13_text = tk.StringVar()
option1_text = tk.StringVar()
option1_text.set("Network")
label13_text.set("当前 deb 打包情况:暂未打包")
wineVersion = QtWidgets.QComboBox()
wineVersion.addItems(wine.keys())
wineVersion.setCurrentText("deepin-wine6 stable")
e1_text = QtWidgets.QLineEdit()
e2_text = QtWidgets.QLineEdit()
e3_text = QtWidgets.QLineEdit()
e4_text = QtWidgets.QLineEdit()
e5_text = QtWidgets.QLineEdit()
e6_text = QtWidgets.QLineEdit()
e7_text = QtWidgets.QLineEdit()
e8_text = QtWidgets.QLineEdit()
e9_text = QtWidgets.QLineEdit()
e10_text = QtWidgets.QLineEdit()
e12_text = QtWidgets.QLineEdit()
e15_text = QtWidgets.QLineEdit()
label13_text = QtWidgets.QLabel("<p align='center'>当前 deb 打包情况:暂未打包</p>")
option1_text = QtWidgets.QComboBox()
button1 = QtWidgets.QPushButton("浏览……")
button2 = QtWidgets.QPushButton("浏览……")
button4 = QtWidgets.QPushButton("浏览……")
button5 = QtWidgets.QPushButton("打包……")
rmBash = QtWidgets.QCheckBox("设置卸载该 deb 后自动删除该容器")
textbox1 = QtWidgets.QTextBrowser()
option1_text.addItems(["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility", "System"])
option1_text.setCurrentText("Network")
wineFrame = QtWidgets.QHBoxLayout()
chooseWineHelperValue = QtWidgets.QCheckBox("使用星火wine helper如不勾选默认为deepin-wine-helper")
button1.clicked.connect(button1_cl)
button2.clicked.connect(button2_cl)
button4.clicked.connect(button4_cl)
button5.clicked.connect(make_deb)
wineFrame.addWidget(wineVersion)
wineFrame.addWidget(chooseWineHelperValue)
# 创建控件
label1 = ttk.Label(window, text="要打包的 deb 包的包名(※必填):")
label2 = ttk.Label(window, text="要打包的 deb 包的版本号(※必填):")
label3 = ttk.Label(window, text="要打包的 deb 包的说明(※必填):")
label4 = ttk.Label(window, text="要打包的 deb 包的维护者(※必填):")
label5 = ttk.Label(window, text="要解压的 wine 容器的容器名(※必填):")
label6 = ttk.Label(window, text="要解压的 wine 容器(※必填):")
label7 = ttk.Label(window, text="要解压的 wine 容器里需要运行的可执行文件路径(※必填):")
label8 = ttk.Label(window, text="要显示的 .desktop 文件的名称(※必填):")
label9 = ttk.Label(window, text="要显示的 .desktop 文件的图标(选填):")
label10 = ttk.Label(window, text="要显示的 .desktop 文件的 MimeType 内容(选填):")
label12 = ttk.Label(window, text="打包 deb 的保存路径(※必填):")
label13 = ttk.Label(window, textvariable=label13_text)
label14 = ttk.Label(window, text="要显示的 .desktop 文件的分类(※必填):")
label15 = ttk.Label(window,text="要解压的 wine 容器里需要运行的可执行文件的参数(选填):")
wineFrame = ttk.Frame(window)
chooseWineVersionTips = ttk.Label(window,text="选择打包的 wine 版本(※必选):")
chooseWineVersion = ttk.OptionMenu(wineFrame, wineVersion, "deepin-wine6 stable", *list(wine)) # 创建选择框控件
chooseWineHelperValue = tk.IntVar()
chooseWineHelper = ttk.Checkbutton(wineFrame, text="使用星火wine helper如不勾选默认为deepin-wine-helper", variable=chooseWineHelperValue)
e1 = ttk.Entry(window, textvariable=e1_text, width=100)
e2 = ttk.Entry(window, textvariable=e2_text, width=100)
e3 = ttk.Entry(window, textvariable=e3_text, width=100)
e4 = ttk.Entry(window, textvariable=e4_text, width=100)
e5 = ttk.Entry(window, textvariable=e5_text, width=100)
e6 = ttk.Entry(window, textvariable=e6_text, width=100)
e7 = ttk.Entry(window, textvariable=e7_text, width=100)
e8 = ttk.Entry(window, textvariable=e8_text, width=100)
e9 = ttk.Entry(window, textvariable=e9_text, width=100)
e10 = ttk.Entry(window, textvariable=e10_text, width=100)
e12 = ttk.Entry(window, textvariable=e12_text, width=100)
e15 = ttk.Entry(window, textvariable=e15_text, width=100)
button1 = ttk.Button(window, text="浏览……", command=button1_cl)
button2 = ttk.Button(window, text="浏览……", command=button2_cl)
button4 = ttk.Button(window, text="浏览……", command=button4_cl)
button5 = ttk.Button(window, text="打包……", command=make_deb)
option1 = ttk.OptionMenu(window, option1_text, "Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility")
textbox1 = tk.Text(window, width=100, height=4)
textbox1.configure(state=tk.DISABLED)
menu = tk.Menu(window) # 设置菜单栏
programmenu = tk.Menu(menu, tearoff=0) # 设置“程序”菜单栏
menu.add_cascade(label="程序", menu=programmenu)
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) # 设置“小提示”项
# 设置窗口
window.title(f"wine 应用打包器 {version}")
window.iconphoto(False, tk.PhotoImage(file=iconPath))
widgetLayout.addWidget(QtWidgets.QLabel("要打包的 deb 包的包名(※必填):"), 0, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要打包的 deb 包的版本号(※必填):"), 1, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要打包的 deb 包的说明(※必填):"), 2, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要打包的 deb 包的维护者(※必填):"), 3, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要解压的 wine 容器的容器名(※必填):"), 4, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要解压的 wine 容器(※必填):"), 5, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要解压的 wine 容器里需要运行的可执行文件路径(※必填):"), 6, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要显示的 .desktop 文件的分类(※必填):"), 7, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要解压的 wine 容器里需要运行的可执行文件的参数(选填):"), 8, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要显示的 .desktop 文件的名称(※必填):"), 9, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要显示的 .desktop 文件的图标(选填):"), 10, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("要显示的 .desktop 文件的 MimeType 内容(选填):"), 11, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("选择打包的 wine 版本(※必选):"), 12, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("打包 deb 的保存路径(※必填):"), 13, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("自动删除选项(选填):"), 14, 0, 1, 1)
widgetLayout.addWidget(e1_text, 0, 1, 1, 1)
widgetLayout.addWidget(e2_text, 1, 1, 1, 1)
widgetLayout.addWidget(e3_text, 2, 1, 1, 1)
widgetLayout.addWidget(e4_text, 3, 1, 1, 1)
widgetLayout.addWidget(e5_text, 4, 1, 1, 1)
widgetLayout.addWidget(e6_text, 5, 1, 1, 1)
widgetLayout.addWidget(button1, 5, 2, 1, 1)
widgetLayout.addWidget(e7_text, 6, 1, 1, 1)
widgetLayout.addWidget(option1_text, 7, 1, 1, 1)
widgetLayout.addWidget(e15_text, 8, 1, 1, 1)
widgetLayout.addWidget(e8_text, 9, 1, 1, 1)
widgetLayout.addWidget(e9_text, 10, 1, 1, 1)
widgetLayout.addWidget(button2, 10, 2, 1, 1)
widgetLayout.addWidget(e10_text, 11, 1, 1, 1)
widgetLayout.addLayout(wineFrame, 12, 1, 1, 1)
widgetLayout.addWidget(e12_text, 13, 1, 1, 1)
widgetLayout.addWidget(button4, 13, 2, 1, 1)
widgetLayout.addWidget(rmBash, 14, 1, 1, 1)
widgetLayout.addWidget(button5, 15, 1, 1, 1)
widgetLayout.addWidget(label13_text, 16, 0, 1, 3)
widgetLayout.addWidget(textbox1, 17, 0, 1, 3)
menu = window.menuBar()
programmenu = menu.addMenu("程序")
help = menu.addMenu("帮助")
exit = QtWidgets.QAction("退出程序")
tip = QtWidgets.QAction("小提示")
exit.triggered.connect(window.close)
tip.triggered.connect(helps)
programmenu.addAction(exit)
help.addAction(tip)
# 控件配置
try:
e6_text.set(sys.argv[1])
e5_text.set(pathlib.PurePath(sys.argv[1]).name)
wineVersion.set(sys.argv[2])
e6_text.setText(sys.argv[1])
e5_text.setText(pathlib.PurePath(sys.argv[1]).name)
wineVersion.setCurrentText(sys.argv[2])
except:
pass
# 添加控件
window.config(menu=menu) # 显示菜单栏
label1.grid(row=0, column=0)
e1.grid(row=0, column=1)
label2.grid(row=1, column=0)
e2.grid(row=1, column=1)
label3.grid(row=2, column=0)
e3.grid(row=2, column=1)
label4.grid(row=3, column=0)
e4.grid(row=3, column=1)
label5.grid(row=4, column=0)
e5.grid(row=4, column=1)
label6.grid(row=5, column=0)
e6.grid(row=5, column=1)
button1.grid(row=5, column=2)
label7.grid(row=6, column=0)
e7.grid(row=6, column=1)
label14.grid(row=7, column=0)
option1.grid(row=7, column=1)
label15.grid(row=8, column=0)
e15.grid(row=8, column=1)
label8.grid(row=9, column=0)
e8.grid(row=9, column=1)
label9.grid(row=10, column=0)
e9.grid(row=10, column=1)
button2.grid(row=10, column=2)
label10.grid(row=11, column=0)
e10.grid(row=11, column=1)
chooseWineVersionTips.grid(row=12, column=0)
wineFrame.grid(row=12, column=1)
chooseWineVersion.grid(row=0, column=0)
chooseWineHelper.grid(row=0, column=1)
label12.grid(row=13, column=0)
e12.grid(row=13, column=1)
button4.grid(row=13, column=2)
button5.grid(row=14, column=1)
label13.grid(row=15, column=0, columnspan=3)
textbox1.grid(row=16, column=0, columnspan=3)
window.mainloop()
widget.setLayout(widgetLayout)
window.setCentralWidget(widget)
window.setWindowTitle(f"wine 应用打包器 {version}")
window.setWindowIcon(QtGui.QIcon(iconPath))
window.show()
sys.exit(app.exec_())

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,13 +1,17 @@
{
"Version": "1.6.0",
"Version": "1.7.0",
"Thank": [
"@a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301",
"@zhangs https://bbs.deepin.org/post/227948",
"@gtjmaster https://bbs.deepin.org/post/225509",
"@统信UCARE服务 https://mp.weixin.qq.com/s/iOdfNv6phc8F4inackFFTw",
"@星火应用商店 提供部分安装包的源以及本程序的下载地址",
"感谢 @a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301",
"感谢 @zhangs https://bbs.deepin.org/post/227948",
"感谢 @gtjmaster https://bbs.deepin.org/post/225509",
"感谢 @统信UCARE服务 https://mp.weixin.qq.com/s/iOdfNv6phc8F4inackFFTw",
"感谢 @星火应用商店 提供部分安装包的源以及本程序的下载地址",
"感谢 @delsin 和 @神末shenmo 在 deepin 论坛提供打包器打包的 deb 包自动删除容器的建议",
"感谢 @GershonWang 在 https://github.com/gfdgd-xi/deep-wine-runner/issues/1 提供窗口居中的建议",
"感谢 @134******28 和 @sgb76 提供的新程序 GUI 布局和实现代码",
"感谢统信在 Wine 生态适配活动中提供的打包脚本",
"",
"可以从上面的各种解决方案更好的学习 Wine 生态适配,也可以看 deepin 论坛板块 https://bbs.deepin.org/module/detail/116 进行学习,最后也向各位有进行 Wine 生态适配的大佬进行由衷的更新!",
"可以从上面的各种解决方案更好的学习 Wine 生态适配,也可以看 deepin 论坛板块 https://bbs.deepin.org/module/detail/116 进行学习,最后也向各位有进行 Wine 生态适配的大佬进行由衷的感谢",
"如果上面有遗漏,请向我反馈补充"
]
}

Binary file not shown.

View File

@ -0,0 +1 @@
/opt/apps/deepin-wine-runner/deepin-wine-packager-with-script.py

View File

@ -0,0 +1 @@
/opt/apps/deepin-wine-runner/RunVM.sh

View File

@ -0,0 +1 @@
/opt/apps/deepin-wine-runner/launch.sh

View File

@ -0,0 +1 @@
/opt/apps/deepin-wine-runner/StartVM.sh

View File

@ -0,0 +1 @@
/opt/apps/deepin-wine-runner/deepin-wine-runner-update-bug

View File

@ -0,0 +1 @@
/opt/apps/deepin-wine-runner/wine install

View File

@ -231,6 +231,7 @@ Priority: optional
Multi-Arch: foreign
Description: {}
'''.format(e1_text.text(), e2_text.text(), e4_text.text(), wineVersion.currentText(), e3_text.text()))
if rmBash.isChecked():
write_txt("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.text()), f'''#!/bin/bash
if [ "$1" = "remove" ] || [ "$1" = "purge" ];then
@ -492,6 +493,7 @@ button1 = QtWidgets.QPushButton("浏览……")
button2 = QtWidgets.QPushButton("浏览……")
button4 = QtWidgets.QPushButton("浏览……")
button5 = QtWidgets.QPushButton("打包……")
rmBash = QtWidgets.QCheckBox("设置卸载该 deb 后自动删除该容器")
textbox1 = QtWidgets.QTextBrowser()
option1_text.addItems(["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility", "System"])
option1_text.setCurrentText("Network")
@ -518,6 +520,7 @@ widgetLayout.addWidget(QtWidgets.QLabel("要显示的 .desktop 文件的图标
widgetLayout.addWidget(QtWidgets.QLabel("要显示的 .desktop 文件的 MimeType 内容(选填):"), 11, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("选择打包的 wine 版本(※必选):"), 12, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("打包 deb 的保存路径(※必填):"), 13, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("自动删除选项(选填):"), 14, 0, 1, 1)
widgetLayout.addWidget(e1_text, 0, 1, 1, 1)
widgetLayout.addWidget(e2_text, 1, 1, 1, 1)
widgetLayout.addWidget(e3_text, 2, 1, 1, 1)
@ -535,9 +538,10 @@ widgetLayout.addWidget(e10_text, 11, 1, 1, 1)
widgetLayout.addLayout(wineFrame, 12, 1, 1, 1)
widgetLayout.addWidget(e12_text, 13, 1, 1, 1)
widgetLayout.addWidget(button4, 13, 2, 1, 1)
widgetLayout.addWidget(button5, 14, 1, 1, 1)
widgetLayout.addWidget(label13_text, 15, 0, 1, 3)
widgetLayout.addWidget(textbox1, 16, 0, 1, 3)
widgetLayout.addWidget(rmBash, 14, 1, 1, 1)
widgetLayout.addWidget(button5, 15, 1, 1, 1)
widgetLayout.addWidget(label13_text, 16, 0, 1, 3)
widgetLayout.addWidget(textbox1, 17, 0, 1, 3)
menu = window.menuBar()
programmenu = menu.addMenu("程序")
help = menu.addMenu("帮助")

BIN
geek.exe

Binary file not shown.

View File

@ -20,9 +20,6 @@ import threading
import traceback
import webbrowser
import subprocess
import tkinter as tk
import tkinter.filedialog
import tkinter.messagebox
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
@ -185,7 +182,7 @@ def about_this_program()->"显示“关于这个程序”窗口":
messageLayout.addWidget(ok, 1, 1, 1, 1, QtCore.Qt.AlignBottom | QtCore.Qt.AlignRight)
messageWidget.setLayout(messageLayout)
QT.message.setCentralWidget(messageWidget)
QT.message.resize(messageWidget.frameGeometry().width() * 1.5, messageWidget.frameGeometry().height() * 1.5)
QT.message.resize(int(messageWidget.frameGeometry().width() * 1.5), int(messageWidget.frameGeometry().height() * 1.5))
QT.message.show()
# 显示“提示”窗口
@ -575,7 +572,7 @@ class UpdateWindow():
updateWidget.setLayout(updateWidgetLayout)
UpdateWindow.update.setCentralWidget(updateWidget)
UpdateWindow.update.setWindowTitle("检查更新")
UpdateWindow.update.resize(updateWidget.frameGeometry().width(), updateWidget.frameGeometry().height() * 1.5)
UpdateWindow.update.resize(updateWidget.frameGeometry().width(), int(updateWidget.frameGeometry().height() * 1.5))
UpdateWindow.update.show()
def Update():
@ -840,7 +837,6 @@ class ProgramSetting():
widget.setLayout(widgetLayout)
ProgramSetting.message.setCentralWidget(widget)
ProgramSetting.message.setWindowTitle(f"设置 wine 运行器 {version}")
#ProgramSetting.message.resize(ProgramSetting.message.frameSize().width() * 1.2, ProgramSetting.message.frameSize().height())
ProgramSetting.message.show()
return
@ -943,13 +939,14 @@ tips = '''提示:
exe路径\' 参数 \'
即可单引号需要输入
5wine 容器如果没有指定则会默认为 ~/.wine'''
updateThingsString = '''※1、添加 @delsin 和 @神末shenmo 建议的 postrm 脚本
2 pip 由阿里源改为华为源提升下载速度
3优化多屏窗口居中问题并设置居中选项为选开防止错误
4修复 1.6.0 程序无法保存设置的问题
5修复 1.6.0 的更新程序无法正常更新的问题
6界面大改造从使用 Tkinter 改为 Qt参考了 @134******28 @sgb76 提供的设计方案和代码
7添加了基于 UOS 生态适配活动打包脚本的打包器以及基于 Virtualbox 的简易 Windows 镜像安装工具
updateThingsString = '''※1、界面大改造从使用 Tkinter 改为 Qt参考了 @134******28 和 @sgb76 提供的设计方案和代码
2添加了基于 UOS 生态适配活动打包脚本的打包器以及基于 Virtualbox 的简易 Windows 镜像安装工具
3 pip 由阿里源改为华为源提升下载安装速度并删除使用 pip 下载库的功能已不需要废弃
4添加 @delsin @神末shenmo 建议的 postrm 脚本
5优化多屏窗口居中问题
6修复 1.6.0 程序无法保存设置的问题
7修复 1.6.0 的更新程序无法正常更新的问题
8升级 Geek Uninstaller 版本
'''
for i in information["Thank"]:
thankText += f"{i}\n"
@ -959,7 +956,6 @@ about = f'''<h1>关于</h1>
版本{version}
适用平台{goodRunSystem}
tkinter 版本{tk.TkVersion}
Qt 版本{QtCore.qVersion()}
程序官网{programUrl}</pre>
<hr>