Allow sideloading of resources via env

`CURA_DATA_ROOT` and `URANIUM_DATA_ROOT`
This allows the conanfile.py to point to `venv/share/cura`

This functionality is disabled in sys.frozen

Contributes to CURA-10561
This commit is contained in:
Jelle Spijker 2023-10-29 14:25:06 +01:00
parent 94eb9e1a21
commit 16249e490e
2 changed files with 7 additions and 0 deletions

View File

@ -67,6 +67,8 @@ class CuraConan(ConanFile):
self._cura_env = Environment()
self._cura_env.define("QML2_IMPORT_PATH", str(self._site_packages.joinpath("PyQt6", "Qt6", "qml")))
self._cura_env.define("QT_PLUGIN_PATH", str(self._site_packages.joinpath("PyQt6", "Qt6", "plugins")))
if not self.in_local_cache:
self._cura_env.define( "CURA_DATA_ROOT", str(self._share_dir.joinpath("cura")))
if self.settings.os == "Linux":
self._cura_env.define("QT_QPA_FONTDIR", "/usr/share/fonts")

View File

@ -6,6 +6,7 @@ import sys
import tempfile
import time
import platform
from pathlib import Path
from typing import cast, TYPE_CHECKING, Optional, Callable, List, Any, Dict
import numpy
@ -366,6 +367,10 @@ class CuraApplication(QtApplication):
Resources.addSecureSearchPath(os.path.join(self._app_install_dir, "share", "cura", "resources"))
if not hasattr(sys, "frozen"):
cura_data_root = os.environ.get('CURA_DATA_ROOT', None)
if cura_data_root:
Resources.addSearchPath(str(Path(cura_data_root).joinpath("resources")))
Resources.addSearchPath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "resources"))
# local Conan cache