![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <PythonConfig.h>
Public Types | |
| enum | Type { Type::Venv, Type::Conda, Type::System, Type::Bundled } |
Public Member Functions | |
| PythonConfig ()=default | |
| Type | type () const |
| const QString & | pythonHome () const |
| void | preparePythonProcess (QProcess &pythonProcess) const |
| PythonConfigPaths | pythonCompatiblePaths () const |
| Version | getVersion () const |
| bool | validateAndDisplayErrors (QWidget *parent=nullptr) const |
| void | initDefault () |
| void | initBundled () |
| void | initFromLocation (const QString &prefix) |
| void | initCondaEnv (const QString &condaPrefix) |
| Initialize the paths to use the conda environment stored at condaPrefix. More... | |
| void | initVenv (const QString &venvPrefix) |
| Initialize the paths to use the python venv stored at venvPrefix. More... | |
| void | initFromPythonExecutable (const QString &pythonExecutable) |
Static Public Member Functions | |
| static bool | IsInsideEnvironment () |
| static PythonConfig | fromContainingEnvironment () |
This class infers the right python home and python path for the python environment to be used.
Its only used for Windows (on other platform it doesn't do much) as on Windows we can't rely on the system's python.
|
strong |
|
default |
|
static |
References Conda, initFromPythonExecutable(), PathToPythonExecutableInEnv(), and Venv.
Referenced by PythonPlugin::PythonPlugin().
| Version PythonConfig::getVersion | ( | ) | const |
Calls the python.exe of this environment / config to get its version.
References GetPythonExeVersion(), and preparePythonProcess().
Referenced by validateAndDisplayErrors().
| void PythonConfig::initBundled | ( | ) |
Initialize the paths to point to where the Python environment was bundled on installation
References initFromLocation().
Referenced by PythonRuntimeSettings::pythonEnvConfig(), and PythonPlugin::PythonPlugin().
| void PythonConfig::initCondaEnv | ( | const QString & | condaPrefix | ) |
Initialize the paths to use the conda environment stored at condaPrefix.
References Conda.
Referenced by initFromLocation().
| void PythonConfig::initDefault | ( | ) |
Initialize python home and python path corresponding to the environment to be used.
Does nothing, as we rely on the system's python to be properly installed
References Bundled, and System.
Referenced by PythonRuntimeSettings::pythonEnvConfig().
| void PythonConfig::initFromLocation | ( | const QString & | prefix | ) |
Initialize from the path to an environment. Will try to guess if the environment is a conda env or a python venv
References Bundled, Conda, initCondaEnv(), initFromPythonExecutable(), initVenv(), PathToPythonExecutableInEnv(), and Venv.
Referenced by initBundled(), and PythonRuntimeSettings::pythonEnvConfig().
| void PythonConfig::initFromPythonExecutable | ( | const QString & | pythonExecutable | ) |
References Bundled, qtCompatCodecForName(), result, and QtCompatTextCodec::toUnicode().
Referenced by fromContainingEnvironment(), and initFromLocation().
| void PythonConfig::initVenv | ( | const QString & | venvPrefix | ) |
Initialize the paths to use the python venv stored at venvPrefix.
References PyVenvCfg::FromFile(), PyVenvCfg::home, PyVenvCfg::includeSystemSitesPackages, and Venv.
Referenced by initFromLocation().
|
static |
Referenced by PythonPlugin::PythonPlugin().
| void PythonConfig::preparePythonProcess | ( | QProcess & | pythonProcess | ) | const |
Sets the necessary settings of the QProcess so that it uses the correct Python exe.
References Conda, cloudViewer::t::geometry::path, PathToPythonExecutableInEnv(), and type().
Referenced by getVersion(), and PackageManager::PackageManager().
| PythonConfigPaths PythonConfig::pythonCompatiblePaths | ( | ) | const |
Returns the python home & path stored in types that the CPython API can use.
References QStringToWcharArray().
|
inline |
Referenced by PackageManager::PackageManager().
|
inline |
Referenced by PackageManager::PackageManager(), preparePythonProcess(), and PythonPlugin::PythonPlugin().
| bool PythonConfig::validateAndDisplayErrors | ( | QWidget * | parent = nullptr | ) | const |
Does some basic validation (check is python executable exists and checks if its version is compatible) and displays a GUI with a message describing the error to the user.
| parent | parent for the GUI to be displayed, can be nullptr |
References getVersion(), Version::isCompatibleWithCompiledVersion(), Version::isNull(), PythonVersion(), Version::versionMajor, Version::versionMinor, and Version::versionPatch.
Referenced by PythonPlugin::PythonPlugin().