mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-22 21:06:10 +00:00
0ec363a214
Keep PYTHONHOME string
60 lines
1.1 KiB
C++
60 lines
1.1 KiB
C++
#ifndef JUPYTERCONNECTION_H
|
|
#define JUPYTERCONNECTION_H
|
|
|
|
#ifdef CUTTER_ENABLE_JUPYTER
|
|
|
|
#include <QProcess>
|
|
#include <QMap>
|
|
#include <cwchar>
|
|
|
|
class NestedIPyKernel;
|
|
|
|
struct _object;
|
|
typedef _object PyObject;
|
|
|
|
struct _ts;
|
|
typedef _ts PyThreadState;
|
|
|
|
class JupyterConnection : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
static JupyterConnection* getInstance();
|
|
|
|
JupyterConnection(QObject *parent = nullptr);
|
|
~JupyterConnection();
|
|
|
|
void start();
|
|
QString getUrl();
|
|
|
|
long startNestedIPyKernel(const QStringList &argv);
|
|
NestedIPyKernel *getNestedIPyKernel(long id);
|
|
QVariant pollNestedIPyKernel(long id);
|
|
|
|
signals:
|
|
void urlReceived(const QString &url);
|
|
void creationFailed();
|
|
|
|
private:
|
|
PyObject *cutterJupyterModule = nullptr;
|
|
PyObject *cutterNotebookAppInstance = nullptr;
|
|
|
|
PyThreadState *pyThreadState = nullptr;
|
|
|
|
QMap<long, NestedIPyKernel *> kernels;
|
|
long nextKernelId = 1;
|
|
|
|
wchar_t *pythonHome = nullptr;
|
|
|
|
void initPython();
|
|
void createCutterJupyterModule();
|
|
};
|
|
|
|
|
|
#define Jupyter() (JupyterConnection::getInstance())
|
|
|
|
#endif
|
|
|
|
#endif //JUPYTERCONNECTION_H
|