diff --git a/VM/application-vnd.oasis.opendocument.text.svg b/VM/application-vnd.oasis.opendocument.text.svg new file mode 100644 index 0000000..1196821 --- /dev/null +++ b/VM/application-vnd.oasis.opendocument.text.svg @@ -0,0 +1,34 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128" viewBox="0 0 128 128"> + <defs> + <linearGradient id="x-office-document-c" x1="50%" x2="50%" y1="0%" y2="100%"> + <stop offset="0%" stop-color="#005CC2"/> + <stop offset="100%" stop-color="#004DA3"/> + </linearGradient> + <path id="x-office-document-b" d="M84,95 C84,99.9705627 79.9705627,104 75,104 L9,104 C4.02943725,104 6.08718376e-16,99.9705627 0,95 L0,9 C-6.08718376e-16,4.02943725 4.02943725,9.13077564e-16 9,0 L58,0 L84,26 L84,95 Z"/> + <filter id="x-office-document-a" width="127.4%" height="122.1%" x="-13.7%" y="-9.1%" filterUnits="objectBoundingBox"> + <feOffset dy="2" in="SourceAlpha" result="shadowOffsetOuter1"/> + <feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="3.5"/> + <feColorMatrix in="shadowBlurOuter1" values="0 0 0 0 0.22745098 0 0 0 0 0.494117647 0 0 0 0 0.960784314 0 0 0 0.2 0"/> + </filter> + <linearGradient id="x-office-document-f" x1="50%" x2="10.489%" y1="50%" y2="91.194%"> + <stop offset="0%" stop-color="#FFF" stop-opacity=".1"/> + <stop offset="100%" stop-color="#FFF" stop-opacity=".3"/> + </linearGradient> + <path id="x-office-document-e" d="M58,0 L84,26 L67,26 C62.0294373,26 58,21.9705627 58,17 L58,0 L58,0 Z"/> + <filter id="x-office-document-d" width="188.5%" height="188.5%" x="-44.2%" y="-36.5%" filterUnits="objectBoundingBox"> + <feOffset dy="2" in="SourceAlpha" result="shadowOffsetOuter1"/> + <feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="3.5"/> + <feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"/> + <feColorMatrix in="shadowBlurOuter1" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"/> + </filter> + </defs> + <g fill="none" fill-rule="evenodd"> + <g transform="translate(22 14)"> + <use fill="#000" filter="url(#x-office-document-a)" xlink:href="#x-office-document-b"/> + <use fill="url(#x-office-document-c)" xlink:href="#x-office-document-b"/> + <use fill="#000" filter="url(#x-office-document-d)" xlink:href="#x-office-document-e"/> + <use fill="url(#x-office-document-f)" xlink:href="#x-office-document-e"/> + </g> + <path fill="#FFF" fill-opacity=".6" d="M92,50 L92,52 L36,52 L36,50 L92,50 Z M92,60 L92,62 L36,62 L36,60 L92,60 Z M92,70 L92,72 L36,72 L36,70 L92,70 Z M92,80 L92,82 L36,82 L36,80 L92,80 Z M92,90 L92,92 L36,92 L36,90 L92,90 Z"/> + </g> +</svg> diff --git a/VM/mainwindow.py b/VM/mainwindow.py index 7594387..1957c67 100644 --- a/VM/mainwindow.py +++ b/VM/mainwindow.py @@ -1,10 +1,87 @@ +#!/usr/bin/env python3 +import os import sys +import json +import subprocess import ui_mainwindow -import PyQt5.QtWidgets as QtWidgets +from PyQt5.QtCore import * +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * -app = QtWidgets.QApplication(sys.argv) -window = QtWidgets.QMainWindow() +stopShowTime = False +m_cpuAll = 0 +m_cpuFree = 0 + +def ShowCPUMessage(): + pass + +def MainWindow(): + global cpuGet + ui.tabWidget.setTabPosition(QTabWidget.West) # 标签靠左 + #QApplication a(argc, argv) + # 选择最优虚拟机 + if(not os.system("which qemu-system-x86_64")): + ui.vmChooser.setCurrentIndex(0) + if(not os.system("which vboxmanage")): + ui.vmChooser.setCurrentIndex(1) + if(not os.path.exists(programPath + "/../RunCommandWithTerminal.py")): + ui.getQemu.setDisabled(True) + # 允许输出 qDebug 信息 + #QLoggingCategory.defaultCategory().setEnabled(QLoggingCategory.QtDebugMsg, True) + # 判断是否安装 vbox(无需判断) + '''if(system("which VBoxManage")){ + if(QMessageBox.question(this, tr("提示"), "检测到您似乎没有安装 VirtualBox,立即安装?") == QMessageBox.Yes){ + system("xdg-open https:#www.virtualbox.org/wiki/Linux_Downloads") + } + }''' + # QTimer + cpuGet = QTimer(window) + cpuGet.timeout.connect(ShowCPUMessage) + cpuGet.setInterval(1000) + cpuGet.start() + ShowCPUMessage() + # 读取程序版本号 + # / 版本号文件是否存在 + if (not os.path.exists(programPath + "/../information.json")): + QMessageBox.critical(window, "错误", "无法读取版本号!"); + return + with open(programPath + "/../information.json", "r") as file: + fileinfo = file.read() + versionObject = json.loads(fileinfo) + buildTime = versionObject["Time"] + versionValue = versionObject["Version"] + thank = versionObject["Thank"] + thankText = "" + for i in range(0, len(thank)): + thankText += "<p>" + thank[i] + "</p>\n" + print(thank[i]) + # 设置程序标题 + this.setWindowTitle(("Wine 运行器虚拟机安装工具 ") + versionValue) + # 读取谢明列表 + ui.textBrowser_2.setHtml(("<p>程序版本号:") + versionValue + ", " + subprocess.getoutput("arch") + ("</p><p>安装包构建时间:") + buildTime + "</p>" + ui.textBrowser_2.toHtml() + + ("<hr/><h1>谢明列表</h1>") + thankText) + ui.textBrowser_2.anchorClicked.connect(lambda link: QDesktopServices.openUrl(link)) + ui.textBrowser.anchorClicked.connect(lambda link: QDesktopServices.openUrl(link)) + ui.textBrowser_3.anchorClicked.connect(lambda link: QDesktopServices.openUrl(link)) + # 设置标签栏图标 + ui.tabWidget.setTabIcon(1, QIcon.fromTheme(f"{programPath}/application-vnd.oasis.opendocument.text.svg")) + # 设置窗口图标 + this.setWindowIcon(QIcon(f"{programPath}/deepin-wine-runner.svg")) + +def GetRunCommand(command: str): + return subprocess.getoutput(command) + +def on_browser_clicked(): + # 浏览镜像文件 + filePath = QFileDialog.getOpenFileName(this, "选择 ISO 文件", QDir.homePath(), "ISO 镜像文件(*.iso);;所有文件(*.*)"); + if(filePath != ""): + ui.isoPath.setText(filePath) + +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +app = QApplication(sys.argv) +this = window = QMainWindow() ui = ui_mainwindow.Ui_MainWindow() ui.setupUi(window) +MainWindow() window.show() sys.exit(app.exec_()) \ No newline at end of file