2017-12-13 17:36:00 +00:00
|
|
|
#ifndef JUPYTERCONNECTION_H
|
|
|
|
#define JUPYTERCONNECTION_H
|
|
|
|
|
|
|
|
#include <QProcess>
|
|
|
|
|
2018-02-09 15:48:02 +00:00
|
|
|
struct _object;
|
|
|
|
typedef _object PyObject;
|
|
|
|
|
|
|
|
struct _ts;
|
|
|
|
typedef _ts PyThreadState;
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
class JupyterConnection : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-02-22 19:56:15 +00:00
|
|
|
static JupyterConnection* getInstance();
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
JupyterConnection(QObject *parent = nullptr);
|
|
|
|
~JupyterConnection();
|
|
|
|
|
|
|
|
void start();
|
2018-02-22 19:56:15 +00:00
|
|
|
QString getUrl();
|
2017-12-13 17:36:00 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void urlReceived(const QString &url);
|
2018-02-22 18:39:20 +00:00
|
|
|
void creationFailed();
|
2017-12-13 17:36:00 +00:00
|
|
|
|
|
|
|
private:
|
2018-02-09 15:48:02 +00:00
|
|
|
PyObject *cutterJupyterModule = nullptr;
|
|
|
|
PyObject *cutterNotebookAppInstance = nullptr;
|
2017-12-13 17:36:00 +00:00
|
|
|
|
2018-02-09 15:48:02 +00:00
|
|
|
PyThreadState *pyThreadState = nullptr;
|
2018-02-22 19:56:15 +00:00
|
|
|
|
|
|
|
void initPython();
|
|
|
|
void createCutterJupyterModule();
|
2017-12-13 17:36:00 +00:00
|
|
|
};
|
|
|
|
|
2018-02-22 19:56:15 +00:00
|
|
|
|
|
|
|
#define Jupyter() (JupyterConnection::getInstance())
|
|
|
|
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
#endif //JUPYTERCONNECTION_H
|