mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-12-15 11:32:03 +08:00
Compare commits
2 Commits
0623b95fca
...
385348a7b9
| Author | SHA1 | Date | |
|---|---|---|---|
| 385348a7b9 | |||
| 3bcff8dd87 |
@@ -19,6 +19,8 @@ import PyQt5.QtCore as QtCore
|
|||||||
import PyQt5.QtWidgets as QtWidgets
|
import PyQt5.QtWidgets as QtWidgets
|
||||||
from DefaultSetting import *
|
from DefaultSetting import *
|
||||||
|
|
||||||
|
import globalenv
|
||||||
|
|
||||||
def ShowText(text: str):
|
def ShowText(text: str):
|
||||||
if text.replace(" ", "").replace("\n", "") == "":
|
if text.replace(" ", "").replace("\n", "") == "":
|
||||||
return
|
return
|
||||||
@@ -669,82 +671,94 @@ def BrowserExe():
|
|||||||
exePath.setText(filePath[0])
|
exePath.setText(filePath[0])
|
||||||
|
|
||||||
chooseWine = ""
|
chooseWine = ""
|
||||||
if __name__ == "__main__":
|
|
||||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||||
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
|
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
|
||||||
information = json.loads(ReadTxt(f"{programPath}/information.json"))
|
information = json.loads(ReadTxt(f"{programPath}/information.json"))
|
||||||
iconListUnBuild = json.loads(ReadTxt(f"{programPath}/IconList.json"))[0]
|
iconListUnBuild = json.loads(ReadTxt(f"{programPath}/IconList.json"))[0]
|
||||||
iconList = json.loads(ReadTxt(f"{programPath}/IconList.json"))[1]
|
iconList = json.loads(ReadTxt(f"{programPath}/IconList.json"))[1]
|
||||||
for i in iconListUnBuild:
|
for i in iconListUnBuild:
|
||||||
iconList.append(i)
|
iconList.append(i)
|
||||||
|
if (__name__ == "__main__"):
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
version = information["Version"]
|
else:
|
||||||
window = QtWidgets.QMainWindow()
|
app = globalenv.get_value("app")
|
||||||
widget = QtWidgets.QWidget()
|
version = information["Version"]
|
||||||
layout = QtWidgets.QGridLayout()
|
window = QtWidgets.QMainWindow()
|
||||||
exePath = QtWidgets.QLineEdit()
|
widget = QtWidgets.QWidget()
|
||||||
wineChooser = QtWidgets.QComboBox()
|
layout = QtWidgets.QGridLayout()
|
||||||
browserExeButton = QtWidgets.QPushButton("浏览……")
|
exePath = QtWidgets.QLineEdit()
|
||||||
logText = QtWidgets.QTextBrowser()
|
wineChooser = QtWidgets.QComboBox()
|
||||||
logText.setStyleSheet("""
|
browserExeButton = QtWidgets.QPushButton("浏览……")
|
||||||
background-color: black;
|
logText = QtWidgets.QTextBrowser()
|
||||||
color: white;
|
logText.setStyleSheet("""
|
||||||
""")
|
background-color: black;
|
||||||
wineChooserList = [
|
color: white;
|
||||||
"使用 Deepin Wine8 Stable 打包应用",
|
""")
|
||||||
"使用 Spark Wine9 wow 打包应用",
|
wineChooserList = [
|
||||||
"使用 Spark Wine9 打包应用",
|
"使用 Deepin Wine8 Stable 打包应用",
|
||||||
"使用 Spark Wine8 打包应用",
|
"使用 Spark Wine9 wow 打包应用",
|
||||||
"使用 Spark Wine7 Devel 打包应用",
|
"使用 Spark Wine9 打包应用",
|
||||||
"使用 Deepin Wine6 Stable 打包应用",
|
"使用 Spark Wine8 打包应用",
|
||||||
"使用 Deepin Wine5 Stable 打包应用",
|
"使用 Spark Wine7 Devel 打包应用",
|
||||||
"使用 Deepin Wine5 打包应用",
|
"使用 Deepin Wine6 Stable 打包应用",
|
||||||
"使用 Deepin Wine2 打包应用",
|
"使用 Deepin Wine5 Stable 打包应用",
|
||||||
"使用 Spark Wine 打包应用"
|
"使用 Deepin Wine5 打包应用",
|
||||||
]
|
"使用 Deepin Wine2 打包应用",
|
||||||
wineChooserIndex = 2
|
"使用 Spark Wine 打包应用"
|
||||||
wineList = ["deepin-wine8-stable", "spark-wine9-wow", "spark-wine9", "spark-wine8", "spark-wine7-devel", "deepin-wine6-stable", "deepin-wine6-vannila", "spark-wine8-wow", "deepin-wine5-stable", "deepin-wine5", "deepin-wine", "spark-wine"]
|
]
|
||||||
for i in range(len(wineList)):
|
wineChooserIndex = 2
|
||||||
if not os.system(f"which '{wineList[i]}'"):
|
wineList = ["deepin-wine8-stable", "spark-wine9-wow", "spark-wine9", "spark-wine8", "spark-wine7-devel", "deepin-wine6-stable", "deepin-wine6-vannila", "spark-wine8-wow", "deepin-wine5-stable", "deepin-wine5", "deepin-wine", "spark-wine"]
|
||||||
wineChooserIndex = i
|
for i in range(len(wineList)):
|
||||||
break
|
if not os.system(f"which '{wineList[i]}'"):
|
||||||
chooseWine = wineList[wineChooserIndex]
|
wineChooserIndex = i
|
||||||
wineChooserList[wineChooserIndex] = f"{wineChooserList[wineChooserIndex]}(推荐,如无特殊需求不建议更换)"
|
break
|
||||||
wineChooser.addItems(wineChooserList)
|
chooseWine = wineList[wineChooserIndex]
|
||||||
wineChooser.setCurrentIndex(wineChooserIndex)
|
wineChooserList[wineChooserIndex] = f"{wineChooserList[wineChooserIndex]}(推荐,如无特殊需求不建议更换)"
|
||||||
controlLayout = QtWidgets.QHBoxLayout()
|
wineChooser.addItems(wineChooserList)
|
||||||
buildButton = QtWidgets.QPushButton("现在打包……")
|
wineChooser.setCurrentIndex(wineChooserIndex)
|
||||||
installCmpleteButton = QtWidgets.QPushButton("安装程序执行完成")
|
controlLayout = QtWidgets.QHBoxLayout()
|
||||||
helpButton = QtWidgets.QPushButton("帮助")
|
buildButton = QtWidgets.QPushButton("现在打包……")
|
||||||
installUosPackingTool = QtWidgets.QPushButton("安装维护工具箱(可以安装测试 deb)")
|
installCmpleteButton = QtWidgets.QPushButton("安装程序执行完成")
|
||||||
browserExeButton.clicked.connect(BrowserExe)
|
helpButton = QtWidgets.QPushButton("帮助")
|
||||||
buildButton.clicked.connect(RunBuildThread)
|
installUosPackingTool = QtWidgets.QPushButton("安装维护工具箱(可以安装测试 deb)")
|
||||||
installCmpleteButton.clicked.connect(PressCompleteDownload)
|
browserExeButton.clicked.connect(BrowserExe)
|
||||||
helpButton.clicked.connect(ReadMe)
|
buildButton.clicked.connect(RunBuildThread)
|
||||||
def InstallUosPackingTool():
|
installCmpleteButton.clicked.connect(PressCompleteDownload)
|
||||||
if os.system("which spark-store"):
|
helpButton.clicked.connect(ReadMe)
|
||||||
QtWidgets.QMessageBox.critical(window, "提示", "未安装星火应用商店,无法继续\n星火应用商店官网:https://spark-app.store/")
|
def InstallUosPackingTool():
|
||||||
return 0
|
if os.system("which spark-store"):
|
||||||
threading.Thread(target=os.system, args=["spark-store spk://store/tools/uos-packaging-tools"]).start()
|
QtWidgets.QMessageBox.critical(window, "提示", "未安装星火应用商店,无法继续\n星火应用商店官网:https://spark-app.store/")
|
||||||
installUosPackingTool.clicked.connect(InstallUosPackingTool)
|
return 0
|
||||||
installCmpleteButton.setDisabled(True)
|
threading.Thread(target=os.system, args=["spark-store spk://store/tools/uos-packaging-tools"]).start()
|
||||||
controlLayout.addWidget(buildButton)
|
installUosPackingTool.clicked.connect(InstallUosPackingTool)
|
||||||
controlLayout.addWidget(installCmpleteButton)
|
installCmpleteButton.setDisabled(True)
|
||||||
controlLayout.addWidget(helpButton)
|
controlLayout.addWidget(buildButton)
|
||||||
controlLayout.addWidget(installUosPackingTool)
|
controlLayout.addWidget(installCmpleteButton)
|
||||||
layout.addWidget(QtWidgets.QLabel("选择 EXE:"), 0, 0)
|
controlLayout.addWidget(helpButton)
|
||||||
layout.addWidget(exePath, 0, 1)
|
controlLayout.addWidget(installUosPackingTool)
|
||||||
layout.addWidget(browserExeButton, 0, 2)
|
layout.addWidget(QtWidgets.QLabel("选择 EXE:"), 0, 0)
|
||||||
layout.addWidget(wineChooser, 1, 1)
|
layout.addWidget(exePath, 0, 1)
|
||||||
layout.addLayout(controlLayout, 2, 1)
|
layout.addWidget(browserExeButton, 0, 2)
|
||||||
layout.addWidget(logText, 3, 0, 1, 3)
|
layout.addWidget(wineChooser, 1, 1)
|
||||||
widget.setLayout(layout)
|
layout.addLayout(controlLayout, 2, 1)
|
||||||
window.setCentralWidget(widget)
|
layout.addWidget(logText, 3, 0, 1, 3)
|
||||||
window.setWindowTitle(f"Wine 运行器 {version}——简易打包器")
|
widget.setLayout(layout)
|
||||||
try:
|
window.setCentralWidget(widget)
|
||||||
exePath.setText(sys.argv[1])
|
window.setWindowTitle(f"Wine 运行器 {version}——简易打包器")
|
||||||
except:
|
try:
|
||||||
pass
|
exePath.setText(sys.argv[1])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if (__name__ != "__main__"):
|
||||||
|
# 设置滚动条
|
||||||
|
areaScroll = QtWidgets.QScrollArea(window)
|
||||||
|
areaScroll.setWidgetResizable(True)
|
||||||
|
areaScroll.setWidget(widget)
|
||||||
|
areaScroll.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
|
window.setCentralWidget(areaScroll)
|
||||||
|
|
||||||
|
if (__name__ == "__main__"):
|
||||||
window.resize(int(window.frameGeometry().width() * 1.2), int(window.frameGeometry().height() * 1.1))
|
window.resize(int(window.frameGeometry().width() * 1.2), int(window.frameGeometry().height() * 1.1))
|
||||||
window.show()
|
window.show()
|
||||||
# 设置字体
|
# 设置字体
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import PyQt5.QtWidgets as QtWidgets
|
|||||||
from trans import *
|
from trans import *
|
||||||
from DefaultSetting import *
|
from DefaultSetting import *
|
||||||
from Model import *
|
from Model import *
|
||||||
|
import globalenv
|
||||||
|
|
||||||
TMPDIR = os.getenv("TMPDIR")
|
TMPDIR = os.getenv("TMPDIR")
|
||||||
if (TMPDIR == None):
|
if (TMPDIR == None):
|
||||||
@@ -2366,7 +2367,10 @@ tips = transla.transe("U", """提示:
|
|||||||
# 窗口创建
|
# 窗口创建
|
||||||
###############
|
###############
|
||||||
|
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
if (__name__ == "__main__"):
|
||||||
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
else:
|
||||||
|
app = globalenv.get_value("app")
|
||||||
window = QtWidgets.QMainWindow()
|
window = QtWidgets.QMainWindow()
|
||||||
widget = QtWidgets.QWidget()
|
widget = QtWidgets.QWidget()
|
||||||
|
|
||||||
@@ -2703,7 +2707,8 @@ SetFont(app)
|
|||||||
window.setCentralWidget(widget)
|
window.setCentralWidget(widget)
|
||||||
# 判断是否为小屏幕,是则设置滚动条并全屏
|
# 判断是否为小屏幕,是则设置滚动条并全屏
|
||||||
if (window.frameGeometry().width() > app.primaryScreen().availableGeometry().size().width() * 0.8 or
|
if (window.frameGeometry().width() > app.primaryScreen().availableGeometry().size().width() * 0.8 or
|
||||||
window.frameGeometry().height() > app.primaryScreen().availableGeometry().size().height() * 0.9):
|
window.frameGeometry().height() > app.primaryScreen().availableGeometry().size().height() * 0.9 or
|
||||||
|
__name__ != "__main__"):
|
||||||
# 设置滚动条
|
# 设置滚动条
|
||||||
areaScroll = QtWidgets.QScrollArea(window)
|
areaScroll = QtWidgets.QScrollArea(window)
|
||||||
areaScroll.setWidgetResizable(True)
|
areaScroll.setWidgetResizable(True)
|
||||||
@@ -2711,8 +2716,8 @@ if (window.frameGeometry().width() > app.primaryScreen().availableGeometry().siz
|
|||||||
areaScroll.setFrameShape(QtWidgets.QFrame.NoFrame)
|
areaScroll.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
window.setCentralWidget(areaScroll)
|
window.setCentralWidget(areaScroll)
|
||||||
window.showMaximized() # 设置全屏
|
window.showMaximized() # 设置全屏
|
||||||
window.show()
|
|
||||||
|
|
||||||
window.show()
|
if (__name__ == "__main__"):
|
||||||
sys.exit(app.exec_())
|
window.show()
|
||||||
# Flag:解包只读control和解包全部读取
|
sys.exit(app.exec_())
|
||||||
|
# Flag:解包只读control和解包全部读取
|
||||||
|
|||||||
15
globalenv.py
Normal file
15
globalenv.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
def _init():#初始化
|
||||||
|
global _global_dict
|
||||||
|
_global_dict = {}
|
||||||
|
|
||||||
|
def set_value(key,value):
|
||||||
|
""" 定义一个全局变量 """
|
||||||
|
_global_dict[key] = value
|
||||||
|
|
||||||
|
""" 获得一个全局变量,不存在则返回默认值 """
|
||||||
|
def get_value(key,defValue=None):
|
||||||
|
try:
|
||||||
|
return _global_dict[key]
|
||||||
|
except KeyError:
|
||||||
|
return defValue
|
||||||
@@ -50,8 +50,13 @@ from trans import *
|
|||||||
from Model import *
|
from Model import *
|
||||||
from DefaultSetting import *
|
from DefaultSetting import *
|
||||||
|
|
||||||
|
import globalenv
|
||||||
|
|
||||||
def PythonLower():
|
def PythonLower():
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
if (__name__ == "__main__"):
|
||||||
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
else:
|
||||||
|
app = globalenv.get_value("app")
|
||||||
QtWidgets.QMessageBox.critical(None, "错误", "Python 至少需要 3.6 及以上版本,目前版本:" + platform.python_version() + "")
|
QtWidgets.QMessageBox.critical(None, "错误", "Python 至少需要 3.6 及以上版本,目前版本:" + platform.python_version() + "")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -2456,7 +2461,6 @@ def CheckWine():
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
|
||||||
QtWidgets.QMessageBox.critical(None, "错误", f"无法读取配置,无法继续\n{traceback.format_exc()}")
|
QtWidgets.QMessageBox.critical(None, "错误", f"无法读取配置,无法继续\n{traceback.format_exc()}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
CheckWine()
|
CheckWine()
|
||||||
@@ -2468,7 +2472,10 @@ print(wine)
|
|||||||
###########################
|
###########################
|
||||||
# 程序信息
|
# 程序信息
|
||||||
###########################
|
###########################
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
if (__name__ == "__main__"):
|
||||||
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
else:
|
||||||
|
app = globalenv.get_value("app")
|
||||||
trans = QtCore.QTranslator()
|
trans = QtCore.QTranslator()
|
||||||
transeObject = QtCore.QObject()
|
transeObject = QtCore.QObject()
|
||||||
transla = QtCore.QCoreApplication.translate
|
transla = QtCore.QCoreApplication.translate
|
||||||
@@ -3381,8 +3388,10 @@ SetFont(setting["FontSize"])
|
|||||||
|
|
||||||
window.setCentralWidget(widget)
|
window.setCentralWidget(widget)
|
||||||
# 判断是否为小屏幕,是则设置滚动条并全屏
|
# 判断是否为小屏幕,是则设置滚动条并全屏
|
||||||
|
# 获取为 import 为控件,也默认开启滚动条
|
||||||
if (window.frameGeometry().width() > app.primaryScreen().availableGeometry().size().width() * 0.8 or
|
if (window.frameGeometry().width() > app.primaryScreen().availableGeometry().size().width() * 0.8 or
|
||||||
window.frameGeometry().height() > app.primaryScreen().availableGeometry().size().height() * 0.9):
|
window.frameGeometry().height() > app.primaryScreen().availableGeometry().size().height() * 0.9 or
|
||||||
|
__name__ != "__main__"):
|
||||||
# 设置滚动条
|
# 设置滚动条
|
||||||
areaScroll = QtWidgets.QScrollArea(window)
|
areaScroll = QtWidgets.QScrollArea(window)
|
||||||
areaScroll.setWidgetResizable(True)
|
areaScroll.setWidgetResizable(True)
|
||||||
@@ -3390,9 +3399,13 @@ if (window.frameGeometry().width() > app.primaryScreen().availableGeometry().siz
|
|||||||
areaScroll.setFrameShape(QtWidgets.QFrame.NoFrame)
|
areaScroll.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||||
window.setCentralWidget(areaScroll)
|
window.setCentralWidget(areaScroll)
|
||||||
window.showMaximized() # 设置全屏
|
window.showMaximized() # 设置全屏
|
||||||
window.show()
|
|
||||||
|
|
||||||
|
|
||||||
# Mini 模式
|
if (__name__ == "__main__"):
|
||||||
# MiniMode(True)
|
window.show()
|
||||||
sys.exit(app.exec_())
|
# Mini 模式
|
||||||
|
# MiniMode(True)
|
||||||
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
14
test.py
Normal file
14
test.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import sys
|
||||||
|
import globalenv
|
||||||
|
import PyQt5.QtWidgets as QtWidgets
|
||||||
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
window = QtWidgets.QMainWindow()
|
||||||
|
globalenv._init()
|
||||||
|
globalenv.set_value("app", app)
|
||||||
|
#import deepin_wine_packager
|
||||||
|
#modules = __import__("deepin-wine-packager")
|
||||||
|
modules = __import__("deepin-wine-easy-packager")
|
||||||
|
#import mainwindow
|
||||||
|
window.setCentralWidget(modules.window)
|
||||||
|
window.show()
|
||||||
|
app.exec_()
|
||||||
Reference in New Issue
Block a user