快捷方式删除功能

This commit is contained in:
gfdgd xi 2022-11-20 17:48:10 +08:00
parent a5fd2522dd
commit a90fb2ae37
19 changed files with 387 additions and 16 deletions

122
BuildDesktop.py Executable file
View File

@ -0,0 +1,122 @@
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
#################################################################################################################
# 作者gfdgd xi
# 版本2.5.0
# 更新时间2022年11月20日
# 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序
# 基于 Python3 的 PyQt5 构建
#################################################################################################################
#################
# 引入所需的库
#################
import os
import sys
import traceback
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
desktopList = []
desktopUsrList = []
def GetDesktopList(path):
for i in os.listdir(path):
if os.path.isdir(f"{path}/{i}"):
GetDesktopList(f"{path}/{i}")
if os.path.isfile(f"{path}/{i}"):
try:
desktop = {}
with open(f"{path}/{i}") as file:
things = file.read()
for k in things.splitlines():
if not "=" in k:
continue
desktop[k[:k.index("=")].lower()] = k[k.index("=") + 1:]
desktopList.append([desktop["Name".lower()], desktop["Icon".lower()], desktop["Exec".lower()], f"{path}/{i}"])
except:
traceback.print_exc()
delButton.setEnabled(len(desktopList))
class DesktopList(QtCore.QThread):
show = QtCore.pyqtSignal(int)
def __init__(self) -> None:
super().__init__()
def run(self):
if os.path.exists(f"{homePath}/.local/share/applications"):
GetDesktopList(f"{homePath}/.local/share/applications")
self.show.emit(0)
def ShowDesktop(temp):
nmodel = QtGui.QStandardItemModel(window)
if not len(desktopList):
item = QtGui.QStandardItem("")
nmodel.appendRow(item)
y = 0
for i in desktopList:
#item = QtGui.QStandardItem(QtGui.QIcon(i[1]), i[0])
#nmodel.appendRow(item)
if os.path.exists(i[1]):
nmodel.setItem(y, 0, QtGui.QStandardItem(QtGui.QIcon(i[1]), i[0]))
else:
nmodel.setItem(y, 0, QtGui.QStandardItem(QtGui.QIcon.fromTheme(i[1]), i[0]))
nmodel.setItem(y, 1, QtGui.QStandardItem(i[2]))
nmodel.setItem(y, 2, QtGui.QStandardItem(i[3]))
y += 1
nmodel.setHeaderData(0, QtCore.Qt.Horizontal, "程序名")
nmodel.setHeaderData(1, QtCore.Qt.Horizontal, "运行路径")
nmodel.setHeaderData(2, QtCore.Qt.Horizontal, ".desktop 文件所在路径")
nmodel.setColumnCount(3)
desktopListView.setModel(nmodel)
def GetDesktopThread():
global desktop
desktop = DesktopList()
desktop.show.connect(ShowDesktop)
desktop.start()
def DeleteButton():
index = desktopListView.currentIndex().row()
if index < 0:
QtWidgets.QMessageBox.critical(window, "错误", "未选中任何项")
return
print(index)
print(desktopList[index][3])
#desktopListView.rowMoved(index)
#desktopListView.removeRow(index)
try:
os.remove(desktopList[index][3])
del desktopList[index]
ShowDesktop(0)
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
homePath = os.getenv("HOME")
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
#GetDesktopList(f"{homePath}/.local/share/applications")
#print(desktopList)
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
widget = QtWidgets.QWidget()
layout = QtWidgets.QGridLayout()
delButton = QtWidgets.QPushButton("删除指定图标")
delButton.clicked.connect(DeleteButton)
#desktopListView = QtWidgets.QListView()
desktopListView = QtWidgets.QTableView()
desktopListView.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
desktopListView.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)#(QAbstractItemView::SelectRows)
layout.addWidget(desktopListView, 0, 0, 1, 4)
layout.addWidget(delButton, 1, 3, 1, 1)
widget.setLayout(layout)
window.setCentralWidget(widget)
window.setWindowTitle("图标管理")
window.resize(int(window.frameGeometry().width() * 1.5), int(window.frameGeometry().height() * 1.2))
window.setWindowIcon(QtGui.QIcon(f"{programPath}/deepin-wine-runner.svg"))
window.show()
GetDesktopThread()
app.exec_()

