diff --git a/deb/opt/apps/deepin-wine-runner/package-script.zip b/deb/opt/apps/deepin-wine-runner/package-script.zip index 95c6ea8..1e4ecdd 100755 Binary files a/deb/opt/apps/deepin-wine-runner/package-script.zip and b/deb/opt/apps/deepin-wine-runner/package-script.zip differ 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 95c6ea8..1e4ecdd 100755 Binary files a/package-script.zip and b/package-script.zip differ 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