打包器支持import
Some checks are pending
Auto Building Wine Runner(rpm) / Explore-GitHub-Actions (push) Waiting to run
Auto Building Wine Runner(deb) / Explore-GitHub-Actions (push) Waiting to run
Building Wine Runner Off-line Pages(arm64) / Explore-GitHub-Actions (push) Waiting to run
Building Wine Runner Off-line Pages(amd64) / Explore-GitHub-Actions (push) Waiting to run

This commit is contained in:
gfdgd xi 2024-07-29 09:09:15 +08:00
parent 3bcff8dd87
commit 385348a7b9
3 changed files with 105 additions and 84 deletions

View File

@ -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,7 +671,7 @@ 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"))
@ -677,7 +679,10 @@ if __name__ == "__main__":
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)
else:
app = globalenv.get_value("app")
version = information["Version"] version = information["Version"]
window = QtWidgets.QMainWindow() window = QtWidgets.QMainWindow()
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
@ -745,6 +750,15 @@ if __name__ == "__main__":
exePath.setText(sys.argv[1]) exePath.setText(sys.argv[1])
except: except:
pass 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()
# 设置字体 # 设置字体

View File

@ -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", """提示:
# 窗口创建 # 窗口创建
############### ###############
if (__name__ == "__main__"):
app = QtWidgets.QApplication(sys.argv) 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()
if (__name__ == "__main__"):
window.show() window.show()
sys.exit(app.exec_()) sys.exit(app.exec_())
# Flag解包只读control和解包全部读取 # Flag解包只读control和解包全部读取

View File

@ -5,8 +5,10 @@ app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow() window = QtWidgets.QMainWindow()
globalenv._init() globalenv._init()
globalenv.set_value("app", app) globalenv.set_value("app", app)
#import deepin_wine_packager
import mainwindow #modules = __import__("deepin-wine-packager")
window.setCentralWidget(mainwindow.window) modules = __import__("deepin-wine-easy-packager")
#import mainwindow
window.setCentralWidget(modules.window)
window.show() window.show()
app.exec_() app.exec_()