View File

@ -40,6 +40,9 @@ if "-w" in sys.argv:
wineProgram = sys.argv[wineCommand + 2] wineProgram = sys.argv[wineCommand + 2]
except: except:
pass pass
badChar = [
"(", "?", "*", "!", ")", "&", "'", "\""
]
with open(sys.argv[1], "rb") as file: with open(sys.argv[1], "rb") as file:
while True: while True:
things = file.readline() things = file.readline()
@ -49,7 +52,11 @@ with open(sys.argv[1], "rb") as file:
if n.encode() in things: if n.encode() in things:
# 提取 DLL 名称 # 提取 DLL 名称
for i in str(things[1: -2]).split("\\x"): for i in str(things[1: -2]).split("\\x"):
if n in i and not "(" in i and i[0] != "/": charBad = False
for b in badChar:
if b in i:
charBad = True
if n in i and not charBad and i[0] != "/":
name = i[2: ].replace(",{M", "").replace("+", "") name = i[2: ].replace(",{M", "").replace("+", "")
# 文件路径合法性检测 # 文件路径合法性检测

View File

@ -0,0 +1,9 @@
#!/usr/bin/env deepin-wine-runner-auto-install-bash
# 使用 Wine 运行器的语言解析器
##########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 更新时间2022年11月19日
##########################################################################################
# 用于判断是否为 bash 解释器
installvcpp 4
info 提示 修复完成!重新检测即可

View File

@ -1,2 +1,9 @@
#!/usr/bin/env deepin-wine-runner-auto-install-bash
# 使用 Wine 运行器的语言解析器
##########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 更新时间2022年11月03日
##########################################################################################
# 用于判断是否为 bash 解释器
installother 2 installother 2
info 提示 修复完成!重新检测即可 info 提示 修复完成!重新检测即可

View File

@ -0,0 +1,9 @@
#!/usr/bin/env deepin-wine-runner-auto-install-bash
# 使用 Wine 运行器的语言解析器
##########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 更新时间2022年11月19日
##########################################################################################
# 用于判断是否为 bash 解释器
installvb 4
info 提示 修复完成!重新检测即可

BIN
__pycache__/InstallVisualBasicRuntime.cpython-37.pyc Executable file → Normal file

Binary file not shown.

BIN
__pycache__/InstallVisualCPlusPlus.cpython-37.pyc Executable file → Normal file

Binary file not shown.

BIN
deb/DEBIAN/.postinst.swp Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
Package: spark-deepin-wine-runner Package: spark-deepin-wine-runner
Version: 2.5.0~alpha1 Version: 2.5.0~alpha2
Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿布呢 Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿布呢
Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner, https://github.com/gfdgd-xi/deep-wine-runner, https://gitlink.org.cn/gfdgd_xi/deep-wine-runner Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner, https://github.com/gfdgd-xi/deep-wine-runner, https://gitlink.org.cn/gfdgd_xi/deep-wine-runner
Architecture: all Architecture: all

View File

