QGIS API Documentation
2.0.1-Dufour
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
src
core
qgspythonrunner.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgspythonrunner.cpp
3
---------------------
4
begin : May 2011
5
copyright : (C) 2011 by Martin Dobias
6
email : wonder dot sk at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#include "
qgspythonrunner.h
"
16
#include "
qgslogger.h
"
17
18
QgsPythonRunner
*
QgsPythonRunner::mInstance
= NULL;
19
21
// static methods
22
23
bool
QgsPythonRunner::isValid
()
24
{
25
return
mInstance
!= NULL;
26
}
27
28
bool
QgsPythonRunner::run
( QString command, QString messageOnError )
29
{
30
if
(
mInstance
)
31
{
32
QgsDebugMsg
(
"Running "
+ command );
33
return
mInstance
->
runCommand
( command, messageOnError );
34
}
35
else
36
{
37
QgsDebugMsg
(
"Unable to run Python command: runner not available!"
);
38
return
false
;
39
}
40
}
41
42
bool
QgsPythonRunner::eval
( QString command, QString& result )
43
{
44
if
(
mInstance
)
45
{
46
return
mInstance
->
evalCommand
( command, result );
47
}
48
else
49
{
50
QgsDebugMsg
(
"Unable to run Python command: runner not available!"
);
51
return
false
;
52
}
53
}
54
55
void
QgsPythonRunner::setInstance
(
QgsPythonRunner
* runner )
56
{
57
delete
mInstance
;
58
mInstance
= runner;
59
}
60
62
// non-static methods
63
64
QgsPythonRunner::QgsPythonRunner
()
65
{
66
}
67
68
QgsPythonRunner::~QgsPythonRunner
()
69
{
70
71
}
Generated on Tue Sep 24 2013 14:41:47 for QGIS API Documentation by
1.8.1.2