Skip to content
Permalink
Browse files
Store results for processing algorithm executions
  • Loading branch information
nyalldawson committed Dec 21, 2021
1 parent af03701 commit cf0e266a1545ab308fd6011c999cf39117039c4e
Showing with 16 additions and 6 deletions.
  1. +16 −6 python/plugins/processing/gui/AlgorithmDialog.py
@@ -64,6 +64,8 @@ def __init__(self, alg, in_place=False, parent=None):

self.context = None
self.feedback = None
self.history_log_id = None
self.history_details = {}

self.setAlgorithm(alg)
self.setMainWidget(self.getParametersPanel(alg, self))
@@ -265,12 +267,16 @@ def elapsed_time(start_time, result):
self.cancelButton().setEnabled(False)
self.resetGui()
else:
command = self.algorithm().asPythonCommand(parameters, self.context)
if command:
QgsGui.historyProviderRegistry().addEntry('processing', {
'python_command': command,
'algorithm_id': self.algorithm().id()
})
self.history_details = {
'python_command': self.algorithm().asPythonCommand(parameters, self.context),
'algorithm_id': self.algorithm().id(),
'parameters': self.algorithm().asMap(parameters, self.context)
}
process_command, command_ok = self.algorithm().asQgisProcessCommand(parameters, self.context)
if command_ok:
self.history_details['process_command'] = process_command
self.history_log_id, _ = QgsGui.historyProviderRegistry().addEntry('processing', self.history_details)

QgsGui.instance().processingRecentAlgorithmLog().push(self.algorithm().id())
self.cancelButton().setEnabled(self.algorithm().flags() & QgsProcessingAlgorithm.FlagCanCancel)

@@ -286,6 +292,10 @@ def on_complete(ok, results):
self.tr(elapsed_time(start_time, 'Execution failed after')))
self.feedback.pushInfo('')

if self.history_log_id is not None:
self.history_details['results'] = results
QgsGui.historyProviderRegistry().updateEntry(self.history_log_id, self.history_details)

if self.feedback_dialog is not None:
self.feedback_dialog.close()
self.feedback_dialog.deleteLater()

0 comments on commit cf0e266

Please sign in to comment.