@ -9,7 +9,7 @@
################################################################################################################# #################################################################################################################
# 非强制性的必应组件,所以成功不成功都行 # 非强制性的必应组件,所以成功不成功都行
echo 安装组件 echo 安装组件
python3 -m pip install --upgrade pynput --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple > /dev/null | true python3 -m pip install --upgrade pynput --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple > /dev/null 2>&1 | true
echo 执行完成 echo 执行完成
# 如果为非 X86 PC可以删除掉一些无用组件主要是用不了 # 如果为非 X86 PC可以删除掉一些无用组件主要是用不了
if [ `arch` != "x86_64" ]; then if [ `arch` != "x86_64" ]; then
@ -34,9 +34,9 @@ if [ `arch` != "x86_64" ]; then
rm -rf /opt/apps/deepin-wine-runner/InstallNewWineHQ.sh rm -rf /opt/apps/deepin-wine-runner/InstallNewWineHQ.sh
fi fi
# 到时候切换 gpg 源会方便很多 # 到时候切换 gpg 源会方便很多
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FD6EEA1F20CD4B27 > /dev/null apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FD6EEA1F20CD4B27 > /dev/null 2>&1 | true
apt update > /dev/null | true apt update > /dev/null 2>&1 | true
# 设置目录权限,让用户可读可写,方便后续删除组件 # 设置目录权限,让用户可读可写,方便后续删除组件
chmod 777 -R /opt/apps/deepin-wine-runner chmod 777 -R /opt/apps/deepin-wine-runner
# 向服务器返回安装数加1不显示内容且忽略错误 # 向服务器返回安装数加1不显示内容且忽略错误
curl https://304626p927.goho.co/spark-deepin-wine-runner/Install.php?Version=2.5.0 -s > /dev/null | true curl https://304626p927.goho.co/spark-deepin-wine-runner/Install.php?Version=2.5.0 -s > /dev/null 2>&1 | true

View File

@ -40,6 +40,9 @@ if "-w" in sys.argv:
wineProgram = sys.argv[wineCommand + 2] wineProgram = sys.argv[wineCommand + 2]
except: except:
pass pass
badChar = [
"(", "?", "*", "!", ")", "&", "'", "\""
]
with open(sys.argv[1], "rb") as file: with open(sys.argv[1], "rb") as file:
while True: while True:
things = file.readline() things = file.readline()
@ -49,7 +52,11 @@ with open(sys.argv[1], "rb") as file:
if n.encode() in things: if n.encode() in things:
# 提取 DLL 名称 # 提取 DLL 名称
for i in str(things[1: -2]).split("\\x"): for i in str(things[1: -2]).split("\\x"):
if n in i and not "(" in i and i[0] != "/": charBad = False
for b in badChar:
if b in i:
charBad = True
if n in i and not charBad and i[0] != "/":
name = i[2: ].replace(",{M", "").replace("+", "") name = i[2: ].replace(",{M", "").replace("+", "")
# 文件路径合法性检测 # 文件路径合法性检测

View File

@ -0,0 +1,9 @@
#!/usr/bin/env deepin-wine-runner-auto-install-bash
# 使用 Wine 运行器的语言解析器
##########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 更新时间2022年11月19日
##########################################################################################
# 用于判断是否为 bash 解释器
installvcpp 4
info 提示 修复完成!重新检测即可

View File

@ -1,2 +1,9 @@
#!/usr/bin/env deepin-wine-runner-auto-install-bash
# 使用 Wine 运行器的语言解析器
##########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 更新时间2022年11月03日
##########################################################################################
# 用于判断是否为 bash 解释器
installother 2 installother 2
info 提示 修复完成!重新检测即可 info 提示 修复完成!重新检测即可

View File

@ -0,0 +1,9 @@
#!/usr/bin/env deepin-wine-runner-auto-install-bash
# 使用 Wine 运行器的语言解析器
##########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 更新时间2022年11月19日
##########################################################################################
# 用于判断是否为 bash 解释器
installvb 4
info 提示 修复完成!重新检测即可

View File

