15#ifndef QGSPYTHONRUNNER_H
16#define QGSPYTHONRUNNER_H
40 static bool isValid();
43 static bool run(
const QString &command,
const QString &messageOnError = QString() );
49 static bool runFile(
const QString &filename,
const QString &messageOnError = QString() );
52 static bool eval(
const QString &command, QString &result
SIP_OUT );
55 static bool setArgv(
const QStringList &arguments,
const QString &messageOnError = QString() );
70 virtual bool runCommand( QString command, QString messageOnError = QString() ) = 0;
73 virtual bool runFileCommand(
const QString &filename,
const QString &messageOnError = QString() ) = 0;
76 virtual bool evalCommand( QString command, QString &result ) = 0;
79 virtual bool setArgvCommand(
const QStringList &arguments,
const QString &messageOnError = QString() ) = 0;
Utility class for running Python commands from various parts of QGIS.
virtual bool evalCommand(QString command, QString &result)=0
Evaluates the given expression, producing a result.
virtual bool runFileCommand(const QString &filename, const QString &messageOnError=QString())=0
Runs the code from the given file.
virtual bool runCommand(QString command, QString messageOnError=QString())=0
Runs the given statement.
virtual ~QgsPythonRunner()=default
virtual bool setArgvCommand(const QStringList &arguments, const QString &messageOnError=QString())=0
Sets sys.argv to the given arguments.
static QgsPythonRunner * sInstance
QgsPythonRunner()=default
Protected constructor: can be instantiated only from children.