from pathlib import Path from PyQt6.QtGui import QGuiApplication from PyQt6.QtQml import QQmlApplicationEngine from starsky_presenter.controller.controller import Controller from starsky_presenter.projection.screen import Screen class ControlWindow: def __init__(self, screen, max_scene): self.app = QGuiApplication([]) self.running = True self.engine = QQmlApplicationEngine(self.app) self.controller = Controller(self, screen, max_scene) self.engine.quit.connect(self.app.quit) self.engine.rootContext().setContextProperty("controller_backend", self.controller) self.engine.load(f"{Path(__file__).parent.parent}/resources/main_window.qml") def process_events(self): return self.app.processEvents() def is_running(self): return self.running def close(self): self.app.quit() self.app.exit(0) self.app.processEvents()