mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-27 08:28:05 +08:00
修复右键无打开方式+添加wine功能
This commit is contained in:
parent
e6a9d1feb1
commit
d9c17e2470
Binary file not shown.
@ -2,7 +2,7 @@
|
|||||||
# 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写
|
# 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布
|
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布
|
||||||
# 版本:2.1.0
|
# 版本:2.4.0
|
||||||
# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序
|
# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序
|
||||||
# 基于 Python3 的 PyQt5 构建
|
# 基于 Python3 的 PyQt5 构建
|
||||||
#########################################################################
|
#########################################################################
|
||||||
@ -11,6 +11,7 @@
|
|||||||
#################
|
#################
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import random
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import traceback
|
import traceback
|
||||||
@ -66,6 +67,8 @@ class Ui_MainWindow(object):
|
|||||||
self.deleteZip.setTristate(False)
|
self.deleteZip.setTristate(False)
|
||||||
self.deleteZip.setObjectName("deleteZip")
|
self.deleteZip.setObjectName("deleteZip")
|
||||||
self.horizontalLayout.addWidget(self.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)
|
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.horizontalLayout.addItem(spacerItem2)
|
self.horizontalLayout.addItem(spacerItem2)
|
||||||
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
||||||
@ -81,6 +84,7 @@ class Ui_MainWindow(object):
|
|||||||
self.delButton.setText(_translate("MainWindow", ">>"))
|
self.delButton.setText(_translate("MainWindow", ">>"))
|
||||||
self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件"))
|
self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件"))
|
||||||
self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)"))
|
self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)"))
|
||||||
|
self.addOtherWine.setText(_translate("MainWindow", "导入自己的Wine"))
|
||||||
|
|
||||||
def ReadLocalInformation():
|
def ReadLocalInformation():
|
||||||
try:
|
try:
|
||||||
@ -97,6 +101,32 @@ def ReadLocalInformation():
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_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++ 版本
|
# 下面内容均翻译自 C++ 版本
|
||||||
def ReadInternetInformation():
|
def ReadInternetInformation():
|
||||||
global internetJsonList
|
global internetJsonList
|
||||||
@ -293,6 +323,7 @@ if __name__ == "__main__":
|
|||||||
# 连接信号
|
# 连接信号
|
||||||
ui.addButton.clicked.connect(on_addButton_clicked)
|
ui.addButton.clicked.connect(on_addButton_clicked)
|
||||||
ui.delButton.clicked.connect(on_delButton_clicked)
|
ui.delButton.clicked.connect(on_delButton_clicked)
|
||||||
|
ui.addOtherWine.clicked.connect(InstallOtherWine)
|
||||||
## 加载内容
|
## 加载内容
|
||||||
# 设置列表双击不会编辑
|
# 设置列表双击不会编辑
|
||||||
ui.localWineList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
ui.localWineList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
1
deb/opt/apps/deepin-wine-runner/wine/local
Symbolic link
1
deb/opt/apps/deepin-wine-runner/wine/local
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/media/gfdgd_xi/bebdaa29-d8c3-4b34-9fa8-5c31a779bb6a/wine6.0/usr/local
|
@ -9,4 +9,4 @@ Terminal=false
|
|||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
Keywords=exe;scr;
|
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;
|
||||||
|
@ -8,4 +8,4 @@ Name[zh]=Wine 运行器
|
|||||||
Terminal=false
|
Terminal=false
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
Keywords=exe;scr;
|
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;
|
||||||
|
Binary file not shown.
@ -2,7 +2,7 @@
|
|||||||
# 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写
|
# 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布
|
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布
|
||||||
# 版本:2.1.0
|
# 版本:2.4.0
|
||||||
# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序
|
# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序
|
||||||
# 基于 Python3 的 PyQt5 构建
|
# 基于 Python3 的 PyQt5 构建
|
||||||
#########################################################################
|
#########################################################################
|
||||||
@ -11,6 +11,7 @@
|
|||||||
#################
|
#################
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import random
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import traceback
|
import traceback
|
||||||
@ -66,6 +67,8 @@ class Ui_MainWindow(object):
|
|||||||
self.deleteZip.setTristate(False)
|
self.deleteZip.setTristate(False)
|
||||||
self.deleteZip.setObjectName("deleteZip")
|
self.deleteZip.setObjectName("deleteZip")
|
||||||
self.horizontalLayout.addWidget(self.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)
|
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.horizontalLayout.addItem(spacerItem2)
|
self.horizontalLayout.addItem(spacerItem2)
|
||||||
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
||||||
@ -81,6 +84,7 @@ class Ui_MainWindow(object):
|
|||||||
self.delButton.setText(_translate("MainWindow", ">>"))
|
self.delButton.setText(_translate("MainWindow", ">>"))
|
||||||
self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件"))
|
self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件"))
|
||||||
self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)"))
|
self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)"))
|
||||||
|
self.addOtherWine.setText(_translate("MainWindow", "导入自己的Wine"))
|
||||||
|
|
||||||
def ReadLocalInformation():
|
def ReadLocalInformation():
|
||||||
try:
|
try:
|
||||||
@ -97,6 +101,32 @@ def ReadLocalInformation():
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_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++ 版本
|
# 下面内容均翻译自 C++ 版本
|
||||||
def ReadInternetInformation():
|
def ReadInternetInformation():
|
||||||
global internetJsonList
|
global internetJsonList
|
||||||
@ -293,6 +323,7 @@ if __name__ == "__main__":
|
|||||||
# 连接信号
|
# 连接信号
|
||||||
ui.addButton.clicked.connect(on_addButton_clicked)
|
ui.addButton.clicked.connect(on_addButton_clicked)
|
||||||
ui.delButton.clicked.connect(on_delButton_clicked)
|
ui.delButton.clicked.connect(on_delButton_clicked)
|
||||||
|
ui.addOtherWine.clicked.connect(InstallOtherWine)
|
||||||
## 加载内容
|
## 加载内容
|
||||||
# 设置列表双击不会编辑
|
# 设置列表双击不会编辑
|
||||||
ui.localWineList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
ui.localWineList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
|
1
wine/local
Symbolic link
1
wine/local
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/media/gfdgd_xi/bebdaa29-d8c3-4b34-9fa8-5c31a779bb6a/wine6.0/usr/local
|
Loading…
x
Reference in New Issue
Block a user