@ -95,7 +95,7 @@ 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);;MSI 文件(*.msi);;所有文件(*.*)")
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])})) # 写入配置文件
@ -132,7 +132,87 @@ class QT:
e1.addItems(findExeHistory) e1.addItems(findExeHistory)
e1.setEditText(findExeHistory[-1]) e1.setEditText(findExeHistory[-1])
repairList = []
# Flag: 日志推断解决方案功能 # Flag: 日志推断解决方案功能
class LogChecking():
def ShowWindow():
global logThread
global logWindow
global questionList
global repairButton
logWindow = QtWidgets.QWidget()
logWindowLayout = QtWidgets.QGridLayout()
questionList = QtWidgets.QListView()
repairButton = QtWidgets.QPushButton("一键修复")
repairButton.setDisabled(True)
repairButton.clicked.connect(LogChecking.RepairButton)
nmodel = QtGui.QStandardItemModel(window)
item = QtGui.QStandardItem("正在分析中……")
questionList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
nmodel.appendRow(item)
questionList.setModel(nmodel)
logWindowLayout.addWidget(questionList, 0, 0, 3, 1)
logWindowLayout.addWidget(repairButton, 0, 2, 1, 1)
logWindow.setWindowTitle("分析日志")
logWindow.setLayout(logWindowLayout)
logThread = LogThreading()
logThread.done.connect(LogChecking.Show)
logThread.start()
logWindow.setWindowIcon(QtGui.QIcon(f"{programPath}/deepin-wine-runner.svg"))
logWindow.resize(int(logWindow.frameGeometry().width() * 1.2), int(logWindow.frameGeometry().height() * 1.2))
logWindow.show()
def RepairButton():
index = questionList.currentIndex().row()
lists = questionMap[index]
print(f"{programPath}/CheckDLL/bash/{lists[1].lower()}.sh")
if os.path.exists(f"{programPath}/CheckDLL/bash/{lists[1].lower()}.sh"):
OpenTerminal(f"'{programPath}/AutoShell/main.py' '{programPath}/CheckDLL/bash/{lists[1].lower()}.sh'")
return
QtWidgets.QMessageBox.critical(logWindow, "错误", "无法修复该问题")
def Show(lists):
global questionMap
nmodel = QtGui.QStandardItemModel(window)
disbledButton = False
print(lists)
if not len(lists):
nmodel.appendRow(QtGui.QStandardItem(f"无法分析到错误"))
disbledButton = True
for i in lists:
if i[0] == 0:
nmodel.appendRow(QtGui.QStandardItem(f"无法分析到错误"))
disbledButton = True
break
if i[0] == 1:
nmodel.appendRow(QtGui.QStandardItem(f"无法调用 Dll{i[1]}"))
questionMap = lists[:]
repairButton.setDisabled(disbledButton)
questionList.setModel(nmodel)
class LogThreading(QtCore.QThread):
done = QtCore.pyqtSignal(list)
def __init__(self):
super().__init__()
def run(self):
global logText
repairList = []
logText = returnText.toPlainText()
print(logText.splitlines())
for i in logText.splitlines():
print(i)
checkingText = i.lower()
if "err:module:import_dll Library".lower() in checkingText:
# Lose Dll
repairList.append([1, i[i.index("Library") + 8: i.index("(")].strip()])
continue
if "err:module:fixup_imports_ilonly".lower() in checkingText:
# Lose Dll
repairList.append([1, i[i.index("_ilonly") + 8: i.index("not")].strip()])
continue
self.done.emit(repairList)
def DisableButton(things): def DisableButton(things):
button_r_6.setDisabled(things) button_r_6.setDisabled(things)
@ -1998,11 +2078,12 @@ updateThingsString = '''※1、容器自动配置脚本 GUI 查看介绍使用 Q
※6、新增了对 Deepin 23 Alpha 优化的 Wine 安装器 ※6、新增了对 Deepin 23 Alpha 优化的 Wine 安装器
※7、新增 Dll 名称查询功能,可以查询对应 Dll 的作用 ※7、新增 Dll 名称查询功能,可以查询对应 Dll 的作用
※8、支持静态获取可执行文件可以调用的 Dll 并提供解决方案 ※8、支持静态获取可执行文件可以调用的 Dll 并提供解决方案
9、修复了不基于生态适配活动脚本打包器在选择 arm 打包架构下容器自动删除脚本取消勾选无用的问题 ※9、支持移除指定的 .desktop 快捷方式
10、修复了不基于生态适配活动脚本打包器在选择 arm 打包架构下容器自动删除脚本取消勾选无用的问题
''' '''
for i in information["Thank"]: for i in information["Thank"]:
thankText += f"{i}\n" thankText += f"{i}\n"
updateTime = "2022年11月18日" updateTime = "2022年11月19日"
about = f'''<style> about = f'''<style>
a:link, a:active {{ a:link, a:active {{
text-decoration: none; text-decoration: none;
@ -2042,7 +2123,7 @@ Deepin 论坛https://bbs.deepin.org</pre>
<hr> <hr>
<h1>©2020~{time.strftime("%Y")} gfdgd xi、为什么您不喜欢熊出没和阿布呢</h1>''' <h1>©2020~{time.strftime("%Y")} gfdgd xi、为什么您不喜欢熊出没和阿布呢</h1>'''
title = "Wine 运行器 {}".format(version) title = "Wine 运行器 {}".format(version)
#<h1>©2020~{time.strftime("%Y")} <a href="https://gitee.com/gfdgd-xi">gfdgd xi、</a><a href="https://weibo.com/u/7755040136">为什么您不喜欢</a><a href="https://gfdgd-xi.github.io">熊出没</a><a href="https://weibo.com/u/7755040136">和阿布呢</a></h1>''' #<h1>©2020~{time.strftime("%Y")} <a href="https://gitee.com/gfdgd-xi">gfdgd xi、为什么您不喜欢熊出没和阿布呢</h1>'''
updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
try: try:
threading.Thread(target=requests.get, args=[parse.unquote(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9vcGVuL0luc3RhbGwucGhw").decode("utf-8")) + "?Version=" + version]).start() threading.Thread(target=requests.get, args=[parse.unquote(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9vcGVuL0luc3RhbGwucGhw").decode("utf-8")) + "?Version=" + version]).start()
@ -2290,6 +2371,7 @@ w6 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用官方 Wine
getDllOnInternet = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从互联网获取DLL")) getDllOnInternet = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从互联网获取DLL"))
w7 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从镜像获取DLL只支持官方安装镜像DOS内核如 Windows 95 暂不支持)")) w7 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从镜像获取DLL只支持官方安装镜像DOS内核如 Windows 95 暂不支持)"))
updateGeek = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从 Geek Uninstaller 官网升级程序")) updateGeek = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从 Geek Uninstaller 官网升级程序"))
deletePartIcon = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除部分 Wine 程序在启动器的快捷方式"))
deleteDesktopIcon = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除所有 Wine 程序在启动器的快捷方式")) deleteDesktopIcon = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除所有 Wine 程序在启动器的快捷方式"))
wineOption.addAction(w1) wineOption.addAction(w1)
wineOption.addAction(w2) wineOption.addAction(w2)
@ -2361,7 +2443,10 @@ installDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装 D
uninstallDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "卸载 DXVK")) uninstallDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "卸载 DXVK"))
dxvkMenu.addAction(installDxvk) dxvkMenu.addAction(installDxvk)
dxvkMenu.addAction(uninstallDxvk) dxvkMenu.addAction(uninstallDxvk)
wineOption.addSeparator()
wineOption.addAction(deletePartIcon)
wineOption.addAction(deleteDesktopIcon) wineOption.addAction(deleteDesktopIcon)
wineOption.addSeparator()
settingWineBottleCreateLink = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "允许/禁止指定 wine 容器生成快捷方式")) settingWineBottleCreateLink = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "允许/禁止指定 wine 容器生成快捷方式"))
enabledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "允许指定 wine 容器生成快捷方式")) enabledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "允许指定 wine 容器生成快捷方式"))
disbledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "禁止指定 wine 容器生成快捷方式")) disbledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "禁止指定 wine 容器生成快捷方式"))
@ -2418,6 +2503,7 @@ wm4_1.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-ter
wm4_2.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt purge winbind -y' --keep-open")) wm4_2.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt purge winbind -y' --keep-open"))
installDxvk.triggered.connect(InstallDXVK) installDxvk.triggered.connect(InstallDXVK)
uninstallDxvk.triggered.connect(UninstallDXVK) uninstallDxvk.triggered.connect(UninstallDXVK)
deletePartIcon.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"python3 '{programPath}/BuildDesktop.py'"]).start())
deleteDesktopIcon.triggered.connect(DeleteDesktopIcon) deleteDesktopIcon.triggered.connect(DeleteDesktopIcon)
enabledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f")) enabledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f"))
disbledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f")) disbledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f"))
@ -2465,8 +2551,11 @@ s3.triggered.connect(lambda: webbrowser.open_new_tab("https://www.virustotal.com
log = menu.addMenu(QtCore.QCoreApplication.translate("U", "日志(&L)")) log = menu.addMenu(QtCore.QCoreApplication.translate("U", "日志(&L)"))
getDllInfo = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询 Dll")) getDllInfo = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询 Dll"))
checkLogText = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "日志分析"))
getDllInfo.triggered.connect(DllWindow.ShowWindow) getDllInfo.triggered.connect(DllWindow.ShowWindow)
checkLogText.triggered.connect(LogChecking.ShowWindow)
log.addAction(getDllInfo) log.addAction(getDllInfo)
log.addAction(checkLogText)
help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助(&H)")) help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助(&H)"))
runStatusWebSize = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询程序在 Wine 的运行情况")) runStatusWebSize = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询程序在 Wine 的运行情况"))

