Skip to content

Commit

Permalink
added customizable parameter check before launching algorithms
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@151 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Apr 25, 2012
1 parent 0928180 commit a991808
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/sextante/core/Sextante.py
Expand Up @@ -268,6 +268,11 @@ def runalg(name, *args):
return
i = i +1

msg = alg.checkParameterValuesBeforeExecuting()
if msg:
print ("Unable to execute algorithm\n" + msg)
return

SextanteLog.addToLog(SextanteLog.LOG_ALGORITHM, alg.getAsCommand())

QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
Expand Down Expand Up @@ -320,6 +325,11 @@ def runandload(name, *args):
return
i = i +1

msg = alg.checkParameterValuesBeforeExecuting()
if msg:
QMessageBox.critical(None, "Unable to execute algorithm", msg)
return

QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
ret = AlgorithmExecutor.runalg(alg, SilentProgress())
QApplication.restoreOverrideCursor()
Expand Down
2 changes: 1 addition & 1 deletion src/sextanteexampleprovider/ExampleAlgorithm.py
Expand Up @@ -66,7 +66,7 @@ def processAlgorithm(self, progress):
settings = QSettings()
systemEncoding = settings.value( "/UI/encoding", "System" ).toString()
provider = vectorLayer.dataProvider()
writer = QgsVectorFileWriter( output, systemEncoding,provider.fields(), provider.geometryType(), provider.crs() )
writer = QgsVectorFileWriter( output, systemEncoding, provider.fields(), provider.geometryType(), provider.crs() )

#Now we take the selected features and add them to the output layer
selection = vectorLayer.selectedFeatures()
Expand Down

0 comments on commit a991808

Please sign in to comment.