Skip to content
Permalink
Browse files

[processing] Fix exception on completion of batch execution of

algorithm which has string or numeric outputs
  • Loading branch information
nyalldawson committed Apr 26, 2019
1 parent ebab2e1 commit cbb99ecf64fa407f9ca1d45c13e2b9c182502ee2
Showing with 13 additions and 7 deletions.
  1. +13 −7 python/plugins/processing/gui/BatchAlgorithmDialog.py
@@ -89,7 +89,7 @@ def runAlgorithm(self):
if not param.checkValueIsAcceptable(wrapper.parameterValue()):
self.messageBar().pushMessage("", self.tr('Wrong or missing parameter value: {0} (row {1})').format(
param.description(), row + 1),
level=Qgis.Warning, duration=5)
level=Qgis.Warning, duration=5)
return
col += 1
count_visible_outputs = 0
@@ -112,7 +112,7 @@ def runAlgorithm(self):
else:
self.messageBar().pushMessage("", self.tr('Wrong or missing output value: {0} (row {1})').format(
out.description(), row + 1),
level=Qgis.Warning, duration=5)
level=Qgis.Warning, duration=5)
return

alg_parameters.append(parameters)
@@ -139,8 +139,11 @@ def runAlgorithm(self):
for count, parameters in enumerate(alg_parameters):
if feedback.isCanceled():
break
self.setProgressText(QCoreApplication.translate('BatchAlgorithmDialog', '\nProcessing algorithm {0}/{1}…').format(count + 1, len(alg_parameters)))
self.setInfo(self.tr('<b>Algorithm {0} starting&hellip;</b>').format(self.algorithm().displayName()), escapeHtml=False)
self.setProgressText(
QCoreApplication.translate('BatchAlgorithmDialog', '\nProcessing algorithm {0}/{1}…').format(
count + 1, len(alg_parameters)))
self.setInfo(self.tr('<b>Algorithm {0} starting&hellip;</b>').format(self.algorithm().displayName()),
escapeHtml=False)
multi_feedback.setCurrentStep(count)

parameters = self.algorithm().preprocessParameters(parameters)
@@ -158,7 +161,9 @@ def runAlgorithm(self):
alg_start_time = time.time()
ret, results = execute(self.algorithm(), parameters, context, multi_feedback)
if ret:
self.setInfo(QCoreApplication.translate('BatchAlgorithmDialog', 'Algorithm {0} correctly executed…').format(self.algorithm().displayName()), escapeHtml=False)
self.setInfo(
QCoreApplication.translate('BatchAlgorithmDialog', 'Algorithm {0} correctly executed…').format(
self.algorithm().displayName()), escapeHtml=False)
feedback.pushInfo(
self.tr('Execution completed in {0:0.2f} seconds'.format(time.time() - alg_start_time)))
feedback.pushInfo(self.tr('Results:'))
@@ -209,5 +214,6 @@ def createSummaryTable(self, algorithm_results):
f.write('<p>{}: {}</p>\n'.format(out.description(), res[out.name()]))
f.write('<hr>\n')

resultsList.addResult(self.algorithm().icon(),
'{} [summary]'.format(self.algorithm().name()), outputFile)
resultsList.addResult(icon=self.algorithm().icon(),
name='{} [summary]'.format(self.algorithm().name()), timestamp=time.localtime(),
result=outputFile)

0 comments on commit cbb99ec

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