2017-12-13 17:36:00 +00:00
|
|
|
#ifndef JUPYTERCONNECTION_H
|
|
|
|
#define JUPYTERCONNECTION_H
|
|
|
|
|
2018-03-02 13:15:53 +00:00
|
|
|
#ifdef CUTTER_ENABLE_JUPYTER
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
#include <QProcess>
|
2018-02-24 19:18:34 +00:00
|
|
|
#include <QMap>
|
2017-12-13 17:36:00 +00:00
|
|
|
|
2018-02-22 21:08:06 +00:00
|
|
|
class NestedIPyKernel;
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
class JupyterConnection : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-03-21 20:32:32 +00:00
|
|
|
static JupyterConnection *getInstance();
|
2018-02-22 19:56:15 +00:00
|
|
|
|
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
|
|
|
|
2018-02-22 21:08:06 +00:00
|
|
|
long startNestedIPyKernel(const QStringList &argv);
|
|
|
|
NestedIPyKernel *getNestedIPyKernel(long id);
|
2018-02-23 16:42:54 +00:00
|
|
|
QVariant pollNestedIPyKernel(long id);
|
2018-02-22 21:08:06 +00:00
|
|
|
|
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-22 21:08:06 +00:00
|
|
|
QMap<long, NestedIPyKernel *> kernels;
|
|
|
|
long nextKernelId = 1;
|
|
|
|
|
2018-06-23 16:59:23 +00:00
|
|
|
bool notebookInstanceExists = false;
|
2017-12-13 17:36:00 +00:00
|
|
|
};
|
|
|
|
|
2018-02-22 19:56:15 +00:00
|
|
|
|
|
|
|
#define Jupyter() (JupyterConnection::getInstance())
|
|
|
|
|
2018-06-23 16:59:23 +00:00
|
|
|
#endif // CUTTER_ENABLE_JUPYTER
|
2018-02-22 19:56:15 +00:00
|
|
|
|
2018-06-23 16:59:23 +00:00
|
|
|
#endif // JUPYTERCONNECTION_H
|