diff --git a/BuildDesktop.py b/BuildDesktop.py new file mode 100755 index 0000000..ec766ca --- /dev/null +++ b/BuildDesktop.py @@ -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_() \ No newline at end of file diff --git a/CheckDLL/CheckCommand.py b/CheckDLL/CheckCommand.py index 8714c86..ec40028 100755 --- a/CheckDLL/CheckCommand.py +++ b/CheckDLL/CheckCommand.py @@ -40,6 +40,9 @@ if "-w" in sys.argv: wineProgram = sys.argv[wineCommand + 2] except: pass +badChar = [ + "(", "?", "*", "!", ")", "&", "'", "\"" +] with open(sys.argv[1], "rb") as file: while True: things = file.readline() @@ -49,7 +52,11 @@ with open(sys.argv[1], "rb") as file: if n.encode() in things: # 提取 DLL 名称 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("+", "") # 文件路径合法性检测 diff --git a/CheckDLL/bash/mfc100.dll.sh b/CheckDLL/bash/mfc100.dll.sh new file mode 100644 index 0000000..4e6dd81 --- /dev/null +++ b/CheckDLL/bash/mfc100.dll.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env deepin-wine-runner-auto-install-bash +# 使用 Wine 运行器的语言解析器 +########################################################################################## +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 更新时间:2022年11月19日 +########################################################################################## +# 用于判断是否为 bash 解释器 +installvcpp 4 +info 提示 修复完成!重新检测即可 \ No newline at end of file diff --git a/CheckDLL/bash/mfc42.dll.sh b/CheckDLL/bash/mfc42.dll.sh index 82c3ab0..3accf08 100644 --- a/CheckDLL/bash/mfc42.dll.sh +++ b/CheckDLL/bash/mfc42.dll.sh @@ -1,2 +1,9 @@ +#!/usr/bin/env deepin-wine-runner-auto-install-bash +# 使用 Wine 运行器的语言解析器 +########################################################################################## +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 更新时间:2022年11月03日 +########################################################################################## +# 用于判断是否为 bash 解释器 installother 2 info 提示 修复完成!重新检测即可 diff --git a/CheckDLL/bash/msvbvm60.dll.sh b/CheckDLL/bash/msvbvm60.dll.sh new file mode 100644 index 0000000..fa2f944 --- /dev/null +++ b/CheckDLL/bash/msvbvm60.dll.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env deepin-wine-runner-auto-install-bash +# 使用 Wine 运行器的语言解析器 +########################################################################################## +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 更新时间:2022年11月19日 +########################################################################################## +# 用于判断是否为 bash 解释器 +installvb 4 +info 提示 修复完成!重新检测即可 \ No newline at end of file diff --git a/__pycache__/InstallVisualBasicRuntime.cpython-37.pyc b/__pycache__/InstallVisualBasicRuntime.cpython-37.pyc old mode 100755 new mode 100644 index 727d9e2..a8ec081 Binary files a/__pycache__/InstallVisualBasicRuntime.cpython-37.pyc and b/__pycache__/InstallVisualBasicRuntime.cpython-37.pyc differ diff --git a/__pycache__/InstallVisualCPlusPlus.cpython-37.pyc b/__pycache__/InstallVisualCPlusPlus.cpython-37.pyc old mode 100755 new mode 100644 index 5dc520b..02e9f8d Binary files a/__pycache__/InstallVisualCPlusPlus.cpython-37.pyc and b/__pycache__/InstallVisualCPlusPlus.cpython-37.pyc differ diff --git a/deb/DEBIAN/.postinst.swp b/deb/DEBIAN/.postinst.swp new file mode 100644 index 0000000..3018621 Binary files /dev/null and b/deb/DEBIAN/.postinst.swp differ diff --git a/deb/DEBIAN/control b/deb/DEBIAN/control index d191ee7..99a144b 100755 --- a/deb/DEBIAN/control +++ b/deb/DEBIAN/control @@ -1,5 +1,5 @@ Package: spark-deepin-wine-runner -Version: 2.5.0~alpha1 +Version: 2.5.0~alpha2 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 Architecture: all diff --git a/deb/DEBIAN/postinst b/deb/DEBIAN/postinst index 513ceaa..938fa23 100755 --- a/deb/DEBIAN/postinst +++ b/deb/DEBIAN/postinst @@ -9,7 +9,7 @@ ################################################################################################################# # 非强制性的必应组件,所以成功不成功都行 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 执行完成 # 如果为非 X86 PC,可以删除掉一些无用组件(主要是用不了) if [ `arch` != "x86_64" ]; then @@ -34,9 +34,9 @@ if [ `arch` != "x86_64" ]; then rm -rf /opt/apps/deepin-wine-runner/InstallNewWineHQ.sh fi # 到时候切换 gpg 源会方便很多 -apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FD6EEA1F20CD4B27 > /dev/null -apt update > /dev/null | true +apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FD6EEA1F20CD4B27 > /dev/null 2>&1 | true +apt update > /dev/null 2>&1 | true # 设置目录权限,让用户可读可写,方便后续删除组件 chmod 777 -R /opt/apps/deepin-wine-runner # 向服务器返回安装数加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 diff --git a/deb/opt/apps/deepin-wine-runner/CheckDLL/CheckCommand.py b/deb/opt/apps/deepin-wine-runner/CheckDLL/CheckCommand.py index 8714c86..ec40028 100755 --- a/deb/opt/apps/deepin-wine-runner/CheckDLL/CheckCommand.py +++ b/deb/opt/apps/deepin-wine-runner/CheckDLL/CheckCommand.py @@ -40,6 +40,9 @@ if "-w" in sys.argv: wineProgram = sys.argv[wineCommand + 2] except: pass +badChar = [ + "(", "?", "*", "!", ")", "&", "'", "\"" +] with open(sys.argv[1], "rb") as file: while True: things = file.readline() @@ -49,7 +52,11 @@ with open(sys.argv[1], "rb") as file: if n.encode() in things: # 提取 DLL 名称 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("+", "") # 文件路径合法性检测 diff --git a/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/mfc100.dll.sh b/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/mfc100.dll.sh new file mode 100644 index 0000000..4e6dd81 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/mfc100.dll.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env deepin-wine-runner-auto-install-bash +# 使用 Wine 运行器的语言解析器 +########################################################################################## +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 更新时间:2022年11月19日 +########################################################################################## +# 用于判断是否为 bash 解释器 +installvcpp 4 +info 提示 修复完成!重新检测即可 \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/mfc42.dll.sh b/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/mfc42.dll.sh index 82c3ab0..3accf08 100644 --- a/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/mfc42.dll.sh +++ b/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/mfc42.dll.sh @@ -1,2 +1,9 @@ +#!/usr/bin/env deepin-wine-runner-auto-install-bash +# 使用 Wine 运行器的语言解析器 +########################################################################################## +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 更新时间:2022年11月03日 +########################################################################################## +# 用于判断是否为 bash 解释器 installother 2 info 提示 修复完成!重新检测即可 diff --git a/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/msvbvm60.dll.sh b/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/msvbvm60.dll.sh new file mode 100644 index 0000000..fa2f944 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/CheckDLL/bash/msvbvm60.dll.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env deepin-wine-runner-auto-install-bash +# 使用 Wine 运行器的语言解析器 +########################################################################################## +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 更新时间:2022年11月19日 +########################################################################################## +# 用于判断是否为 bash 解释器 +installvb 4 +info 提示 修复完成!重新检测即可 \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner index d8e93dd..3d10555 100755 --- a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner +++ b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner @@ -95,7 +95,7 @@ def liulanbutton(): # 第二个浏览按钮事件 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 != "()": e2.setEditText(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.setEditText(findExeHistory[-1]) +repairList = [] # 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): button_r_6.setDisabled(things) @@ -1998,11 +2078,12 @@ updateThingsString = '''※1、容器自动配置脚本 GUI 查看介绍使用 Q ※6、新增了对 Deepin 23 Alpha 优化的 Wine 安装器 ※7、新增 Dll 名称查询功能,可以查询对应 Dll 的作用 ※8、支持静态获取可执行文件可以调用的 Dll 并提供解决方案 -9、修复了不基于生态适配活动脚本打包器在选择 arm 打包架构下容器自动删除脚本取消勾选无用的问题 +※9、支持移除指定的 .desktop 快捷方式 +10、修复了不基于生态适配活动脚本打包器在选择 arm 打包架构下容器自动删除脚本取消勾选无用的问题 ''' for i in information["Thank"]: thankText += f"{i}\n" -updateTime = "2022年11月18日" +updateTime = "2022年11月19日" about = f'''