Skip to content

Commit 7942be9

Browse files
committed
Merge branch 'master' into heatmap_fixes
2 parents 1164c81 + a56c957 commit 7942be9

File tree

70 files changed

+10490
-7641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+10490
-7641
lines changed

doc/TRANSLATORS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<style>table {font-size:80%;}th {text-align:left; }.bartodo{ background-color:red;width:100px;height:20px;}.bardone{ background-color:green;width:80px;height:20px;font-size:80%;text-align:center;padding-top:4px;height:16px;color:white;}</style><table><tr><th colspan="2" style="width:250px;">Language</th><th>Finished %</th><th>Translators</th></tr>
22

3+
<tr><td><img src="qrc:/images/flags/da_DK.png"></td><td>Danish (Denmark)</td><td><div title="finished:9043 unfinished:1 untranslated:3" class="bartodo"><div class="bardone" style="width:98px">98.9</div></div></td><td>Jacob Overgaard Madsen, Preben Lisby</td></tr>
34
<tr><td><img src="qrc:/images/flags/de.png"></td><td>German</td><td><div title="finished:9040 unfinished:0 untranslated:0" class="bartodo"><div class="bardone" style="width:98px">98.9</div></div></td><td>Jürgen E. Fischer, Stephan Holl, Otto Dassau, Werner Macho</td></tr>
4-
<tr><td><img src="qrc:/images/flags/gl_ES.png"></td><td>Galician (Spain)</td><td><div title="finished:8574 unfinished:219 untranslated:223" class="bartodo"><div class="bardone" style="width:94px">95.0</div></div></td><td>Xan Vieiro</td></tr>
5+
<tr><td><img src="qrc:/images/flags/gl_ES.png"></td><td>Galician (Spain)</td><td><div title="finished:8530 unfinished:170 untranslated:347" class="bartodo"><div class="bardone" style="width:94px">94.2</div></div></td><td>Xan Vieiro</td></tr>
56
<tr><td><img src="qrc:/images/flags/es.png"></td><td>Spanish</td><td><div title="finished:8438 unfinished:22 untranslated:58" class="bartodo"><div class="bardone" style="width:92px">92.4</div></div></td><td>Carlos Dávila, Javier César Aldariz, Gabriela Awad, Edwin Amado, Mayeul Kauffmann, Diana Galindo</td></tr>
6-
<tr><td><img src="qrc:/images/flags/da_DK.png"></td><td>Danish (Denmark)</td><td><div title="finished:7760 unfinished:482 untranslated:801" class="bartodo"><div class="bardone" style="width:87px">87.5</div></div></td><td>Jacob Overgaard Madsen, Preben Lisby</td></tr>
77
<tr><td><img src="qrc:/images/flags/it.png"></td><td>Italian</td><td><div title="finished:7975 unfinished:28 untranslated:515" class="bartodo"><div class="bardone" style="width:87px">87.4</div></div></td><td>Paolo Cavallini, Flavio Rigolon, Maurizio Napolitano, Roberto Angeletti, Alessandro Fanna, Michele Beneventi, Marco Braida, Luca Casagrande, Luca Delucchi, Anne Gishla</td></tr>
88
<tr><td><img src="qrc:/images/flags/sv.png"></td><td>Swedish</td><td><div title="finished:7316 unfinished:1131 untranslated:109" class="bartodo"><div class="bardone" style="width:86px">86.2</div></div></td><td>Lars Luthman, Magnus Homann, Victor Axbom</td></tr>
99
<tr><td><img src="qrc:/images/flags/et_EE.png"></td><td>Estonian (Estonia)</td><td><div title="finished:7549 unfinished:651 untranslated:880" class="bartodo"><div class="bardone" style="width:86px">86.1</div></div></td><td>Veiko Viil</td></tr>

i18n/qgis_da_DK.ts

Lines changed: 1854 additions & 1719 deletions
Large diffs are not rendered by default.

i18n/qgis_gl_ES.ts

