6#include <condition_variable>
25 bool siteImport{
true };
27 std::vector<std::string>
argv;
39 [[nodiscard]]
static bool nowRunning() {
return instance_().state_.load() != State::idle; }
44 MREMBEDDEDPYTHON_API
static bool runString( std::string pythonString, std::function<
void(
bool success )> onDoneAsync =
nullptr );
46 MREMBEDDEDPYTHON_API
static bool runScript(
const std::filesystem::path& path );
48 MREMBEDDEDPYTHON_API
static bool isPythonScript(
const std::filesystem::path& path );
56 void ensureInterpreterThreadIsRunning_();
59 bool available_ =
false;
60 bool shutdownCalled_ =
false;
69 std::atomic<State> state_ = State::idle;
70 std::string queuedSource_;
71 bool lastRunSuccessful_ =
false;
72 std::function<void(
bool success )> onDoneAsync_;
74 std::condition_variable cv_;
82 std::thread interpreterThread_;
84 bool stopInterpreterThread_ =
false;
Definition MREmbeddedPython.h:21
std::string home
Definition MREmbeddedPython.h:26
static MREMBEDDEDPYTHON_API Config pythonConfig
Definition MREmbeddedPython.h:29
static MREMBEDDEDPYTHON_API bool runScript(const std::filesystem::path &path)
std::vector< std::string > argv
Definition MREmbeddedPython.h:27
static MREMBEDDEDPYTHON_API bool isPythonScript(const std::filesystem::path &path)
static MREMBEDDEDPYTHON_API bool runString(std::string pythonString, std::function< void(bool success)> onDoneAsync=nullptr)
static MREMBEDDEDPYTHON_API void shutdown()
static bool nowRunning()
Definition MREmbeddedPython.h:39
static MREMBEDDEDPYTHON_API bool isAvailable()
Set this once before running anything.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MREmbeddedPython.h:24