diff --git a/VM/VirtualMachine.pro b/VM/VirtualMachine.pro
new file mode 100644
index 0000000..f7d847f
--- /dev/null
+++ b/VM/VirtualMachine.pro
@@ -0,0 +1,44 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2022-07-12T13:39:19
+#
+#-------------------------------------------------
+
+QT += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = VirtualMachine
+TEMPLATE = app
+QT += network
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which has been marked as deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+CONFIG += c++11
+
+SOURCES += \
+ main.cpp \
+ mainwindow.cpp
+
+HEADERS += \
+ mainwindow.h
+
+FORMS += \
+ mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+RESOURCES += \
+ 图标.qrc
diff --git a/VM/VirtualMachine.pro.user b/VM/VirtualMachine.pro.user
new file mode 100644
index 0000000..56949d6
--- /dev/null
+++ b/VM/VirtualMachine.pro.user
@@ -0,0 +1,327 @@
+
+
+
+
+
+ EnvironmentId
+ {f2c8d716-7409-4b6a-a949-e01d13120d3a}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ 桌面
+ 桌面
+ {c19ffccf-bd9e-4c0f-b3ec-050420072cca}
+ 0
+ 0
+ 0
+
+ /home/gfdgd_xi/build-VirtualMachine-unknown-Debug
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+ true
+
+
+ /home/gfdgd_xi/build-VirtualMachine-unknown-Release
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+
+ /home/gfdgd_xi/build-VirtualMachine-unknown-Profile
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+ 3
+
+
+ 0
+ 部署
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy Configuration
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ VirtualMachine
+ VirtualMachine2
+ Qt4ProjectManager.Qt4RunConfiguration:/home/gfdgd_xi/Desktop/deep-wine-runner/VM/VirtualMachine.pro
+ VirtualMachine.pro
+
+ 3768
+ false
+ true
+ true
+ false
+ false
+ true
+ true
+
+ /home/gfdgd_xi/build-VirtualMachine-unknown-Debug
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 20
+
+
+ Version
+ 20
+
+
diff --git a/VM/Windows7X64Auto.iso b/VM/Windows7X64Auto.iso
new file mode 100755
index 0000000..d65f3f6
Binary files /dev/null and b/VM/Windows7X64Auto.iso differ
diff --git a/VM/Windows7X86Auto.iso b/VM/Windows7X86Auto.iso
new file mode 100755
index 0000000..afea6b2
Binary files /dev/null and b/VM/Windows7X86Auto.iso differ
diff --git a/VM/[--verbose b/VM/[--verbose
new file mode 100644
index 0000000..e69de29
diff --git a/VM/[common-opts] b/VM/[common-opts]
new file mode 100644
index 0000000..e69de29
diff --git a/VM/] b/VM/]
new file mode 100644
index 0000000..e69de29
diff --git a/VM/api/__init__.py b/VM/api/__init__.py
new file mode 100644
index 0000000..d8ca3f9
--- /dev/null
+++ b/VM/api/__init__.py
@@ -0,0 +1,112 @@
+################################################
+# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢
+# 版本:1.0
+# 依照 GPL V3 协议开源
+################################################
+# 参考文献:
+# https://juejin.cn/post/7080484519328874510
+################################################
+import os
+import subprocess
+
+homePath = os.path.expanduser('~')
+programPath = os.path.split(os.path.realpath(__file__))[0]
+
+class File:
+ def __init__(self, path) -> None:
+ self.path = path
+
+ def getFileFolderSize(self):
+ """get size for file or folder"""
+ totalSize = 0
+ if not os.path.exists(self.path):
+ return totalSize
+ if os.path.isfile(self.path):
+ totalSize = os.path.getsize(self.path) # 5041481
+ return totalSize
+ if os.path.isdir(self.path):
+ with os.scandir(self.path) as dirEntryList:
+ for curSubEntry in dirEntryList:
+ curSubEntryFullPath = os.path.join(self.path, curSubEntry.name)
+ if curSubEntry.is_dir():
+ curSubFolderSize = self.path(curSubEntryFullPath) # 5800007
+ totalSize += curSubFolderSize
+ elif curSubEntry.is_file():
+ curSubFileSize = os.path.getsize(curSubEntryFullPath) # 1891
+ totalSize += curSubFileSize
+ return totalSize
+
+class Manager:
+ def __init__(self, name: str, managerPath: str="VBoxManage") -> None:
+ self.name = name
+ self.managerPath = managerPath
+ self.vboxVersion = subprocess.getoutput(f"\"{self.managerPath}\" -v")
+
+ def Create(self, type: str="Windows7") -> None:
+ os.system(f"\"{self.managerPath}\" createvm --name \"{self.name}\" --ostype \"{type}\" --register")
+
+ def CreateDisk(self, path: str, size: int) -> None:
+ os.system(f"\"{self.managerPath}\" createvdi --filename \"{path}\" --size \"{size}\"")
+
+ def CreateDiskControl(self, controlName: str="storage_controller_1") -> None:
+ os.system(f"\"{self.managerPath}\" storagectl \"{self.name}\" --name \"{controlName}\" --add ide")
+
+ def MountDisk(self, diskPath: str, controlName: str="storage_controller_1", port: int=0, device: int=0) -> None:
+ os.system(f"\"{self.managerPath}\" storageattach \"{self.name}\" --storagectl \"{controlName}\" --type hdd --port {port} --device {device} --medium \"{diskPath}\"")
+
+ def MountISO(self, isoPath: str, controlName: str="storage_controller_1", port: int=1, device: int=0) -> None:
+ os.system(f"\"{self.managerPath}\" storageattach \"{self.name}\" --storagectl \"{controlName}\" --type dvddrive --port {port} --device {device} --medium \"{isoPath}\"")
+
+ def BootFirst(self, bootDrive: str) -> None:
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --boot1 {bootDrive}")
+
+ def SetNetBridge(self, netDriver: str) -> None:
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --nic1 bridged --cableconnected1 on --nictype1 82540EM --bridgeadapter1 \"{netDriver}\" --intnet1 brigh1 --macaddress1 auto")
+ #os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --nic1 hostif")
+ pass
+
+ def SetCPU(self, number: int) -> None:
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --cpus {number}")
+
+ def SetMemory(self, memory: int) -> None:
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --memory {memory}")
+
+ def SetRemote(self, setting: bool) -> None:
+ if setting:
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrde on")
+ return
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrde off")
+
+ def SetRemoteConnectSetting(self, port: int=5540) -> None:
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrdeport {port} --vrdeaddress """)
+
+ def Start(self, unShown: bool = False) -> None:
+ if unShown:
+ os.system(f"\"{self.managerPath}\" startvm \"{self.name}\" -type headless")
+ return
+ os.system(f"\"{self.managerPath}\" startvm \"{self.name}\"")
+
+ def Stop(self) -> None:
+ os.system(f"\"{self.managerPath}\" controlvm \"{self.name}\" poweroff")
+
+ def Delete(self) -> None:
+ os.system(f"\"{self.managerPath}\" unregistervm --delete \"{self.name}\"")
+
+ def SetDisplayMemory(self, memory: int) -> None:
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vram {memory}")
+
+ def InstallGuessAdditions(self, controlName: str="storage_controller_1", port: int=1, device: int=0) -> None:
+ self.MountISO("/usr/share/virtualbox/VBoxGuestAdditions.iso", controlName, port, device)
+
+ def EnabledAudio(self) -> None:
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --audio pulse --audiocontroller hda --audioin on --audioout on")
+ #os.system("")
+
+ def EnabledClipboardMode(self):
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --clipboard-mode bidirectional")
+
+ def EnabledDraganddrop(self):
+ os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --draganddrop bidirectional")
+
+ def ShareFile(self, name, path):
+ os.system(f"\"{self.managerPath}\" sharedfolder add \"{self.name}\" -name \"{name}\" -hostpath \"{path}\"")
\ No newline at end of file
diff --git a/VM/api/__pycache__/__init__.cpython-37.pyc b/VM/api/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000..777dda9
Binary files /dev/null and b/VM/api/__pycache__/__init__.cpython-37.pyc differ
diff --git a/VM/global b/VM/global
new file mode 100644
index 0000000..e69de29
diff --git a/VM/host: b/VM/host:
new file mode 100644
index 0000000..e69de29
diff --git a/VM/icon.png b/VM/icon.png
new file mode 100755
index 0000000..b164d46
Binary files /dev/null and b/VM/icon.png differ
diff --git a/VM/main.cpp b/VM/main.cpp
new file mode 100644
index 0000000..b48f94e
--- /dev/null
+++ b/VM/main.cpp
@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+#include
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/VM/mainwindow.cpp b/VM/mainwindow.cpp
new file mode 100644
index 0000000..2ccfe04
--- /dev/null
+++ b/VM/mainwindow.cpp
@@ -0,0 +1,38 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include
+#include
+#include
+#include
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+ ui->tabWidget->setTabPosition(QTabWidget::West); // 标签靠左
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::on_browser_clicked()
+{
+ // 浏览镜像文件
+ QString filePath = QFileDialog::getOpenFileName(this, "选择 ISO 文件", "~", "ISO 镜像文件(*.iso);;所有文件(*.*)");
+ if(filePath != ""){
+ ui->isoPath->setText(filePath);
+ }
+}
+
+void MainWindow::on_install_clicked()
+{
+ QProcess progress;
+ QStringList list;
+ list << ui->isoPath->text() << QString::number(ui->systemVersion->currentIndex());
+ qDebug() << QCoreApplication::applicationDirPath() + QString("/run.py");
+ progress.startDetached(QCoreApplication::applicationDirPath() + QString("/run.py"), list);
+ ui->tabWidget->setCurrentIndex(1);
+}
diff --git a/VM/mainwindow.h b/VM/mainwindow.h
new file mode 100644
index 0000000..f72d399
--- /dev/null
+++ b/VM/mainwindow.h
@@ -0,0 +1,27 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(QWidget *parent = nullptr);
+ ~MainWindow();
+
+private slots:
+ void on_browser_clicked();
+
+ void on_install_clicked();
+
+private:
+ Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H
diff --git a/VM/mainwindow.ui b/VM/mainwindow.ui
new file mode 100644
index 0000000..203dfcc
--- /dev/null
+++ b/VM/mainwindow.ui
@@ -0,0 +1,291 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 807
+ 429
+
+
+
+ MainWindow
+
+
+
+ -
+
+
+ QTabWidget::Rounded
+
+
+ 0
+
+
+
+ 设置
+
+
+ 设置
+
+
+
-
+
+
-
+
+
+ 镜像路径:
+
+
+
+ -
+
+
+ 请选择系统镜像
+
+
+
+ -
+
+
+ 浏览……
+
+
+
+
+
+ -
+
+
-
+
+
+ 系统版本:
+
+
+
+ -
+
+
+
+
+
+ 请选择系统类型(如果识别不了请自行选择,如果选择错误或不支持将无法进行自动安装)
+
+
-
+
+ Windows 7 32 位(支持自动安装)
+
+
+ -
+
+ Windows 7 64 位(支持自动安装)
+
+
+ -
+
+ 其它 Windows 系统(不支持自动安装)
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ 安装
+
+
+
+
+
+ -
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Noto Sans CJK SC'; font-size:10.5pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">使用迅雷或者网盘下载以下任意一个链接然后在上面选择即可:</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">(如果下载这个,系统版本选第一项,一般推荐这个)ed2k://|file|cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso|2653276160|7503E4B9B8738DFCB95872445C72AEFB|/</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">(如果下载这个,系统版本选第二项)ed2k://|file|cn_windows_7_ultimate_with_sp1_x64_dvd_u_677408.iso|3420557312|B58548681854236C7939003B583A8078|/</span></p>
+<hr /></body></html>
+
+
+
+
+
+
+
+ 安装/使用帮助
+
+
+ -
+
+
+ false
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Noto Sans CJK SC'; font-size:10.5pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:26pt; font-weight:600;">给小白的一段话</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">其实本质上跑完安装程序就没有然后了,顶多如果想要运行舒服一点点,可以安装加强功能,直接拉到最底下看就可以了</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">如果爱折腾的话,下面的都看看也无所谓的</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(如果鼠标被锁定到里面了按下键盘右边的“Ctrl”键就可以了)</p>
+<hr />
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:26pt; font-weight:600;">安装是否需要人工进行操作?</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">如果您下载的镜像本程序支持,则大部分不用,已经尽量省去了让新手头疼的虚拟机程序安装,创建、设置虚拟机,虚拟磁盘分区,寻找原版镜像文件等内容</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712191756.png" /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">但有些设置依旧需要人工自行设置,例如安装界面密钥的输入、系统的激活(涉及版权问题,不会考虑省略)、增强功能的安装、需要使用的软件等等</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712192850.png" /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712193527.png" /></p>
+<hr />
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:26pt; font-weight:600;">什么样的镜像本程序不支持?</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">1、过老的镜像,如 Windows XP、Windows Server 2003 等等,将完全无法自动安装,需要手动安装</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">2、非 Windows 7 安装镜像</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">3、Windows 7 企业版镜像</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">4、选择了错误的 Windows 7 位数的镜像,部分/全部无法自动处理安装</p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
+<hr />
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:26pt; font-weight:600;">如何安装加强功能?</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">1、点击“设备”=》“加强功能”</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图_VirtualBox Machine_20220712142929.png" /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">2、打开“计算机”,找到名为“VirtualBox Guest Additions”的光盘,双击进入,然后双击打开名为“VBoxWindowsAdditions”的程序</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712143006.png" /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">3、在弹出的界面点击“是”</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712143018.png" /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">4、一直点“Next”</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712143029.png" /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712143037.png" /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">5、全部选择,然后点击“Install”进行安装</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712143044.png" /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">6、等待安装完毕后,选择“Reboot now”然后点击“Finish”重启此虚拟机即可安装成功(选择“Reboot now”并点“Finish”会自动重新启动)</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712143103.png" /></p></body></html>
+
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+ 关于
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 200
+ 313
+
+
+
+
+ 200
+ 313
+
+
+
+ border-image: url(:/icon.png);
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Noto Sans CJK SC'; font-size:10.5pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">此为 wine 运行器附属组件,基于 C++ Qt、Python 和 Virtualbox 制作,通过运行安装 Windows 操作系统的虚拟机实现在 Linux 运行 Windows exe 程序的功能。</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">基于 GPL V3 协议开源</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">项目地址:</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Gitee:<a href="https://gitee.com/gfdgd-xi/deep-wine-runner"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">https://gitee.com/gfdgd-xi/deep-wine-runner</span></a></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Github:<a href="https://github.com/gfdgd-xi/deep-wine-runner"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">https://github.com/gfdgd-xi/deep-wine-runner</span></a></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Gitlink:<a href="https://gitlink.org.cn/gfdgd_xi/deep-wine-runner"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">https://gitlink.org.cn/gfdgd_xi/deep-wine-runner</span></a></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">该组件制作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢</p>
+<hr />
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">参考文献:</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Droid Sans Mono','monospace','monospace'; font-size:11pt; color:#6a9955;">https://juejin.cn/post/7080484519328874510</span></p></body></html>
+
+
+
+
+
+
+
+
+
+
+
+ 退出
+
+
+
+
+ 关于
+
+
+
+
+
+
+
diff --git a/VM/run.py b/VM/run.py
new file mode 100755
index 0000000..f6c4390
--- /dev/null
+++ b/VM/run.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python3
+import os
+import api
+import sys
+import psutil
+
+if __name__ == "__main__":
+ programPath = os.path.split(os.path.realpath(__file__))[0]
+ if len(sys.argv) < 3 :
+ print("参数不齐!")
+ exit()
+ net = ""
+ for k, v in psutil.net_if_addrs().items():
+ for item in v:
+ if item[0] == 2 and not item[1] == "127.0.0.1" and not item[1] == "192.168.250.1":
+ net = k
+ break
+ if net == "":
+ exit()
+ # 创建一个叫Windows的虚拟机
+ vm = api.Manager("Windows")
+ if sys.argv[2] == "0":
+ vm.Create("Windows7")
+ elif sys.argv[2] == "1":
+ vm.Create("Windows7_64")
+ else:
+ vm.Create("WindowsNT_64")
+ vm.CreateDisk(f"{api.homePath}/VirtualBox VMs/Windows/Windows.vdi", 131072)
+ vm.CreateDiskControl()
+ vm.MountDisk(f"{api.homePath}/VirtualBox VMs/Windows/Windows.vdi")
+ vm.MountISO(sys.argv[1])
+ if sys.argv[2] == "0":
+ vm.MountISO(f"{programPath}/Windows7X86Auto.iso", device=1)
+ elif sys.argv[2] == "1":
+ vm.MountISO(f"{programPath}/Windows7X64Auto.iso", device=1)
+ vm.SetCPU(2)
+ vm.SetMemory(psutil.virtual_memory().total // 1024 // 1024 // 3)
+ vm.SetDisplayMemory(32)
+ vm.SetNetBridge(net)
+ vm.EnabledAudio()
+ vm.EnabledClipboardMode()
+ vm.EnabledDraganddrop()
+ vm.ShareFile("ROOT", "/")
+ vm.ShareFile("HOME", api.homePath)
+ vm.Start()
\ No newline at end of file
diff --git a/VM/win7.xml b/VM/win7.xml
new file mode 100755
index 0000000..05dece3
--- /dev/null
+++ b/VM/win7.xml
@@ -0,0 +1,144 @@
+
+
+
+ win7
+ 721bf798-852e-4e2c-bfa7-c151037433b7
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VM/图标.qrc b/VM/图标.qrc
new file mode 100644
index 0000000..635d601
--- /dev/null
+++ b/VM/图标.qrc
@@ -0,0 +1,17 @@
+
+
+ icon.png
+
+
+ 截图_VirtualBox Machine_20220712142929.png
+ 截图/截图_VirtualBox Machine_20220712143103.png
+ 截图/截图_VirtualBox Machine_20220712143044.png
+ 截图/截图_VirtualBox Machine_20220712143037.png
+ 截图/截图_VirtualBox Machine_20220712143029.png
+ 截图/截图_VirtualBox Machine_20220712143018.png
+ 截图/截图_VirtualBox Machine_20220712143006.png
+ 截图/截图_VirtualBox Machine_20220712191756.png
+ 截图/截图_VirtualBox Machine_20220712192850.png
+ 截图/截图_VirtualBox Machine_20220712193527.png
+
+
diff --git a/VM/截图/截图_VirtualBox Machine_20220712143006.png b/VM/截图/截图_VirtualBox Machine_20220712143006.png
new file mode 100644
index 0000000..ed31200
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712143006.png differ
diff --git a/VM/截图/截图_VirtualBox Machine_20220712143018.png b/VM/截图/截图_VirtualBox Machine_20220712143018.png
new file mode 100644
index 0000000..18b30cb
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712143018.png differ
diff --git a/VM/截图/截图_VirtualBox Machine_20220712143029.png b/VM/截图/截图_VirtualBox Machine_20220712143029.png
new file mode 100644
index 0000000..ec4606e
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712143029.png differ
diff --git a/VM/截图/截图_VirtualBox Machine_20220712143037.png b/VM/截图/截图_VirtualBox Machine_20220712143037.png
new file mode 100644
index 0000000..470068f
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712143037.png differ
diff --git a/VM/截图/截图_VirtualBox Machine_20220712143044.png b/VM/截图/截图_VirtualBox Machine_20220712143044.png
new file mode 100644
index 0000000..ea50f1a
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712143044.png differ
diff --git a/VM/截图/截图_VirtualBox Machine_20220712143103.png b/VM/截图/截图_VirtualBox Machine_20220712143103.png
new file mode 100644
index 0000000..6ac7d21
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712143103.png differ
diff --git a/VM/截图/截图_VirtualBox Machine_20220712191756.png b/VM/截图/截图_VirtualBox Machine_20220712191756.png
new file mode 100644
index 0000000..9e6e842
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712191756.png differ
diff --git a/VM/截图/截图_VirtualBox Machine_20220712192850.png b/VM/截图/截图_VirtualBox Machine_20220712192850.png
new file mode 100644
index 0000000..15209d0
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712192850.png differ
diff --git a/VM/截图/截图_VirtualBox Machine_20220712193527.png b/VM/截图/截图_VirtualBox Machine_20220712193527.png
new file mode 100644
index 0000000..3673a91
Binary files /dev/null and b/VM/截图/截图_VirtualBox Machine_20220712193527.png differ
diff --git a/VM/截图_VirtualBox Machine_20220712142929.png b/VM/截图_VirtualBox Machine_20220712142929.png
new file mode 100644
index 0000000..4daf8ac
Binary files /dev/null and b/VM/截图_VirtualBox Machine_20220712142929.png differ
diff --git a/deb/DEBIAN/postinst b/deb/DEBIAN/postinst
index 069e1a0..7d7fa58 100755
--- a/deb/DEBIAN/postinst
+++ b/deb/DEBIAN/postinst
@@ -1,6 +1,6 @@
# !/bin/sh
-python3 -m pip install --upgrade ttkthemes -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
-python3 -m pip install --upgrade ttkbootstrap -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
-python3 -m pip install --upgrade easygui -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
+python3 -m pip install --upgrade ttkthemes --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple
+python3 -m pip install --upgrade ttkbootstrap --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple
+python3 -m pip install --upgrade easygui --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple
# 向服务器返回安装数加1(不显示内容且忽略错误)
-curl http://120.25.153.144/spark-deepin-wine-runner/Install.php?Version=1.6.0 -s > /dev/null | true
+curl http://120.25.153.144/spark-deepin-wine-runner/Install.php?Version=1.6.1 -s > /dev/null | true
diff --git a/deepin-wine-packager.py b/deepin-wine-packager.py
index 0ac00b6..9d945f9 100755
--- a/deepin-wine-packager.py
+++ b/deepin-wine-packager.py
@@ -102,7 +102,8 @@ def make_deb_threading():
# 程序创建的 deb 构建临时文件夹目录树:
# /XXX
# ├── DEBIAN
- # │ └── control
+ # │ ├── control
+ # │ └── postrm
# └── opt
# └── apps
# └── XXX
diff --git a/information.json b/information.json
index 22d820a..f632a8b 100644
--- a/information.json
+++ b/information.json
@@ -1,11 +1,13 @@
{
- "Version": "1.6.0",
+ "Version": "1.6.1",
"Thank": [
"@a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301",
"@zhangs https://bbs.deepin.org/post/227948",
"@gtjmaster https://bbs.deepin.org/post/225509",
"@统信UCARE服务 https://mp.weixin.qq.com/s/iOdfNv6phc8F4inackFFTw",
"@星火应用商店 提供部分安装包的源以及本程序的下载地址",
+ "感谢 @delsin 和 @神末shenmo 在 deepin 论坛提供打包器打包的 deb 包自动删除容器的建议",
+ "感谢 @GershonWang 在 https://github.com/gfdgd-xi/deep-wine-runner/issues/1 提供窗口居中的建议",
"",
"可以从上面的各种解决方案更好的学习 Wine 生态适配,也可以看 deepin 论坛板块 https://bbs.deepin.org/module/detail/116 进行学习,最后也向各位有进行 Wine 生态适配的大佬进行由衷的更新!",
"如果上面有遗漏,请向我反馈补充"
diff --git a/main.py b/main.py
index 4553d7c..f2eadea 100755
--- a/main.py
+++ b/main.py
@@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢
-# 版本:1.6.0
-# 更新时间:2022年07月10日
+# 版本:1.6.1
+# 更新时间:2022年07月11日
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 的 tkinter 构建
###########################################################################################
@@ -475,6 +475,33 @@ def InstallWineFont():
def WineRunnerBugUpload():
threading.Thread(target=os.system, args=[programPath + "/deepin-wine-runner-update-bug"]).start()
+def GetScreenSize():
+ screenInformation = []
+ # 使用 xrandr 进行筛选
+ for i in subprocess.getoutput("xrandr").split('\n'):
+ if not " connected " in i: # 检测连接的显示器
+ continue
+ # 获取分辨率基本信息,如
+ # DisplayPort-0 connected 1600x900+1280+0 (normal left inverted right x axis y axis) 434mm x 236mm
+ # 先判断是否为主屏幕
+ main = False
+ if "primary" in i:
+ main = True
+ # 进行进一步筛选
+ i = i[i.index("connected"):].replace("connected", "").replace("primary", "")
+ # 进行初步筛选,如
+ # 1600x900+1280+0 (normal left inverted right x axis y axis) 434mm x 236mm
+ i = i[:i.index("(")].replace(" ", "")
+ # 筛选为 1600x900+0+0 进行最后数值的提取
+ screenInformation.append([
+ int(i[:i.index("x")]), # 获取宽度
+ int(i[i.index("x") + 1 :i.index("+")]), # 获取高度
+ int(i[i.index("+") + 1:].split('+')[0]), # 获取显示屏 X 坐标
+ int(i[i.index("+") + 1:].split('+')[1]), # 获取显示屏 Y 坐标
+ main # 是否为主屏幕
+ ])
+ return screenInformation # 返回结果
+
class UpdateWindow():
data = {}
def ShowWindow():
@@ -707,7 +734,8 @@ class ProgramSetting():
defultBotton = None
terminalOpen = None
wineOption = None
- wineBottonDifferent = None
+ #wineBottonDifferent = None
+ centerWindow = None
def ShowWindow():
message = tk.Toplevel()
ProgramSetting.wineBottonA = tk.StringVar()
@@ -732,12 +760,16 @@ class ProgramSetting():
ttk.Label(message, text="自定义 wine 参数:").grid(row=5, column=0)
ProgramSetting.wineOption = tk.StringVar()
ProgramSetting.wineOption.set(setting["WineOption"])
+ ProgramSetting.centerWindow = tk.IntVar()
+ ProgramSetting.centerWindow.set(setting["CenterWindow"])
+ ttk.Label(message, text="窗口居中设置:").grid(row=6, column=0)
+ ttk.Checkbutton(message, text="开启窗口在主显示器居中的选项", variable=ProgramSetting.centerWindow).grid(row=6, column=1)
#ttk.Label(message, text="容器创建规则:").grid(row=6, column=0)
#ProgramSetting.wineBottonDifferent = tk.IntVar()
#ProgramSetting.wineBottonDifferent.set(setting["WineBottonDifferent"])
- ttk.Checkbutton(message, text="为每一个可执行文件创建单独的容器(如果勾选的话,上面默认 Wine 容器选项将会指定这些产生的 Wine 容器默认存放目录)", variable=ProgramSetting.wineBottonDifferent)
+ #ttk.Checkbutton(message, text="为每一个可执行文件创建单独的容器(如果勾选的话,上面默认 Wine 容器选项将会指定这些产生的 Wine 容器默认存放目录)", variable=ProgramSetting.wineBottonDifferent)
ttk.Entry(message, width=40, textvariable=ProgramSetting.wineOption).grid(row=5, column=1, columnspan=2)
- ttk.Button(message, text="保存", command=ProgramSetting.Save).grid(row=6, column=0, columnspan=3, sticky=tk.E)
+ ttk.Button(message, text="保存", command=ProgramSetting.Save).grid(row=7, column=0, columnspan=3, sticky=tk.E)
# 设置
message.title(f"设置 wine 运行器 {version}")
# 显示
@@ -757,7 +789,8 @@ class ProgramSetting():
setting["DefultBotton"] = ProgramSetting.defultBotton.get()
setting["TerminalOpen"] = bool(ProgramSetting.terminalOpen.get())
setting["WineOption"] = ProgramSetting.wineOption.get()
- setting["WineBottonDifferent"] = bool(ProgramSetting.wineBottonDifferent.get())
+ #setting["WineBottonDifferent"] = bool(ProgramSetting.wineBottonDifferent.get())
+ setting["CenterWindow"] = bool(ProgramSetting.centerWindow.get())
try:
write_txt(get_home() + "/.config/deepin-wine-runner/WineSetting.json", json.dumps(setting))
except:
@@ -776,7 +809,8 @@ defultProgramList = {
"DefultBotton" : get_home() + "/.wine",
"TerminalOpen": False,
"WineOption": "",
- "WineBottonDifferent": False
+ "WineBottonDifferent": False,
+ "CenterWindow": False
}
if not os.path.exists(get_home() + "/.config/deepin-wine-runner"): # 如果没有配置文件夹
os.mkdir(get_home() + "/.config/deepin-wine-runner") # 创建配置文件夹
@@ -812,7 +846,7 @@ try:
isoPathFound = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json")).values())
setting = json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineSetting.json"))
change = False
- for i in ["Architecture", "Debug", "DefultWine", "DefultBotton", "TerminalOpen", "WineOption", "WineBottonDifferent"]:
+ for i in ["Architecture", "Debug", "DefultWine", "DefultBotton", "TerminalOpen", "WineOption", "WineBottonDifferent", "CenterWindow"]:
if not i in setting:
change = True
setting[i] = defultProgramList[i]
@@ -847,18 +881,13 @@ tips = '''提示:
exe路径\' 参数 \'
即可(单引号需要输入)
5、wine 容器如果没有指定,则会默认为 ~/.wine'''
-updateThingsString = '''※1、新增程序感谢、谢明以及程序的建议和问题反馈和内置更新程序
-※2、支持 winetricks 指定 Wine 打开
-※3、新增窗口透明工具,感谢@a2035274 和 @虚幻的早晨 在论坛的讨论
-※4、支持在指定容器、Wine 安装 MSXML
-※5、支持启用/关闭 opengl(感谢@zhangs 在论坛发帖)以及支持安装/卸载 winbind
-※6、添加云沙箱的网站链接快捷方式
-※7、支持从星火应用商店源安装 Windows 常见字体
-8、优化窗口布局以及默认显示位置
-9、支持打开指定容器、Wine 的资源管理器
+updateThingsString = '''※1、添加 @delsin 和 @神末shenmo 建议的 postrm 脚本
+2、将 pip 由阿里源改为华为源,提升下载速度
+3、优化多屏窗口居中问题,并设置居中选项为选开防止错误
+4、修复 1.6.0 程序无法保存设置的问题
'''
title = "wine 运行器 {}".format(version)
-updateTime = "2022年07月10日"
+updateTime = "2022年07月11日"
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
thankText = ""
for i in information["Thank"]:
@@ -994,6 +1023,7 @@ if len(sys.argv) > 1 and sys.argv[1]:
menu.configure(activebackground="dodgerblue")
programmenu.configure(activebackground="dodgerblue")
wineOption.configure(activebackground="dodgerblue")
+safeWebsize.configure(activebackground="dodgerblue")
help.configure(activebackground="dodgerblue")
e1['value'] = findExeHistory
e2['value'] = wineBottonHistory
@@ -1031,8 +1061,15 @@ o1.grid(row=2, column=1)
returnText.grid(row=6, column=0, columnspan=3)
# 启动窗口
window.pack(fill=tk.BOTH, expand = True)
-# 窗口居中
-win.update()
-win.geometry(f"{win.winfo_width()}x{win.winfo_height()}+{win.winfo_screenwidth() // 2 - win.winfo_width() // 2}+{win.winfo_screenheight() // 2 - win.winfo_height() // 2}")
+if setting["CenterWindow"]:
+ try:
+ # 窗口居中(如果设置开启)
+ win.update()
+ # 获取主显示器分辨率
+ for i in GetScreenSize():
+ if i[4]:
+ win.geometry(f"{win.winfo_width()}x{win.winfo_height()}+{i[2] + (i[0] // 2 - win.winfo_width() // 2)}+{i[3] + (i[1] // 2 - win.winfo_height() // 2)}")
+ except:
+ print("设置居中错误,忽略")
# 显示窗口
win.mainloop()