Lines changed: 6995 additions & 4638 deletions
Large diffs are not rendered by default.

python/core/core.sip

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
%Include qgsmimedatautils.sip
4848
%Include qgsnetworkaccessmanager.sip
4949
%Include qgsofflineediting.sip
50+
%Include qgsogcutils.sip
5051
%Include qgsoverlayobject.sip
5152
%Include qgsowsconnection.sip
5253
%Include qgspaintenginehack.sip
@@ -157,7 +158,7 @@
157158
%Include raster/qgssinglebandcolordatarenderer.sip
158159
%Include raster/qgssinglebandpseudocolorrenderer.sip
159160
%Include raster/qgssinglebandgrayrenderer.sip
160-
%Include raster/qgspaletterasterrenderer.sip
161+
%Include raster/qgspalettedrasterrenderer.sip
161162
%Include raster/qgscubicrasterresampler.sip
162163
%Include raster/qgsmultibandcolorrenderer.sip
163164

python/core/qgsgeometry.sip

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,6 @@ class QgsGeometry
4141
/** static method that creates geometry from Wkt */
4242
static QgsGeometry* fromWkt( QString wkt ) /Factory/;
4343

44-
/** static method that creates geometry from GML2
45-
@param XML representation of the geometry. GML elements are expected to be
46-
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
47-
@note added in 1.9
48-
*/
49-
static QgsGeometry* fromGML2( const QString& xmlString ) /Factory/;
50-
51-
/** static method that creates geometry from GML2
52-
@note added in 1.9
53-
*/
54-
static QgsGeometry* fromGML2( const QDomNode& geometryNode ) /Factory/;
55-
5644
/** construct geometry from a point */
5745
static QgsGeometry* fromPoint( const QgsPoint& point ) /Factory/;
5846
/** construct geometry from a multipoint */

python/core/qgsogcutils.sip

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
3+
class QgsOgcUtils
4+
{
5+
%TypeHeaderCode
6+
#include <qgsogcutils.h>
7+
%End
8+
9+
public:
10+
11+
/** static method that creates geometry from GML2
12+
@param XML representation of the geometry. GML elements are expected to be
13+
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
14+
@note added in 1.9
15+
*/
16+
static QgsGeometry* geometryFromGML2( const QString& xmlString ) /Factory/;
17+
18+
/** static method that creates geometry from GML2
19+
@note added in 1.9
20+
*/
21+
static QgsGeometry* geometryFromGML2( const QDomNode& geometryNode ) /Factory/;
22+
23+
/** Exports the geometry to mGML2
24+
@return true in case of success and false else
25+
*/
26+
static QDomElement geometryToGML2( QgsGeometry* geometry, QDomDocument& doc );
27+
28+
/** read rectangle from GML2 Box */
29+
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );
30+
31+
};
32+
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
class QgsPalettedRasterRenderer: QgsRasterRenderer
1+
class QgsPalettedRasterRenderer : QgsRasterRenderer
22
{
33
%TypeHeaderCode
44
#include "qgspalettedrasterrenderer.h"
55
%End
66
public:
77
/**Renderer owns color array*/
8-
QgsPalettedRasterRenderer( QgsRasterDataProvider* provider, int bandNumber, QColor* colorArray /Array,Transfer/, int nColors /ArraySize/ );
8+
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QColor* colorArray /Array,Transfer/, int nColors /ArraySize/ );
99
~QgsPalettedRasterRenderer();
10-
QgsRasterInterface * clone() /Factory/;
11-
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterDataProvider* provider ) /Factory/;
10+
QgsRasterInterface * clone() const /Factory/;
11+
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input ) /Factory/;
1212

13-
QgsRasterBlock * block( int bandNo, const QgsRectangle & extent, int width, int height ) / Factory /;
13+
// void draw( QPainter* p, QgsRasterViewPort* viewPort, const QgsMapToPixel* theQgsMapToPixel );
14+
15+
QgsRasterBlock *block( int bandNo, const QgsRectangle & extent, int width, int height ) /Factory/;
1416

