mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2026-05-14 01:50:19 +08:00
虚拟机模块支持import
This commit is contained in:
@@ -1,10 +1,14 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||||
|
sys.path.append(f"{programPath}/../")
|
||||||
|
sys.path.append(f"{programPath}/")
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
import program_resources
|
import program_resources
|
||||||
import ui_mainwindow
|
import ui_mainwindow
|
||||||
|
import globalenv
|
||||||
from buildvbox import *
|
from buildvbox import *
|
||||||
from PyQt5.QtGui import *
|
from PyQt5.QtGui import *
|
||||||
from PyQt5.QtCore import *
|
from PyQt5.QtCore import *
|
||||||
@@ -19,7 +23,10 @@ def ShowCPUMessage():
|
|||||||
|
|
||||||
def MainWindow():
|
def MainWindow():
|
||||||
global cpuGet
|
global cpuGet
|
||||||
|
if (__name__ == "__main__"):
|
||||||
ui.tabWidget.setTabPosition(QTabWidget.West) # 标签靠左
|
ui.tabWidget.setTabPosition(QTabWidget.West) # 标签靠左
|
||||||
|
else:
|
||||||
|
ui.tabWidget.setTabPosition(QTabWidget.East) # 标签靠左
|
||||||
#QApplication a(argc, argv)
|
#QApplication a(argc, argv)
|
||||||
# 选择最优虚拟机
|
# 选择最优虚拟机
|
||||||
if(not os.system("which qemu-system-x86_64")):
|
if(not os.system("which qemu-system-x86_64")):
|
||||||
@@ -291,7 +298,10 @@ def on_getDCLC_triggered():
|
|||||||
|
|
||||||
|
|
||||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||||
|
if (__name__ == "__main__"):
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
else:
|
||||||
|
app = globalenv.get_value("app")
|
||||||
this = window = QMainWindow()
|
this = window = QMainWindow()
|
||||||
ui = ui_mainwindow.Ui_MainWindow()
|
ui = ui_mainwindow.Ui_MainWindow()
|
||||||
ui.setupUi(window)
|
ui.setupUi(window)
|
||||||
|
|||||||
5
test.py
5
test.py
@@ -12,7 +12,8 @@ globalenv.set_value("app", app) # 用于将该部分的 app 给子模块的 Qt
|
|||||||
#modules = __import__("deepin-wine-easy-packager")
|
#modules = __import__("deepin-wine-easy-packager")
|
||||||
#import mainwindow
|
#import mainwindow
|
||||||
# 使用 __import__ 可以引入带 - 文件名的模块
|
# 使用 __import__ 可以引入带 - 文件名的模块
|
||||||
import wine.installwine
|
#import wine.installwine
|
||||||
window.setCentralWidget(wine.installwine.window)
|
import VM.mainwindow
|
||||||
|
window.setCentralWidget(VM.mainwindow.window)
|
||||||
window.show()
|
window.show()
|
||||||
app.exec_()
|
app.exec_()
|
||||||
Reference in New Issue
Block a user