From d9c17e24704b21c894c2fcdf8e2da8904cf6c7b3 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Mon, 17 Oct 2022 21:58:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=B3=E9=94=AE=E6=97=A0?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=96=B9=E5=BC=8F+=E6=B7=BB=E5=8A=A0wine?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deepin-wine-runner/package-script.zip | Bin 300918 -> 300918 bytes .../apps/deepin-wine-runner/wine/installwine | 33 +++++++++++++++++- deb/opt/apps/deepin-wine-runner/wine/local | 1 + .../spark-deepin-wine-package-builder.desktop | 2 +- .../spark-deepin-wine-runner.desktop | 2 +- package-script.zip | Bin 300918 -> 300918 bytes wine/installwine | 33 +++++++++++++++++- wine/local | 1 + 8 files changed, 68 insertions(+), 4 deletions(-) create mode 120000 deb/opt/apps/deepin-wine-runner/wine/local create mode 120000 wine/local diff --git a/deb/opt/apps/deepin-wine-runner/package-script.zip b/deb/opt/apps/deepin-wine-runner/package-script.zip index 95c6ea8338f13e46984ff77ac83fcf3efa87b939..1e4ecdd59126d96fa95de7678f46ba8a638463b0 100755 GIT binary patch delta 159 zcmeyiPUzb@p$TRzlbn5%r%(LFD7?|vjSIn>=*!i-g=_m3F2)ZxP(-Ki>|){De)%z@ zEFX&acEL}KA#89V&Gtz@7`IRQ!SpMHnI+zLd%rKUq&i$ya&iKf!1Svn%&Kr9VW5re N(xuGXrAt|&l>pELJhA`) delta 159 zcmeyiPUzb@p$TRzfd{>lr%(LFD7?|vjf-X10Vr>xFIV#xuI*d67(d)V5uLuXi-m9d z<;RS&d?@1E1wS!{u)&2i+b8{C+&<|C)2|R_pcUKueVHZI;j)sG6SxGXUoBx)g$oG- QZETk=W!^4b$`Y*v06$AXYybcN diff --git a/deb/opt/apps/deepin-wine-runner/wine/installwine b/deb/opt/apps/deepin-wine-runner/wine/installwine index 5fd9d7c..b724d42 100755 --- a/deb/opt/apps/deepin-wine-runner/wine/installwine +++ b/deb/opt/apps/deepin-wine-runner/wine/installwine @@ -2,7 +2,7 @@ # 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写 ######################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布 -# 版本:2.1.0 +# 版本:2.4.0 # 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 的 PyQt5 构建 ######################################################################### @@ -11,6 +11,7 @@ ################# import os import shutil +import random import sys import json import traceback @@ -66,6 +67,8 @@ class Ui_MainWindow(object): self.deleteZip.setTristate(False) self.deleteZip.setObjectName("deleteZip") self.horizontalLayout.addWidget(self.deleteZip) + self.addOtherWine = QtWidgets.QPushButton(self.centralWidget) + self.horizontalLayout.addWidget(self.addOtherWine) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem2) self.verticalLayout_2.addLayout(self.horizontalLayout) @@ -81,6 +84,7 @@ class Ui_MainWindow(object): self.delButton.setText(_translate("MainWindow", ">>")) self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件")) self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)")) + self.addOtherWine.setText(_translate("MainWindow", "导入自己的Wine")) def ReadLocalInformation(): try: @@ -97,6 +101,32 @@ def ReadLocalInformation(): traceback.print_exc() QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc()) +def InstallOtherWine(): + path = QtWidgets.QFileDialog.getOpenFileName(window, "选择 Wine", os.getenv("~"), "wine(wine);;wine64(wine64);;全部文件(*.*)") + if path[0] == "" or not path[1]: + return + try: + # 写入配置文件 + rfile = open(f"{programPath}/winelist.json", "r") + list = json.loads(rfile.read()) + rfile.close() + # 创建映射 + name = os.path.basename(os.path.dirname(os.path.dirname(path[0]))) + if name == "" or name == None: + name = f"useradd-wine-{random.randint(0, 99999)}" + binPath = os.path.dirname(os.path.dirname(path[0])) + if os.system(f"ln -s '{binPath}' '{programPath}/{name}'") != 0: + QtWidgets.QMessageBox.critical(window, "新建wine映射失败") + # C++ 版注释:不直接用 readwrite 是因为不能覆盖写入 + file = open(f"{programPath}/winelist.json", "w") + list.append(name) + file.write(json.dumps(list)) + file.close() + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc()) + ReadLocalInformation() + # 下面内容均翻译自 C++ 版本 def ReadInternetInformation(): global internetJsonList @@ -293,6 +323,7 @@ if __name__ == "__main__": # 连接信号 ui.addButton.clicked.connect(on_addButton_clicked) ui.delButton.clicked.connect(on_delButton_clicked) + ui.addOtherWine.clicked.connect(InstallOtherWine) ## 加载内容 # 设置列表双击不会编辑 ui.localWineList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) diff --git a/deb/opt/apps/deepin-wine-runner/wine/local b/deb/opt/apps/deepin-wine-runner/wine/local new file mode 120000 index 0000000..0e7b2c0 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/wine/local @@ -0,0 +1 @@ +/media/gfdgd_xi/bebdaa29-d8c3-4b34-9fa8-5c31a779bb6a/wine6.0/usr/local \ No newline at end of file diff --git a/deb/usr/share/applications/spark-deepin-wine-package-builder.desktop b/deb/usr/share/applications/spark-deepin-wine-package-builder.desktop index da2e4da..cb4fe1a 100755 --- a/deb/usr/share/applications/spark-deepin-wine-package-builder.desktop +++ b/deb/usr/share/applications/spark-deepin-wine-package-builder.desktop @@ -9,4 +9,4 @@ Terminal=false StartupNotify=true NoDisplay=true Keywords=exe;scr; -X-application-x-executable=application/vnd.microsoft.portable-executable;application/x-dosexec;application/x-msi;application-x-executable;application/application-x-ms-dos-executable;application/application-x-msdownload;application/octet-stream +MimeType=application/x-ms-dos-executable;application/x-msi;application/x-ms-shortcut; diff --git a/deb/usr/share/applications/spark-deepin-wine-runner.desktop b/deb/usr/share/applications/spark-deepin-wine-runner.desktop index 98143a1..af220ee 100755 --- a/deb/usr/share/applications/spark-deepin-wine-runner.desktop +++ b/deb/usr/share/applications/spark-deepin-wine-runner.desktop @@ -8,4 +8,4 @@ Name[zh]=Wine 运行器 Terminal=false StartupNotify=true Keywords=exe;scr; -X-application-x-executable=application/vnd.microsoft.portable-executable;application/x-dosexec;application/x-msi;application-x-executable;application/application-x-ms-dos-executable;application/application-x-msdownload;application/octet-stream +MimeType=application/x-ms-dos-executable;application/x-msi;application/x-ms-shortcut; diff --git a/package-script.zip b/package-script.zip index 95c6ea8338f13e46984ff77ac83fcf3efa87b939..1e4ecdd59126d96fa95de7678f46ba8a638463b0 100755 GIT binary patch delta 159 zcmeyiPUzb@p$TRzlbn5%r%(LFD7?|vjSIn>=*!i-g=_m3F2)ZxP(-Ki>|){De)%z@ zEFX&acEL}KA#89V&Gtz@7`IRQ!SpMHnI+zLd%rKUq&i$ya&iKf!1Svn%&Kr9VW5re N(xuGXrAt|&l>pELJhA`) delta 159 zcmeyiPUzb@p$TRzfd{>lr%(LFD7?|vjf-X10Vr>xFIV#xuI*d67(d)V5uLuXi-m9d z<;RS&d?@1E1wS!{u)&2i+b8{C+&<|C)2|R_pcUKueVHZI;j)sG6SxGXUoBx)g$oG- QZETk=W!^4b$`Y*v06$AXYybcN diff --git a/wine/installwine b/wine/installwine index 5fd9d7c..b724d42 100755 --- a/wine/installwine +++ b/wine/installwine @@ -2,7 +2,7 @@ # 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写 ######################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布 -# 版本:2.1.0 +# 版本:2.4.0 # 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 的 PyQt5 构建 ######################################################################### @@ -11,6 +11,7 @@ ################# import os import shutil +import random import sys import json import traceback @@ -66,6 +67,8 @@ class Ui_MainWindow(object): self.deleteZip.setTristate(False) self.deleteZip.setObjectName("deleteZip") self.horizontalLayout.addWidget(self.deleteZip) + self.addOtherWine = QtWidgets.QPushButton(self.centralWidget) + self.horizontalLayout.addWidget(self.addOtherWine) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem2) self.verticalLayout_2.addLayout(self.horizontalLayout) @@ -81,6 +84,7 @@ class Ui_MainWindow(object): self.delButton.setText(_translate("MainWindow", ">>")) self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件")) self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)")) + self.addOtherWine.setText(_translate("MainWindow", "导入自己的Wine")) def ReadLocalInformation(): try: @@ -97,6 +101,32 @@ def ReadLocalInformation(): traceback.print_exc() QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc()) +def InstallOtherWine(): + path = QtWidgets.QFileDialog.getOpenFileName(window, "选择 Wine", os.getenv("~"), "wine(wine);;wine64(wine64);;全部文件(*.*)") + if path[0] == "" or not path[1]: + return + try: + # 写入配置文件 + rfile = open(f"{programPath}/winelist.json", "r") + list = json.loads(rfile.read()) + rfile.close() + # 创建映射 + name = os.path.basename(os.path.dirname(os.path.dirname(path[0]))) + if name == "" or name == None: + name = f"useradd-wine-{random.randint(0, 99999)}" + binPath = os.path.dirname(os.path.dirname(path[0])) + if os.system(f"ln -s '{binPath}' '{programPath}/{name}'") != 0: + QtWidgets.QMessageBox.critical(window, "新建wine映射失败") + # C++ 版注释:不直接用 readwrite 是因为不能覆盖写入 + file = open(f"{programPath}/winelist.json", "w") + list.append(name) + file.write(json.dumps(list)) + file.close() + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc()) + ReadLocalInformation() + # 下面内容均翻译自 C++ 版本 def ReadInternetInformation(): global internetJsonList @@ -293,6 +323,7 @@ if __name__ == "__main__": # 连接信号 ui.addButton.clicked.connect(on_addButton_clicked) ui.delButton.clicked.connect(on_delButton_clicked) + ui.addOtherWine.clicked.connect(InstallOtherWine) ## 加载内容 # 设置列表双击不会编辑 ui.localWineList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) diff --git a/wine/local b/wine/local new file mode 120000 index 0000000..0e7b2c0 --- /dev/null +++ b/wine/local @@ -0,0 +1 @@ +/media/gfdgd_xi/bebdaa29-d8c3-4b34-9fa8-5c31a779bb6a/wine6.0/usr/local \ No newline at end of file