Skip to content
Permalink
Browse files

removed previous cancelation mechanism (not used)

fixed #5777

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@237 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf@gmail.com
volayaf@gmail.com committed Jun 11, 2012
1 parent f2d4561 commit f284e294524fabd6cce128cfc8534410ab089080
@@ -33,7 +33,10 @@ def __init__(self):
#true if the algorithm has been canceled while it was being executed
#default value is false, so it should be changed in processAlgorithm only if the algorithm
#gets canceled
self.canceled = False
#self.canceled = False

#to be set by the provider when it loads the algorithm
self.provider = None

self.defineCharacteristics()

@@ -105,15 +108,12 @@ def execute(self, progress):
Although the body of the algorithm is in processAlgorithm(),
it should be called using this method, since it performs
some additional operations.
The return value indicates whether the algorithm was canceled (false)
or successfully run (true).
Raises a GeoAlgorithmExecutionException in case anything goes wrong.'''
self.setOutputCRSFromInputLayers()
self.resolveTemporaryOutputs()
self.checkOutputFileExtensions()
try:
self.processAlgorithm(progress)
return not self.canceled
except GeoAlgorithmExecutionException, gaee:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, gaee.msg)
raise gaee
@@ -19,7 +19,7 @@ def __init__(self, alg, iterParam = None, parent = None):
QThread.__init__(self, parent)
self.algorithm = alg
self.parameterToIterate = iterParam

class Progress:
def __init__(self, algex):
self.algorithmExecutor = algex
@@ -53,8 +53,10 @@ def setPercentage(self, p):
def runalg(self):
try:
self.algorithm.execute(self.progress)
if self.algorithm.canceled:
self.canceled.emit()
#===================================================================
# if self.algorithm.canceled:
# self.canceled.emit()
#===================================================================
except GeoAlgorithmExecutionException, e :
self.error.emit()
except:
@@ -76,7 +78,9 @@ def runalgIterating(self):
self.progress.setText("Executing iteration " + str(i) + "/" + str(len(self.filelist)) + "...")
self.progress.setPercentage((i * 100) / len(self.filelist))
self.runalg()
if self.algorithm.canceled:
return
#===================================================================
# if self.algorithm.canceled:
# return
#===================================================================
self.iterated.emit(i)
i += 1
@@ -193,6 +193,8 @@ def runModel(self):
self.alg.descriptionFile = None
alg.descriptionFile = None
else:
if self.alg.provider is None: # might happen if model is opened from modeler dialog
self.alg.provider = Providers.providers["model"]
alg = self.alg.getCopy()
dlg = ParametersDialog(alg)
dlg.exec_()
@@ -440,6 +440,23 @@ def setParamBooleanValue(self, param, widget):
self.params[param.name] = value
return True

def setParamTableFieldValue(self, param, widget):
idx = widget.findText(widget.currentText())
if idx < 0:
name = self.getSafeNameForHarcodedParameter(param)
value = AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, name)
self.params[param.name] = value
value = str(widget.currentText()).strip()
if value == "":
return False
else:
self.values[name] = str(widget.currentText())
return True
else:
value = widget.itemData(widget.currentIndex()).toPyObject()
self.params[param.name] = value
return True

def setParamStringValue(self, param, widget):
idx = widget.findText(widget.currentText())
if idx < 0:
@@ -516,11 +533,14 @@ def setParamValue(self, param, widget):
self.values[name] = ParameterFixedTable.tableToString(widget.table)
return True
if isinstance(param, ParameterTableField):
name = self.getSafeNameForHarcodedParameter(param)
value = AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, name)
self.params[param.name] = value
self.values[name] = str(widget.text())
return True
return self.setParamTableFieldValue(param, widget)
#===================================================================
# name = self.getSafeNameForHarcodedParameter(param)
# value = AlgorithmAndParameter(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM, name)
# self.params[param.name] = value
# self.values[name] = str(widget.text())
# return True
#===================================================================
elif isinstance(param, ParameterMultipleInput):
if param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
options = self.getVectorLayers()

0 comments on commit f284e29

Please sign in to comment.
You can’t perform that action at this time.