QGIS/python/core/qgspythonrunner.sip

32 lines
1018 B
Plaintext
Raw Normal View History

class QgsPythonRunner
{
%TypeHeaderCode
#include <qgspythonrunner.h>
%End
public:
2015-07-29 11:52:14 +02:00
/** Returns true if the runner has an instance
(and thus is able to run commands) */
static bool isValid();
2015-07-29 11:52:14 +02:00
/** Execute a python statement */
static bool run( const QString& command, const QString& messageOnError = QString() );
2013-03-31 07:36:57 +10:00
/** Eval a python statement */
2015-11-04 18:02:13 +01:00
static bool eval( const QString& command, QString& result /Out/ );
2013-03-31 07:36:57 +10:00
2015-07-29 11:52:14 +02:00
/** 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. */
2012-09-26 18:46:52 +02:00
static void setInstance( QgsPythonRunner* runner /Transfer/ );
protected:
2015-07-29 11:52:14 +02:00
/** Protected constructor: can be instantiated only from children */
QgsPythonRunner();
virtual ~QgsPythonRunner();
virtual bool runCommand( QString command, QString messageOnError = QString() ) = 0;
2013-03-31 07:36:57 +10:00
virtual bool evalCommand( QString command, QString& result ) = 0;
};