feat: show qemu window
Some checks failed
/ Build Windows (push) Has been cancelled

This commit is contained in:
世界观察日志
2025-10-24 12:18:01 +08:00
parent 5018bb56b8
commit 728dcb2f77
3 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
# DO NOT EDIT IT
version = "0.0.5"
version = "0.0.6"
[instance]
url = "127.0.0.1:8080"
@@ -19,6 +19,7 @@ memorySize = "512M"
cpuModel = "Cascadelake-Server-v5"
# Waiting time for wrapper-manager to start
timeout = 80
showWindow = false
[region]
# The language of song metadata. Influence song title, author and other information.

View File

@@ -5,7 +5,7 @@ from creart import exists_module
from creart.creator import AbstractCreator, CreateTargetInfo
from pydantic import BaseModel
CONFIG_VERSION = "0.0.5"
CONFIG_VERSION = "0.0.6"
class Instance(BaseModel):
@@ -20,6 +20,7 @@ class LocalInstance(BaseModel):
memorySize: str = "512M"
cpuModel: str = "Cascadelake-Server-v5"
timeout: int = 30
showWindow: bool = False
class Region(BaseModel):

View File

@@ -11,7 +11,7 @@ from src.config import Config
from src.logger import GlobalLogger
ARGUMENTS = ["qemu-system-x86_64", "-machine q35", f"-cpu {it(Config).localInstance.cpuModel}",
f"-m {it(Config).localInstance.memorySize}", "-display none", "-hda assets/wrapper-manager.qcow2",
f"-m {it(Config).localInstance.memorySize}", "-hda assets/wrapper-manager.qcow2",
"-device virtio-net-pci,netdev=net0", "-netdev user,id=net0,hostfwd=tcp:127.0.0.1:32767-:32767"]
HWACCEL = f"-accel {it(Config).localInstance.hardwareAccelerator}"
@@ -24,6 +24,8 @@ class QemuInstance:
await self.get_instance_image()
if it(Config).localInstance.enableHardwareAcceleration:
ARGUMENTS.insert(3, HWACCEL)
if not it(Config).localInstance.showWindow:
ARGUMENTS.insert(5, "-display none")
self.proc = loop.create_task(
asyncio.create_subprocess_shell(" ".join(ARGUMENTS), stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE))