Skip to content

Commit

Permalink
Store results for processing algorithm executions
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 21, 2021
1 parent af03701 commit cf0e266
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions python/plugins/processing/gui/AlgorithmDialog.py
Expand Up @@ -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))
Expand Down Expand Up @@ -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)

Expand All @@ -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()
Expand Down

0 comments on commit cf0e266

Please sign in to comment.