Compare commits

...

3 Commits

Author SHA1 Message Date
96319869b6 termux默认也使用标签页页面
Some checks failed
Auto Building Wine Runner(rpm) / Explore-GitHub-Actions (push) Has been cancelled
Auto Building Wine Runner(deb) / Explore-GitHub-Actions (push) Has been cancelled
Building Wine Runner Off-line Pages(arm64) / Explore-GitHub-Actions (push) Has been cancelled
Building Wine Runner Off-line Pages(amd64) / Explore-GitHub-Actions (push) Has been cancelled
2024-08-03 18:02:02 +08:00
bc5aca0fd7 优化切换的使用体验 2024-08-03 17:46:56 +08:00
bf18411f7a 支持动态读取添加模组 2024-08-03 17:04:46 +08:00
35 changed files with 192 additions and 87 deletions

0
ConfigLanguareRunner-help.json Normal file → Executable file
View File

0
DefaultSetting.py Normal file → Executable file
View File

0
DisabledOpengl.reg Normal file → Executable file
View File

0
Download.py Normal file → Executable file
View File

0
EnabledOpengl.reg Normal file → Executable file
View File

0
IconList.json Normal file → Executable file
View File

0
InstallDeepinWine6OnUbuntu.sh Normal file → Executable file
View File

0
InstallDeepinWineOnUbuntu.sh Normal file → Executable file
View File

View File

@ -39,6 +39,7 @@ copy-files:
cp -rv wine/ deb/opt/apps/deepin-wine-runner/
cp -rv Test/ deb/opt/apps/deepin-wine-runner/
cp -rv dxvk/ deb/opt/apps/deepin-wine-runner/
cp -rv packager-config/ deb/opt/apps/deepin-wine-runner/
cp -rv information.json package-script
zip -v -q -r package-script.zip package-script
cp -rv InstallBox86-cn.sh deb/opt/apps/deepin-wine-runner/
@ -97,7 +98,7 @@ copy-files:
cp -rv InstallVisualCPlusPlus.py deb/opt/apps/deepin-wine-runner
cp -rv launch.sh deb/opt/apps/deepin-wine-runner
cp -rv LICENSE deb/opt/apps/deepin-wine-runner
cp -rv mainwindow.py deb/opt/apps/deepin-wine-runner/deepin-wine-runner
cp -rv mainwindow.py deb/opt/apps/deepin-wine-runner/
cp -rv package-script.zip deb/opt/apps/deepin-wine-runner
cp -rv Run.bat deb/opt/apps/deepin-wine-runner
cp -rv RunVM.sh deb/opt/apps/deepin-wine-runner
@ -138,6 +139,7 @@ copy-files:
cp -rv globalenv.py deb/opt/apps/deepin-wine-runner
cp -rv local deb/opt/apps/deepin-wine-runner
cp -rv WindowModule.py deb/opt/apps/deepin-wine-runner
cp -rv main.py deb/opt/apps/deepin-wine-runner/deepin-wine-runner
mkdir -pv deb/opt/apps/deepin-wine-runner/entries/
cp -rv deb/usr/share/applications deb/opt/apps/deepin-wine-runner/entries/applications
python3 UpdateTime.py
@ -204,7 +206,7 @@ package-termux-deb:
sudo cp -rv deb-termux/usr/share/applications /tmp/spark-deepin-wine-runner-builder/data/data/com.termux/files/usr/share/applications
# 加入 termux loader
sudo cp -rv mainwindow-termux-loader.sh /tmp/spark-deepin-wine-runner-builder/data/data/com.termux/files/usr/opt/apps/deepin-wine-runner/deepin-wine-runner
sudo cp -rv mainwindow.py /tmp/spark-deepin-wine-runner-builder/data/data/com.termux/files/usr/opt/apps/deepin-wine-runner/mainwindow.py
sudo cp -rv main.py /tmp/spark-deepin-wine-runner-builder/data/data/com.termux/files/usr/opt/apps/deepin-wine-runner/mainwindow.py
sudo bash builddeb/ChangeDebVersion.sh
dpkg-deb -Z xz -z 9 -b /tmp/spark-deepin-wine-runner-builder spark-deepin-wine-runner-termux.deb
make remove-copy-files -j$(nproc)