View File

@ -40,6 +40,9 @@ if "-w" in sys.argv:
wineProgram = sys.argv[wineCommand + 2] wineProgram = sys.argv[wineCommand + 2]
except: except:
pass pass
badChar = [
"(", "?", "*", "!", ")", "&", "'", "\""
]
with open(sys.argv[1], "rb") as file: with open(sys.argv[1], "rb") as file:
while True: while True:
things = file.readline() things = file.readline()
@ -49,7 +52,11 @@ with open(sys.argv[1], "rb") as file:
if n.encode() in things: if n.encode() in things:
# 提取 DLL 名称 # 提取 DLL 名称
for i in str(things[1: -2]).split("\\x"): for i in str(things[1: -2]).split("\\x"):
if n in i and not "(" in i and i[0] != "/": charBad = False
for b in badChar:
if b in i:
charBad = True
if n in i and not charBad and i[0] != "/":
name = i[2: ].replace(",{M", "").replace("+", "") name = i[2: ].replace(",{M", "").replace("+", "")
# 文件路径合法性检测 # 文件路径合法性检测

View File

@ -95,7 +95,7 @@ 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);;MSI 文件(*.msi);;所有文件(*.*)")
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])})) # 写入配置文件
@ -132,7 +132,87 @@ class QT:
e1.addItems(findExeHistory) e1.addItems(findExeHistory)
e1.setEditText(findExeHistory[-1]) e1.setEditText(findExeHistory[-1])
repairList = []
# Flag: 日志推断解决方案功能 # Flag: 日志推断解决方案功能
class LogChecking():
def ShowWindow():
global logThread
global logWindow
global questionList
global repairButton
logWindow = QtWidgets.QWidget()
logWindowLayout = QtWidgets.QGridLayout()
questionList = QtWidgets.QListView()
repairButton = QtWidgets.QPushButton("一键修复")
repairButton.setDisabled(True)
repairButton.clicked.connect(LogChecking.RepairButton)
nmodel = QtGui.QStandardItemModel(window)
item = QtGui.QStandardItem("正在分析中……")
questionList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
nmodel.appendRow(item)
questionList.setModel(nmodel)
logWindowLayout.addWidget(questionList, 0, 0, 3, 1)
logWindowLayout.addWidget(repairButton, 0, 2, 1, 1)
logWindow.setWindowTitle("分析日志")
logWindow.setLayout(logWindowLayout)
logThread = LogThreading()
logThread.done.connect(LogChecking.Show)
logThread.start()
logWindow.setWindowIcon(QtGui.QIcon(f"{programPath}/deepin-wine-runner.svg"))
logWindow.resize(int(logWindow.frameGeometry().width() * 1.2), int(logWindow.frameGeometry().height() * 1.2))
logWindow.show()
def RepairButton():
index = questionList.currentIndex().row()
lists = questionMap[index]
print(f"{programPath}/CheckDLL/bash/{lists[1].lower()}.sh")
if os.path.exists(f"{programPath}/CheckDLL/bash/{lists[1].lower()}.sh"):
OpenTerminal(f"'{programPath}/AutoShell/main.py' '{programPath}/CheckDLL/bash/{lists[1].lower()}.sh'")
return
QtWidgets.QMessageBox.critical(logWindow, "错误", "无法修复该问题")
def Show(lists):
global questionMap
nmodel = QtGui.QStandardItemModel(window)
disbledButton = False
print(lists)
if not len(lists):
nmodel.appendRow(QtGui.QStandardItem(f"无法分析到错误"))
disbledButton = True
for i in lists:
if i[0] == 0:
nmodel.appendRow(QtGui.QStandardItem(f"无法分析到错误"))
disbledButton = True
break
if i[0] == 1:
nmodel.appendRow(QtGui.QStandardItem(f"无法调用 Dll{i[1]}"))
questionMap = lists[:]
repairButton.setDisabled(disbledButton)
questionList.setModel(nmodel)
class LogThreading(QtCore.QThread):
done = QtCore.pyqtSignal(list)
def __init__(self):
super().__init__()
def run(self):
global logText
repairList = []
logText = returnText.toPlainText()
print(logText.splitlines())
for i in logText.splitlines():
print(i)
checkingText = i.lower()
if "err:module:import_dll Library".lower() in checkingText:
# Lose Dll
repairList.append([1, i[i.index("Library") + 8: i.index("(")].strip()])
continue
if "err:module:fixup_imports_ilonly".lower() in checkingText:
# Lose Dll
repairList.append([1, i[i.index("_ilonly") + 8: i.index("not")].strip()])
continue
self.done.emit(repairList)
def DisableButton(things): def DisableButton(things):
button_r_6.setDisabled(things) button_r_6.setDisabled(things)
@ -1998,11 +2078,12 @@ updateThingsString = '''※1、容器自动配置脚本 GUI 查看介绍使用 Q
6新增了对 Deepin 23 Alpha 优化的 Wine 安装器 6新增了对 Deepin 23 Alpha 优化的 Wine 安装器
7新增 Dll 名称查询功能可以查询对应 Dll 的作用 7新增 Dll 名称查询功能可以查询对应 Dll 的作用
8支持静态获取可执行文件可以调用的 Dll 并提供解决方案 8支持静态获取可执行文件可以调用的 Dll 并提供解决方案
9修复了不基于生态适配活动脚本打包器在选择 arm 打包架构下容器自动删除脚本取消勾选无用的问题 9支持移除指定的 .desktop 快捷方式
10修复了不基于生态适配活动脚本打包器在选择 arm 打包架构下容器自动删除脚本取消勾选无用的问题
''' '''
for i in information["Thank"]: for i in information["Thank"]:
thankText += f"{i}\n" thankText += f"{i}\n"
updateTime = "2022年11月18" updateTime = "2022年11月19"
about = f'''<style> about = f'''<style>
a:link, a:active {{ a:link, a:active {{
text-decoration: none; text-decoration: none;
@ -2042,7 +2123,7 @@ Deepin 论坛https://bbs.deepin.org</pre>
<hr> <hr>
<h1>©2020~{time.strftime("%Y")} gfdgd xi为什么您不喜欢熊出没和阿布呢</h1>''' <h1>©2020~{time.strftime("%Y")} gfdgd xi为什么您不喜欢熊出没和阿布呢</h1>'''
title = "Wine 运行器 {}".format(version) title = "Wine 运行器 {}".format(version)
#<h1>©2020~{time.strftime("%Y")} <a href="https://gitee.com/gfdgd-xi">gfdgd xi、</a><a href="https://weibo.com/u/7755040136">为什么您不喜欢</a><a href="https://gfdgd-xi.github.io">熊出没</a><a href="https://weibo.com/u/7755040136">和阿布呢</a></h1>''' #<h1>©2020~{time.strftime("%Y")} <a href="https://gitee.com/gfdgd-xi">gfdgd xi、为什么您不喜欢熊出没和阿布呢</h1>'''
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
try: try:
threading.Thread(target=requests.get, args=[parse.unquote(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9vcGVuL0luc3RhbGwucGhw").decode("utf-8")) + "?Version=" + version]).start() threading.Thread(target=requests.get, args=[parse.unquote(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9vcGVuL0luc3RhbGwucGhw").decode("utf-8")) + "?Version=" + version]).start()
@ -2290,6 +2371,7 @@ w6 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用官方 Wine
getDllOnInternet = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从互联网获取DLL")) getDllOnInternet = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从互联网获取DLL"))
w7 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从镜像获取DLL只支持官方安装镜像DOS内核如 Windows 95 暂不支持)")) w7 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从镜像获取DLL只支持官方安装镜像DOS内核如 Windows 95 暂不支持)"))
updateGeek = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从 Geek Uninstaller 官网升级程序")) updateGeek = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从 Geek Uninstaller 官网升级程序"))
deletePartIcon = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除部分 Wine 程序在启动器的快捷方式"))
deleteDesktopIcon = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除所有 Wine 程序在启动器的快捷方式")) deleteDesktopIcon = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除所有 Wine 程序在启动器的快捷方式"))
wineOption.addAction(w1) wineOption.addAction(w1)
wineOption.addAction(w2) wineOption.addAction(w2)
@ -2361,7 +2443,10 @@ installDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装 D
uninstallDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "卸载 DXVK")) uninstallDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "卸载 DXVK"))
dxvkMenu.addAction(installDxvk) dxvkMenu.addAction(installDxvk)
dxvkMenu.addAction(uninstallDxvk) dxvkMenu.addAction(uninstallDxvk)
wineOption.addSeparator()
wineOption.addAction(deletePartIcon)
wineOption.addAction(deleteDesktopIcon) wineOption.addAction(deleteDesktopIcon)
wineOption.addSeparator()
settingWineBottleCreateLink = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "允许/禁止指定 wine 容器生成快捷方式")) settingWineBottleCreateLink = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "允许/禁止指定 wine 容器生成快捷方式"))
enabledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "允许指定 wine 容器生成快捷方式")) enabledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "允许指定 wine 容器生成快捷方式"))
disbledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "禁止指定 wine 容器生成快捷方式")) disbledWineBottleCreateLink = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "禁止指定 wine 容器生成快捷方式"))
@ -2418,6 +2503,7 @@ wm4_1.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-ter
wm4_2.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt purge winbind -y' --keep-open")) wm4_2.triggered.connect(lambda: os.system(f"'{programPath}/launch.sh' deepin-terminal -C 'pkexec apt purge winbind -y' --keep-open"))
installDxvk.triggered.connect(InstallDXVK) installDxvk.triggered.connect(InstallDXVK)
uninstallDxvk.triggered.connect(UninstallDXVK) uninstallDxvk.triggered.connect(UninstallDXVK)
deletePartIcon.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"python3 '{programPath}/BuildDesktop.py'"]).start())
deleteDesktopIcon.triggered.connect(DeleteDesktopIcon) deleteDesktopIcon.triggered.connect(DeleteDesktopIcon)
enabledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f")) enabledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f"))
disbledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f")) disbledWineBottleCreateLink.triggered.connect(lambda: RunWineProgram("reg' add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f"))
@ -2465,8 +2551,11 @@ s3.triggered.connect(lambda: webbrowser.open_new_tab("https://www.virustotal.com
log = menu.addMenu(QtCore.QCoreApplication.translate("U", "日志(&L)")) log = menu.addMenu(QtCore.QCoreApplication.translate("U", "日志(&L)"))
getDllInfo = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询 Dll")) getDllInfo = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询 Dll"))
checkLogText = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "日志分析"))
getDllInfo.triggered.connect(DllWindow.ShowWindow) getDllInfo.triggered.connect(DllWindow.ShowWindow)
checkLogText.triggered.connect(LogChecking.ShowWindow)
log.addAction(getDllInfo) log.addAction(getDllInfo)
log.addAction(checkLogText)
help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助(&H)")) help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助(&H)"))
runStatusWebSize = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询程序在 Wine 的运行情况")) runStatusWebSize = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "查询程序在 Wine 的运行情况"))

Binary file not shown.