Quantum GIS API Documentation
1.8
|
Utility class for running python commands from various parts of QGIS. More...
#include <qgspythonrunner.h>
Static Public Member Functions | |
static bool | isValid () |
returns true if the runner has an instance (and thus is able to run commands) | |
static bool | run (QString command, QString messageOnError=QString()) |
execute a python statement | |
static void | setInstance (QgsPythonRunner *runner) |
assign an instance of python runner so that run() can be used. | |
Protected Member Functions | |
QgsPythonRunner () | |
protected constructor: can be instantiated only from children | |
virtual | ~QgsPythonRunner () |
virtual bool | runCommand (QString command, QString messageOnError=QString())=0 |
Static Protected Attributes | |
static QgsPythonRunner * | mInstance = NULL |
Utility class for running python commands from various parts of QGIS.
There is no direct python support in the core library, so it is expected that application with python support creates a subclass that implements pure virtual function(s) during the initialization. The static methods will then work as expected.
Added in QGIS v?
Definition at line 29 of file qgspythonrunner.h.
QgsPythonRunner::QgsPythonRunner | ( | ) | [protected] |
protected constructor: can be instantiated only from children
Definition at line 50 of file qgspythonrunner.cpp.
QgsPythonRunner::~QgsPythonRunner | ( | ) | [protected, virtual] |
Definition at line 54 of file qgspythonrunner.cpp.
bool QgsPythonRunner::isValid | ( | ) | [static] |
returns true if the runner has an instance (and thus is able to run commands)
Definition at line 23 of file qgspythonrunner.cpp.
References mInstance.
bool QgsPythonRunner::run | ( | QString | command, |
QString | messageOnError = QString() |
||
) | [static] |
execute a python statement
Definition at line 28 of file qgspythonrunner.cpp.
References mInstance, QgsDebugMsg, and runCommand().
Referenced by QgsAttributeAction::runAction().
virtual bool QgsPythonRunner::runCommand | ( | QString | command, |
QString | messageOnError = QString() |
||
) | [protected, pure virtual] |
Referenced by run().
void QgsPythonRunner::setInstance | ( | QgsPythonRunner * | runner | ) | [static] |
assign an instance of python runner so that run() can be used.
This method should be called during app initialization. Takes ownership of the object, deletes previous instance.
Definition at line 41 of file qgspythonrunner.cpp.
References mInstance.
QgsPythonRunner * QgsPythonRunner::mInstance = NULL [static, protected] |
Definition at line 52 of file qgspythonrunner.h.
Referenced by isValid(), run(), and setInstance().