blob: 39386a277d0347e7ccbc7ac8e75944d63958f0c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
# This file is automatically generated by Qt Design Studio.
import os
import sys
from pathlib import Path
from PySide6.QtQml import QQmlApplicationEngine
project_root = Path(__file__).parent.parent.parent
def setup_qt_environment(qml_engine: QQmlApplicationEngine):
"""
Load the QML application. Import the compiled resources when the application is deployed.
"""
qml_app_url = "DrumpadContent/App.qml"
if "__compiled__" in globals():
# Application has been deployed using pyside6-deploy
try:
import autogen.resources # noqa: F401
except ImportError:
resource_file = Path(__file__).parent / "resources.py"
print(
f"Error: No compiled resources found in {resource_file.absolute()}\n"
f"Please compile the resources using pyside6-rcc or pyside6-project build",
file=sys.stderr,
)
sys.exit(1)
qml_engine.addImportPath(":/")
qml_engine.load(f":/{qml_app_url}")
return
qml_engine.addImportPath(str(project_root.absolute()))
os.environ["QT_QUICK_CONTROLS_CONF"] = str(project_root / "qtquickcontrols2.conf")
qml_engine.load(str(project_root / qml_app_url))
|