0
README_en.md Normal file → Executable file
View File

0
RunCommandWithTerminal.py Normal file → Executable file
View File

0
UpdateTime.py Normal file → Executable file
View File

6
WindowModule.py Normal file → Executable file
View File

@ -20,14 +20,10 @@ moduleNameList = {
"Name": "虚拟机管理工具",
"RepeatShow": True
},
"VM.show-vm": {
"Name": "虚拟机连接工具VNC",
"RepeatShow": True
},
"wine.installwine": {
"Name": "Wine 安装工具",
"RepeatShow": True
},
}
}
class RunnerWindow:

View File

@ -750,13 +750,13 @@ try:
exePath.setText(sys.argv[1])
except:
pass
if (__name__ != "__main__"):
'''if (__name__ != "__main__"):
# 设置滚动条
areaScroll = QtWidgets.QScrollArea(window)
areaScroll.setWidgetResizable(True)
areaScroll.setWidget(widget)
areaScroll.setFrameShape(QtWidgets.QFrame.NoFrame)
window.setCentralWidget(areaScroll)
window.setCentralWidget(areaScroll)'''
if (__name__ == "__main__"):
window.resize(int(window.frameGeometry().width() * 1.2), int(window.frameGeometry().height() * 1.1))

View File

@ -1694,8 +1694,7 @@ SetFont(app)
window.setCentralWidget(widget)
# 判断是否为小屏幕,是则设置滚动条并全屏
if (window.frameGeometry().width() > app.primaryScreen().availableGeometry().size().width() * 0.8 or
window.frameGeometry().height() > app.primaryScreen().availableGeometry().size().height() * 0.9 or
__name__ != "__main__"):
window.frameGeometry().height() > app.primaryScreen().availableGeometry().size().height() * 0.9):
# 设置滚动条
areaScroll = QtWidgets.QScrollArea(window)
areaScroll.setWidgetResizable(True)

0
deepin-wine-runner_512x512.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

0
geek.exe Normal file → Executable file
View File

0
globalenv.py Normal file → Executable file
View File

0
information.json Normal file → Executable file
View File

213
main.py Normal file → Executable file
View File

