34 return sInstance->runCommand( command, messageOnError );
38 QgsDebugError( QStringLiteral(
"Unable to run Python command: runner not available!" ) );
48 return sInstance->runFileCommand( filename, messageOnError );
52 QgsDebugError( QStringLiteral(
"Unable to run Python command: runner not available!" ) );
61 return sInstance->evalCommand( command, result );
65 QgsDebugError( QStringLiteral(
"Unable to run Python command: runner not available!" ) );
74 return sInstance->setArgvCommand( arguments, messageOnError );
78 QgsDebugError( QStringLiteral(
"Unable to run Python command: runner not available!" ) );
Utility class for running Python commands from various parts of QGIS.
static bool setArgv(const QStringList &arguments, const QString &messageOnError=QString())
Set sys.argv.
static bool run(const QString &command, const QString &messageOnError=QString())
Execute a Python statement.
static void setInstance(QgsPythonRunner *runner)
Assign an instance of Python runner so that run() can be used.
static bool eval(const QString &command, QString &result)
Eval a Python statement.
static QgsPythonRunner * sInstance
static bool runFile(const QString &filename, const QString &messageOnError=QString())
Execute a Python filename, showing an error message if one occurred.
static bool isValid()
Returns true if the runner has an instance (and thus is able to run commands).
QgsPythonRunner()=default
Protected constructor: can be instantiated only from children.
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)