Basic structure for the QT application with empty window

This commit is contained in:
2026-07-26 12:21:24 +02:00
parent e667a14459
commit 129a81881c
23 changed files with 196 additions and 5 deletions

View File

@@ -0,0 +1,62 @@
from __future__ import annotations
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
GUI_PACKAGE = ROOT / "src" / "bedit_gui"
FORMS_DIR = GUI_PACKAGE / "ui" / "forms"
GENERATED_UI_DIR = GUI_PACKAGE / "ui" / "generated"
QRC_FILE = GUI_PACKAGE / "resources" / "resources.qrc"
GENERATED_RESOURCES = (
GUI_PACKAGE
/ "resources"
/ "generated"
/ "resources_rc.py"
)
def execute(*command: str) -> None:
print("+", " ".join(command))
subprocess.run(command, check=True)
def generate_ui() -> None:
GENERATED_UI_DIR.mkdir(parents=True, exist_ok=True)
for source in sorted(FORMS_DIR.glob("*.ui")):
destination = GENERATED_UI_DIR / f"ui_{source.stem}.py"
execute(
"pyside6-uic",
str(source),
"-o",
str(destination),
)
def generate_resources() -> None:
GENERATED_RESOURCES.parent.mkdir(
parents=True,
exist_ok=True,
)
execute(
"pyside6-rcc",
str(QRC_FILE),
"-o",
str(GENERATED_RESOURCES),
)
def main() -> None:
generate_ui()
generate_resources()
if __name__ == "__main__":
main()