1517
/**Returns number of colors*/
1618
int nColors() const;
@@ -20,4 +22,6 @@ class QgsPalettedRasterRenderer: QgsRasterRenderer
2022
void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;
2123

2224
void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const;
23-
};
25+
26+
QList<int> usesBands() const;
27+
};

python/gui/qgisinterface.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ class QgisInterface : QObject
426426
// @added in 1.6
427427
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false ) = 0;
428428

429+
virtual QDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) = 0;
429430
/** Return vector layers in edit mode
430431
* @param modified whether to return only layers that have been modified
431432
* @returns list of layers in legend order, or empty list

python/plugins/CMakeLists.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
# will function when app is run from build directory
33

44
# When staging all plugins, use the following make targets:
5-
# staged_plugins - stage plugins (usually after repo pull/build and project make)
6-
# staged_plugins_pyc - stage and byte-compile all Python scripts
7-
# clean_staged_plugins - removes the plugins directory and all contents
5+
# staged-plugins - stage plugins (usually after repo pull/build and project make)
6+
# staged-plugins-pyc - stage and byte-compile all Python scripts
7+
# clean-staged-plugins - removes the plugins directory and all contents
88
#
99
# When developing on a plugin, use the following make targets:
10-
# staged_[plugin_dir_name] - stage specific plugin, regenerating any changed resources
11-
# clean_staged_[plugin_dir_name] - removes the plugin directory and its contents
10+
# staged-[plugin_dir_name] - stage specific plugin, regenerating any changed resources
11+
# clean-staged-[plugin_dir_name] - removes the plugin directory and its contents
1212
#
1313
# NOTE: regular project 'make install' is unaffected
1414

15-
ADD_CUSTOM_TARGET(staged_plugins)
15+
ADD_CUSTOM_TARGET(staged-plugins)
1616

17-
ADD_CUSTOM_TARGET(staged_plugins_pyc DEPENDS staged_plugins
17+
ADD_CUSTOM_TARGET(staged-plugins-pyc DEPENDS staged-plugins
1818
COMMAND ${PYTHON_EXECUTABLE} -m compileall -q "${PYTHON_OUTPUT_DIRECTORY}/plugins"
1919
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
2020
COMMENT "Byte-compiling staged Python plugins..."
@@ -23,13 +23,13 @@ ADD_CUSTOM_TARGET(staged_plugins_pyc DEPENDS staged_plugins
2323
# plugins can also be staged with CMake option at build time
2424
IF(WITH_STAGED_PLUGINS)
2525
IF(WITH_PY_COMPILE)
26-
ADD_CUSTOM_TARGET(staged_plugins_on_build ALL DEPENDS staged_plugins_pyc)
26+
ADD_CUSTOM_TARGET(staged-plugins-on-build ALL DEPENDS staged-plugins-pyc)
2727
ELSE(WITH_PY_COMPILE)
28-
ADD_CUSTOM_TARGET(staged_plugins_on_build ALL DEPENDS staged_plugins)
28+
ADD_CUSTOM_TARGET(staged-plugins-on-build ALL DEPENDS staged-plugins)
2929
ENDIF(WITH_PY_COMPILE)
3030
ENDIF(WITH_STAGED_PLUGINS)
3131

32-
ADD_CUSTOM_TARGET(clean_staged_plugins
32+
ADD_CUSTOM_TARGET(clean-staged-plugins
3333
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins
3434
)
3535

@@ -39,33 +39,33 @@ MACRO (PLUGIN_INSTALL plugin subdir )
3939
INSTALL(FILES ${ARGN} DESTINATION ${QGIS_DATA_DIR}/python/plugins/${plugin}/${subdir})
4040
STRING(REPLACE "/" "_" subdir_sane "${subdir}")
4141
IF(WITH_STAGED_PLUGINS)
42-
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane} DEPENDS ${ARGN})
42+
ADD_CUSTOM_TARGET(${plugin}-${subdir_sane} DEPENDS ${ARGN})
4343
ELSE(WITH_STAGED_PLUGINS)
44-
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane} ALL DEPENDS ${ARGN})
44+
ADD_CUSTOM_TARGET(${plugin}-${subdir_sane} ALL DEPENDS ${ARGN})
4545
ENDIF(WITH_STAGED_PLUGINS)
4646

4747
# for staged plugin install (to run from build directory)
48-
ADD_CUSTOM_TARGET(${plugin}_${subdir_sane}_stageinstall DEPENDS ${ARGN})
49-
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
48+
ADD_CUSTOM_TARGET(${plugin}-${subdir_sane}-stageinstall DEPENDS ${ARGN})
49+
ADD_CUSTOM_COMMAND(TARGET ${plugin}-${subdir_sane}-stageinstall
5050
POST_BUILD
5151
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
5252
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
5353
)
5454
FOREACH(file ${ARGN})
55-
ADD_CUSTOM_COMMAND(TARGET ${plugin}_${subdir_sane}_stageinstall
55+
ADD_CUSTOM_COMMAND(TARGET ${plugin}-${subdir_sane}-stageinstall
5656
POST_BUILD
5757
COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${file}\" ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}
5858
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
5959
#COMMENT "copying ${file} to ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}/${subdir}"
6060
)
6161
ENDFOREACH(file)
62-
ADD_DEPENDENCIES(staged_plugins ${plugin}_${subdir_sane}_stageinstall)
62+
ADD_DEPENDENCIES(staged-plugins ${plugin}-${subdir_sane}-stageinstall)
6363
6464
IF(TARGET staged_${plugin})
65-
ADD_DEPENDENCIES(staged_${plugin} ${plugin}_${subdir_sane}_stageinstall)
65+
ADD_DEPENDENCIES(staged_${plugin} ${plugin}-${subdir_sane}-stageinstall)
6666
ELSE(TARGET staged_${plugin})
67-
ADD_CUSTOM_TARGET(staged_${plugin} DEPENDS ${plugin}_${subdir_sane}_stageinstall)
68-
ADD_CUSTOM_TARGET(clean_staged_${plugin}
67+
ADD_CUSTOM_TARGET(staged_${plugin} DEPENDS ${plugin}-${subdir_sane}-stageinstall)
68+
ADD_CUSTOM_TARGET(clean-staged-${plugin}
6969
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin}
7070
)
7171
ENDIF(TARGET staged_${plugin})

python/plugins/sextante/core/GeoAlgorithm.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def getVisibleOutputsCount(self):
319319
if not out.hidden:
320320
i+=1
321321
return i;
322-
322+
323323
def getVisibleParametersCount(self):
324324
'''returns the number of non-hidden parameters'''
325325
i = 0;
@@ -328,6 +328,14 @@ def getVisibleParametersCount(self):
328328
i+=1
329329
return i;
330330

331+
def getHTMLOutputsCount(self):
332+
'''returns the number of HTML outputs'''
333+
i = 0;
334+
for out in self.outputs:
335+
if isinstance(out, OutputHTML):
336+
i+=1
337+
return i;
338+
331339
def getOutputValuesAsDictionary(self):
332340
d = {}
333341
for out in self.outputs:

python/plugins/sextante/grass/description/r.fillnulls.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ r.fillnulls
22
r.fillnulls - Fills no-data areas in a raster layer using v.surf.rst splines interpolation or v.surf.bspline interpolation
33
Raster (r.*)
44
ParameterRaster|input|Input raster layer to fill|False
5-
ParameterSelection|method|Method|bilinear;bicubic;rst|2
65
ParameterNumber|tension|Spline tension parameter|None|None|40.0
76
ParameterNumber|smooth|Spline smoothing parameter|None|None|0.1
87
OutputRaster|output|Filled layer
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
r.randon.raster
2+
r.random.raster - Create random raster
3+
Raster (r.*)
4+
ParameterRaster|raster|Name of input raster map|False
5+
ParameterNumericalValue|value|The number of points to allocate |None|None|1
6+
OutputRaster|output|Output layer
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
v.split
2+
v.split.length - Split lines to shorter segments by length.
3+
Vector (v.*)
4+
ParameterVector|input|Input lines layer|1|False
5+
ParameterNumber|length|Maximum segment length|None|None|10.0
6+
OutputVector|output|Output layer
7+
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
v.split
2-
v.split - Split lines to shorter segments.
2+
v.split.vert - Split lines to shorter segments by max number of vertices.
33
Vector (v.*)
44
ParameterVector|input|Input lines layer|1|False
5-
ParameterNumber|length|Maximum segment length|None|None|10.0
65
ParameterNumber|vertices|Maximum number of vertices in segment|None|None|10
76
OutputVector|output|Output layer
87

python/plugins/sextante/grass/description/v.to.points.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ v.to.points - Create points along input lines
33
Vector (v.*)
44
ParameterVector|input|Input lines layer|1|False
55
ParameterString|dmax|Maximum distance between points in map units|100
6+
ParameterBoolean|-n|Write line nodes|True
67
ParameterBoolean|-v|Write line vertices|True
78
ParameterBoolean|-i|Interpolate points between line vertices|False
8-
OutputVector|output|Output vector map where points will be written
9-
9+
OutputVector|output|Output vector map where points will be written

python/plugins/sextante/gui/AlgorithmExecutionDialog.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def __init__(self, alg, mainWidget):
9999
self.logText.readOnly = True
100100
useThreads = SextanteConfig.getSetting(SextanteConfig.USE_THREADS)
101101
keepOpen = SextanteConfig.getSetting(SextanteConfig.KEEP_DIALOG_OPEN)
102-
if useThreads or keepOpen:
103-
self.tabWidget.addTab(self.logText, "Log")
102+
#if useThreads or keepOpen:
103+
self.tabWidget.addTab(self.logText, "Log")
104104
self.webView = QtWebKit.QWebView()
105105
cssUrl = QtCore.QUrl(os.path.join(os.path.dirname(__file__), "help", "help.css"))
106106
self.webView.settings().setUserStyleSheetUrl(cssUrl)
@@ -216,11 +216,13 @@ def accept(self):
216216
return
217217
msg = self.alg.checkParameterValuesBeforeExecuting()
218218
if msg:
219-
if keepOpen or useThread:
220-
self.setInfo("Unable to execute algorithm: %s" % msg, True)
221-
self.tabWidget.setCurrentIndex(1) # log tab
222-
else:
223-
QMessageBox.critical(self, "Unable to execute algorithm", msg)
219+
#===============================================================
220+
# if keepOpen or useThread:
221+
# self.setInfo("Unable to execute algorithm: %s" % msg, True)
222+
# self.tabWidget.setCurrentIndex(1) # log tab
223+
# else:
224+
#===============================================================
225+
QMessageBox.critical(self, "Unable to execute algorithm", msg)
224226
return
225227
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
226228
self.buttonBox.button(QtGui.QDialogButtonBox.Close).setEnabled(False)
@@ -303,6 +305,8 @@ def finish(self):
303305
self.close()
304306
else:
305307
self.resetGUI()
308+
if self.alg.getHTMLOutputsCount() > 0:
309+
self.setInfo("HTML output has been generated by this algorithm.\nOpen the SEXTANTE results dialog to check it.")
306310

307311
@pyqtSlot(str)
308312
def error(self, msg):

python/plugins/sextante/gui/BatchProcessingDialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def accept(self):
149149
continue
150150
widget = self.table.cellWidget(row, col)
151151
if not self.setParameterValueFromWidget(param, widget, alg):
152-
QMessageBox.critical(self.dialog, "Unable to execute batch process", "Wrong or missing parameter values")
152+
QMessageBox.critical(self, "Unable to execute batch process", "Wrong or missing parameter values")
153153
self.algs = None
154154
return
155155
col+=1

python/plugins/sextante/gui/SextanteToolbox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def fillTree(self):
152152
def addRecentAlgorithms(self):
153153
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
154154
if showRecent:
155-
first = self.algorithmTree.topLevelItem(0)
156-
if first.text(0) == "Recently used algorithms":
155+
first = self.algorithmTree.topLevelItem(0)
156+
if first != None and first.text(0) == "Recently used algorithms":
157157
self.algorithmTree.removeItemWidget(first, 0)
158158
recent = SextanteLog.getRecentAlgorithms()
159159
if len(recent) != 0:

python/plugins/sextante/gui/TestTools.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
* *
1717
***************************************************************************
1818
"""
19-
2019
__author__ = 'Victor Olaya'
2120
__date__ = 'February 2013'
2221
__copyright__ = '(C) 2013, Victor Olaya'
2322
# This will get replaced with a git SHA1 when you do a git archive
2423
__revision__ = '$Format:%H$'
2524

25+
import os
2626
from sextante.core.Sextante import Sextante
2727
from sextante.outputs.OutputNumber import OutputNumber
2828
from sextante.outputs.OutputString import OutputString
@@ -42,16 +42,20 @@ def createTest(item):
4242
execcommand = "sextante.runalg("
4343
i = 0
4444
for token in tokens:
45-
if i < alg.getVisibleParametersCount():
45+
if i < alg.getVisibleParametersCount() + 1:
46+
if os.path.exists(token[1:-1]):
47+
token = '"' + os.path.basename(token[1:-1])[:-4] + '"'
4648
execcommand+=token + ","
4749
else:
4850
execcommand+="None,"
4951
i+=1
5052
s += "\toutputs=" + execcommand[:-1] + ")\n"
5153

5254
i = -1 * len(alg.outputs)
53-
for out in alg.outputs:
55+
for out in alg.outputs:
5456
filename = tokens[i][1:-1]
57+
if (filename == str(None)):
58+
raise Exception("Cannot create unit test for that algorithm.\nThe output cannot be a temporary file")
5559
s+="\toutput=outputs['" + out.name + "']\n"
5660
if isinstance(out, (OutputNumber, OutputString)):
5761
s+="self.assertTrue(" + str(out) + ", output)\n"
@@ -69,8 +73,8 @@ def createTest(item):
6973
s+="\texpectedtypes=[" + ",".join([str(f.typeName()) for f in fields]) + "]\n"
7074
s+="\tnames=[str(f.name()) for f in fields]\n"
7175
s+="\ttypes=[str(f.typeName()) for f in fields]\n"
72-
s+="\tself.assertEqual(exceptednames, names)\n"
73-
s+="\tself.assertEqual(exceptedtypes, types)\n"
76+
s+="\tself.assertEqual(expectednames, names)\n"
77+
s+="\tself.assertEqual(expectedtypes, types)\n"
7478
features = QGisLayers.features(layer)
7579
numfeat = len(features)
7680
s+="\tfeatures=sextante.getfeatures(layer))\n"
@@ -80,9 +84,9 @@ def createTest(item):
8084
attrs = feature.attributes()
8185
s+="\tfeature=features.next()\n"
8286
s+="\tattrs=feature.attributes()\n"
83-
s+="\texpectedvalues=[" + ",".join([str(attr.toString()) for attr in attrs]) + "]\n"
87+
s+="\texpectedvalues=[" + ",".join(['"' + str(attr.toString()) + '"' for attr in attrs]) + "]\n"
8488
s+="\tvalues=[str(attr.toString()) for attr in attrs]\n"
85-
s+="\tself.assertEqual(exceptedtypes, types)\n"
89+
s+="\tself.assertEqual(expectedtypes, types)\n"
8690

8791
dlg = ShowTestDialog(s)
8892
dlg.exec_()

0 commit comments

Comments
 (0)