2018-06-23 16:59:23 +00:00
|
|
|
#ifndef PYTHONMANAGER_H
|
|
|
|
#define PYTHONMANAGER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
class CutterPythonPlugin;
|
|
|
|
typedef struct _ts PyThreadState;
|
|
|
|
typedef struct _object PyObject;
|
|
|
|
|
2018-07-04 20:50:02 +00:00
|
|
|
class PythonManager
|
2018-06-23 16:59:23 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
static PythonManager *getInstance();
|
|
|
|
|
|
|
|
PythonManager();
|
|
|
|
~PythonManager();
|
|
|
|
|
|
|
|
void setPythonHome(const QString pythonHome)
|
|
|
|
{
|
|
|
|
customPythonHome = pythonHome;
|
|
|
|
}
|
|
|
|
|
|
|
|
void initPythonHome();
|
|
|
|
void initialize();
|
|
|
|
void addPythonPath(char *path);
|
|
|
|
|
|
|
|
bool startJupyterNotebook();
|
|
|
|
QString getJupyterUrl();
|
|
|
|
|
2018-06-24 09:51:16 +00:00
|
|
|
PyObject *createModule(QString module);
|
|
|
|
CutterPythonPlugin *loadPlugin(const char *pluginName);
|
2018-06-23 16:59:23 +00:00
|
|
|
|
2018-06-24 09:51:16 +00:00
|
|
|
void restoreThread();
|
|
|
|
void saveThread();
|
2018-06-23 16:59:23 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString customPythonHome;
|
|
|
|
wchar_t *pythonHome = nullptr;
|
|
|
|
PyThreadState *pyThreadState = nullptr;
|
|
|
|
|
|
|
|
PyObject *cutterJupyterModule;
|
|
|
|
PyObject *cutterPluginModule;
|
|
|
|
PyObject *cutterNotebookAppInstance = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define Python() (PythonManager::getInstance())
|
|
|
|
|
|
|
|
#endif // PYTHONMANAGER_H
|