Skip to content

Commit

Permalink
[processing] Fix exception on completion of batch execution of
Browse files Browse the repository at this point in the history
algorithm which has string or numeric outputs
  • Loading branch information
nyalldawson committed Apr 26, 2019
1 parent 1c86308 commit f1bb580
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions python/plugins/processing/gui/BatchAlgorithmDialog.py
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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:'))
Expand Down Expand Up @@ -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 f1bb580

Please sign in to comment.