DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DAPyInterpreter.h
1#ifndef DAPYINTERPRETER_H
2#define DAPYINTERPRETER_H
3#include <QtCore/qglobal.h>
4#include <QString>
5#include "DAPyBindQtGlobal.h"
6#include <vector>
7#include <functional>
8#include <QFileInfo>
9namespace DA
10{
17class DAPYBINDQT_API DAPyInterpreter
18{
19 DA_DECLARE_PRIVATE(DAPyInterpreter)
21
22public:
23 using callback_finalize = std::function< void() >;
24
25public:
27 // 单例
28 static DAPyInterpreter& getInstance();
29
30 // 设置python环境路径
31 void setPythonHomePath(const QString& path);
32 // 开启python环境
33 void initializePythonInterpreter();
34 // 注册环境关闭的回调
35 void registerFinalizeCallback(callback_finalize fp);
36 // 关闭
37 void shutdown();
38 void ensureShutdown();
39 // 获取python配置文件
40 static QString getAppPythonConfigFile();
41 // 获取python Interpreter
42 static QString getPythonInterpreterPath();
43 // 系统的where命令
44 static QList< QFileInfo > wherePython();
45 // 从配置文件获取python
46 static QList< QFileInfo > wherePythonFromConfig();
47
48protected:
49 // 结束python环境
50 void finalizePythonInterpreter();
51
52private:
53 std::vector< callback_finalize > mFinalizeCallbacks;
54};
55} // namespace DA
56#endif // DAPYINTERPRETER_H
python 环境管理类 此类设计为单例
Definition DAPyInterpreter.h:18
序列化类都是带异常的,使用中需要处理异常
Definition AppMainWindow.cpp:44