-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpythonrunner.h
53 lines (41 loc) · 1.36 KB
/
pythonrunner.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef PYTHONRUNNER_H
#define PYTHONRUNNER_H
#include <filesystem>
#include <memory>
#include <QList>
#include <QObject>
#include <QString>
#include <QStringList>
#ifdef RUNNER_BUILD
#define RUNNER_DLL_EXPORT Q_DECL_EXPORT
#else
#define RUNNER_DLL_EXPORT Q_DECL_IMPORT
#endif
namespace mo2::python {
// python runner interface
//
class IPythonRunner {
public:
virtual QList<QObject*> load(const QString& identifier) = 0;
virtual void unload(const QString& identifier) = 0;
// initialize Python
//
// pythonPaths contains the list of built-in paths for the Python library
// (pythonxxx.zip, etc.), an empty list uses the default Python paths (e.g., the
// PYTHONPATH environment variable)
//
virtual bool
initialize(std::vector<std::filesystem::path> const& pythonPaths = {}) = 0;
// add a DLL search path
//
virtual void addDllSearchPath(std::filesystem::path const& dllPath) = 0;
// check if the runner has been initialized, i.e., initialize() has been
// called and succeeded
virtual bool isInitialized() const = 0;
virtual ~IPythonRunner() {}
};
// create the Python runner
//
RUNNER_DLL_EXPORT std::unique_ptr<IPythonRunner> createPythonRunner();
} // namespace mo2::python
#endif // PYTHONRUNNER_H