@ -1,41 +1,31 @@
#!/usr/bin/env python3
# 库的引用
import os
import PyQt5.QtWidgets as QtWidgets
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import importlib
import os
import sys
import json
import welcome
import subprocess
import WindowModule
class RunnerWindow:
programPath = os.path.split(os.path.realpath(__file__))[0] # 获取当前程序目录
import globalenv
recycleTime = 0
def __init__(self, app: QtWidgets.QApplication, moduleName: str) -> None:
self.globalenv._init() # globalenv 的 init 是必须的,这样才能正确的 import Wine 运行器的窗口
self.globalenv.set_value("app", app) # 用于将该部分的 app 给子模块的 Qt 控件调用以解决 UI 异常以及其它问题
# 因为 Python 有不允许重复 import 的特性从而导致多次返回的控件实际指向同一对象,所以要通过特殊的方式绕过这一限制
# 将使用指向程序所在文件夹的超链接以改变库名称从而实现每次引入时命名控件不同
# 通过嵌套多个 local.local.local 以解决问题
# 同理可以利用该特性使用 globalenv 传值
if (not os.path.exists(f"{self.programPath}/local")):
# 没有存在该超链接,不启用该机制
self.globalenv.set_value("app", app)
self.mainwindow = __import__(moduleName, fromlist=["mainwindow"])
return
while True:
self.recycleTime += 1
testModuleName = "local." * self.recycleTime + moduleName
if (not testModuleName in sys.modules):
self.mainwindow = __import__(testModuleName, fromlist=["mainwindow"]) # 设置 fromlist 就不会返回最上层节点,及 local
break
def Win(self) -> QtWidgets.QMainWindow:
# 输出窗口
return self.mainwindow.window
# 读取文本文档
def readtxt(path):
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
def ProgramVersion():
information = json.loads(readtxt(f"{programPath}/information.json"))
return information["Version"]
# 创建界面
class Window(QtWidgets.QWidget):
moduleMapList = {}
def __init__(self):
super().__init__()
self.counter_a = 1
@ -46,7 +36,7 @@ class Window(QtWidgets.QWidget):
def initUI(self):
self.setMinimumSize(800, 600)
self.setWindowTitle("增减测试")
self.setWindowTitle("Wine 运行器 {}".format(ProgramVersion()))
self.mainLayout = QtWidgets.QHBoxLayout()
self.setLayout(self.mainLayout)
@ -54,91 +44,163 @@ class Window(QtWidgets.QWidget):
self.leftWidget = LeftWidget()
self.mainLayout.addWidget(self.leftWidget)
self.leftWidget.btn1.clicked.connect(self.addA)
self.leftWidget.btn2.clicked.connect(self.addB)
self.leftWidget.btn3.clicked.connect(self.addC)
self.leftWidget.btn4.clicked.connect(self.delCurrent)
time = 0
for i in WindowModule.moduleNameList.keys():
self.moduleMapList[self.leftWidget.actionList[i].text()] = [i, WindowModule.moduleNameList[i]["Name"]]
self.leftWidget.actionList[i].triggered.connect(lambda: self.add(self.sender().text()))
#self.leftWidget.btn4.clicked.connect(self.delCurrent)
self.leftWidget.list1.itemClicked.connect(self.switchWidget)
# 右侧区域
self.rightWidget = RightWidget()
self.mainLayout.addWidget(self.rightWidget)
# 新增a类界面
def addA(self):
self.newTab = "a类页面#{0}".format(self.counter_a)
self.addWelcome()
# 判断运行器是否为第一次打开,如果不是则默认切换至 Wine 运行器主窗口
# 默认为列表里的第一个控件
if (os.path.exists(get_home() + "/.config/deepin-wine-runner")):
self.add(self.leftWidget.actionList[list(WindowModule.moduleNameList.keys())[0]].text())
self.ConfigureConfigFile()
# 新增欢迎界面
def addWelcome(self):
self.newTab = "欢迎页面"
self.leftWidget.list1.addItem(self.newTab)
self.newWidget = welcome.WinWelcome()
self.widgetList.append(self.newWidget)
self.rightWidget.addWidget(self.newWidget)
# 新增界面
def add(self, actionName: str):
self.newInfo = "{}#{}".format(self.moduleMapList[actionName][1], self.counter_a)
self.newTab = ItemWidget(self.newInfo)
self.newTab.btn.clicked.connect(self.delCurrent)
self.counter_a += 1
self.leftWidget.list1.addItem(self.newTab)
self.leftWidget.list1.setItemWidget(self.newTab, self.newTab.widget)
self.newWidget = RunnerWindow(app, "mainwindow").Win()
print(self.newWidget)
self.newWidget = WindowModule.RunnerWindow(app, self.moduleMapList[actionName][0]).Win()
self.widgetList.append(self.newWidget)
self.rightWidget.addWidget(self.newWidget)
# 新增b类界面
def addB(self):
self.newTab = "b类页面#{0}".format(self.counter_b)
self.counter_b += 1
self.leftWidget.list1.addItem(self.newTab)
# 自动切换新打开的页面
self.leftWidget.list1.setCurrentRow(self.leftWidget.list1.model().rowCount() - 1) # 设置选择最后一项
self.switchWidget()
self.newWidget = RunnerWindow(app, "deepin-wine-packager").Win()
self.widgetList.append(self.newWidget)
self.rightWidget.addWidget(self.newWidget)
# 新增c类界面
def addC(self):
self.newTab = "c类页面#{0}".format(self.counter_c)
self.counter_c += 1
self.leftWidget.list1.addItem(self.newTab)
self.newWidget = RunnerWindow(app, "VM.mainwindow").Win()
self.widgetList.append(self.newWidget)
self.rightWidget.addWidget(self.newWidget)
# 删除_本页面
def delCurrent(self):
self.length = self.leftWidget.list1.count()
print(self.length)
self.row = self.leftWidget.list1.currentRow()
print(self.row)
if self.row == 0:
return 0
self.leftWidget.list1.takeItem(self.row)
self.rightWidget.removeWidget(self.widgetList[self.row])
self.widgetList.pop(self.row)
# 将新界面的关闭按钮设为可用
if self.row == self.length - 1:
if self.row == 1:
return 0
else:
self.leftWidget.list1.item(self.row - 1).btnEnable()
else:
self.leftWidget.list1.item(self.row).btnEnable()
# 切换页面
def switchWidget(self):
self.row = self.leftWidget.list1.currentRow()
self.rightWidget.setCurrentIndex(self.row)
# 将当前页的关闭按钮设为可用
for i in range(self.leftWidget.list1.count()):
if i == 0:
continue
else:
self.leftWidget.list1.item(i).btnDisable()
if self.row != 0:
self.leftWidget.list1.currentItem().btnEnable()
def ConfigureConfigFile(self):
if not os.path.exists(get_home() + "/.config/"): # 如果没有配置文件夹
os.mkdir(get_home() + "/.config/") # 创建配置文件夹
if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹
os.mkdir(get_home() + "/.config/deepin-wine-runner") # 创建配置文件夹
# 左侧区域
class LeftWidget(QtWidgets.QWidget):
actionList = {}
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setFixedWidth(100)
self.setFixedWidth(120)
self.mainLayout = QtWidgets.QVBoxLayout()
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.mainLayout)
# 左侧标题
self.lab1 = QtWidgets.QLabel("页面导航区")
self.lab1 = QtWidgets.QLabel("<h3>页面导航区</h3>")
self.mainLayout.addWidget(self.lab1)
# 新建页面面按钮
self.btnAdd = QtWidgets.QPushButton("新建界面")
self.mainLayout.addWidget(self.btnAdd)
self.menuAdd = QtWidgets.QMenu()
self.btnAdd.setMenu(self.menuAdd)
for i in WindowModule.moduleNameList.keys():
action = QtWidgets.QAction("新建{}".format(WindowModule.moduleNameList[i]["Name"]))
self.actionList[i] = action
self.menuAdd.addAction(action)
# 左侧页面列表
self.list1 = QtWidgets.QListWidget()
self.mainLayout.addWidget(self.list1)
# 新增a类按钮
self.btn1 = QtWidgets.QPushButton("新增a类界面")
self.mainLayout.addWidget(self.btn1)
# 新增b类按钮
self.btn2 = QtWidgets.QPushButton("新增b类界面")
self.mainLayout.addWidget(self.btn2)
# 新增c类按钮
self.btn3 = QtWidgets.QPushButton("新增c类界面")
self.mainLayout.addWidget(self.btn3)
# 删_页面按钮
self.btn4 = QtWidgets.QPushButton("删除_本页面")
self.mainLayout.addWidget(self.btn4)
self.archLabel = QtWidgets.QLabel("系统架构:{}".format(subprocess.getoutput("dpkg --print-architecture")))
self.mainLayout.addWidget(self.archLabel)
# 列表项目组件
class ItemWidget(QtWidgets.QListWidgetItem):
def __init__(self, info):
super().__init__()
self.info = info
self.initUI()
def initUI(self):
self.widget = QtWidgets.QWidget()
self.mainLayout = QtWidgets.QHBoxLayout()
self.mainLayout.setContentsMargins(2, 0, 0, 0)
self.widget.setLayout(self.mainLayout)
# 文字标签
self.lab = QtWidgets.QLabel(self.info)
self.mainLayout.addWidget(self.lab)
self.mainLayout.addStretch()
# 关闭按钮
self.btn = QtWidgets.QPushButton("x")
#self.btn.setMaximumWidth(20)
self.btn.setEnabled(False)
self.mainLayout.addWidget(self.btn)
# 将按钮设为可用
def btnEnable(self):
self.btn.setEnabled(True)
# 将按钮设为不可用
def btnDisable(self):
self.btn.setEnabled(False)
# 右侧区域
class RightWidget(QtWidgets.QStackedWidget):
@ -148,9 +210,18 @@ class RightWidget(QtWidgets.QStackedWidget):
#def initUI(self):
# 获取用户主目录
def get_home():
return os.path.expanduser('~')
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
# 运行程序
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
mainWindow = Window()
mainWindow.setWindowIcon(QtGui.QIcon(iconPath))
mainWindow.show()
mainWindow.resize(int(mainWindow.geometry().width() * 1.2), int(mainWindow.geometry().height() * 1.2))
sys.exit(app.exec())

