Cleanup python script running
This commit is contained in:
parent
87db38b08e
commit
1eac3f6a83
7 changed files with 68 additions and 128 deletions
|
|
@ -1,26 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef PYTHONRUNNER_H
|
||||
#define PYTHONRUNNER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTextEdit>
|
||||
|
||||
class PythonEmbed;
|
||||
#include <QProcess>
|
||||
#include <QObject>
|
||||
|
||||
class PythonRunner : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PythonRunner(QTextEdit* outputWidget, QObject* parent = nullptr);
|
||||
PythonRunner(QTextEdit* outputWidget, QObject* parent = nullptr);
|
||||
~PythonRunner();
|
||||
|
||||
public slots:
|
||||
void runScript(const QString& scriptContent);
|
||||
void stopScript();
|
||||
|
||||
private slots:
|
||||
void onOutputAvailable();
|
||||
void onErrorAvailable();
|
||||
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
signals:
|
||||
void scriptFinished(int code);
|
||||
|
||||
private:
|
||||
QTextEdit* m_outputWidget;
|
||||
PythonEmbed* m_pythonEmbed;
|
||||
QProcess* m_process;
|
||||
};
|
||||
|
||||
#endif // PYTHONRUNNER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue