Skip to content

Commit

Permalink
More responsive feedback when using iterate mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 12, 2017
1 parent b9e0b46 commit 4b81630
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/plugins/processing/gui/AlgorithmExecutor.py
Expand Up @@ -79,7 +79,11 @@ def executeIterating(alg, parameters, paramToIter, context, feedback):

iter_source = QgsProcessingParameters.parameterAsSource(parameter_definition, parameters, context)
sink_list = []
for feat in iter_source.getFeatures():
if iter_source.featureCount() == 0:
return False

total = 100.0 / iter_source.featureCount()
for current, feat in enumerate(iter_source.getFeatures()):
if feedback.isCanceled():
return False

Expand All @@ -88,6 +92,8 @@ def executeIterating(alg, parameters, paramToIter, context, feedback):
sink.addFeature(feat)
del sink

feedback.setProgress(int(current * total))

# store output values to use them later as basenames for all outputs
outputs = {}
for out in alg.destinationParameterDefinitions():
Expand Down

0 comments on commit 4b81630

Please sign in to comment.