View File

@ -21,4 +21,4 @@ if [[ $DISPLAY == "" ]] && [[ $WAYLAND_DISPLAY == "" ]] && [[ -f /data/data/com.
fi
$CURRENT_DIR/VM/novnc/utils/novnc_proxy --vnc localhost:5905 $noVNCOption &
fi
python3 $CURRENT_DIR/mainwindow.py
python3 $CURRENT_DIR/main.py

View File

@ -3360,8 +3360,7 @@ window.setCentralWidget(widget)
# 判断是否为小屏幕,是则设置滚动条并全屏
# 获取为 import 为控件,也默认开启滚动条
if (window.frameGeometry().width() > app.primaryScreen().availableGeometry().size().width() * 0.8 or
window.frameGeometry().height() > app.primaryScreen().availableGeometry().size().height() * 0.9 or
__name__ != "__main__"):
window.frameGeometry().height() > app.primaryScreen().availableGeometry().size().height() * 0.9):
# 设置滚动条
areaScroll = QtWidgets.QScrollArea(window)
areaScroll.setWidgetResizable(True)

0
test.py Normal file → Executable file
View File

0
vkd3d-proton.7z Normal file → Executable file
View File

38
welcome.py Executable file
View File

@ -0,0 +1,38 @@
# 库的引用
import PyQt5.QtWidgets as QtWidgets
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import sys
# 创建界面
class WinWelcome(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.mainLayout = QtWidgets.QVBoxLayout()
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.mainLayout)
# 标签1
self.lab1 = QtWidgets.QLabel("<h3>欢迎使用Wine运行器</h3>")
self.mainLayout.addWidget(self.lab1)
# 文本栏
self.txt = QtWidgets.QTextBrowser()
self.introduction = "Wine运行器\n用于运行一般的Windows程序及安装包exe、msi文件\n\nWine打包器\n将特定的Windows程序打包为deb格式以便存储或分享\n\n虚拟机\n可用于运行无法通过Wine运行的程序或在龙架构上运行x86程序\n请注意,虚拟机可解决兼容性问题,但性能开销较大"
self.txt.setText(self.introduction)
self.mainLayout.addWidget(self.txt)
# 标签2
self.lab2 = QtWidgets.QLabel("请根据您的需求,在左侧打开相应页面")
self.mainLayout.addWidget(self.lab2)
# 测试界面
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
winWelcome = WinWelcome()
winWelcome.show()
sys.exit(app.exec())

0
wineautobuild-action-7z-aarch64-daily.sh Normal file → Executable file
View File

0
wineautobuild-action-7z-aarch64.sh Normal file → Executable file
View File

0
wineautobuild-action-7z-daily.sh Normal file → Executable file
View File

0
wineautobuild-action-7z-wow64-daily.sh Normal file → Executable file
View File

0
wineautobuild-action-7z-wow64.sh Normal file → Executable file
View File

0
wineautobuild-action-7z.sh Normal file → Executable file
View File

0
wineautobuild-action-debian9.sh Normal file → Executable file
View File

0
wineautobuild-action.sh Normal file → Executable file
View File

0
winelist.json Normal file → Executable file
View File

0
其他Windows无法正常创建虚拟机的问题 Normal file → Executable file
View File