Skip to content
Permalink
Browse files

Save algorithm results to dialog

  • Loading branch information
nyalldawson committed Dec 21, 2017
1 parent edcd058 commit ce28cf508700579044ff855314fda665efe992f6
@@ -69,6 +69,19 @@ Switches the dialog to the log page.
bool wasExecuted() const;
%Docstring
Returns true if an algorithm was executed in the dialog.

.. seealso:: :py:func:`results()`

.. seealso:: :py:func:`setExecuted()`
%End

QVariantMap results() const;
%Docstring
Returns the results returned by the algorithm executed.

.. seealso:: :py:func:`wasExecuted()`

.. seealso:: :py:func:`setResults()`
%End

QgsProcessingFeedback *createFeedback() /Factory/;
@@ -157,6 +170,19 @@ Clears any current progress from the dialog.
void setExecuted( bool executed );
%Docstring
Sets whether the algorithm was executed through the dialog.

.. seealso:: :py:func:`wasExecuted()`

.. seealso:: :py:func:`setResults()`
%End

void setResults( const QVariantMap &results );
%Docstring
Sets the algorithm results.

.. seealso:: :py:func:`results()`

.. seealso:: :py:func:`setExecuted()`
%End

void setInfo( const QString &message, bool isError = false, bool escapeHtml = true );
@@ -276,6 +276,7 @@ def finish(self, successful, result, context, feedback):
return

self.setExecuted(True)
self.setResults(result)
self.setInfo(self.tr('Algorithm \'{0}\' finished').format(self.algorithm().displayName()), escapeHtml=False)

if not keepOpen:
@@ -210,6 +210,11 @@ void QgsProcessingAlgorithmDialogBase::setExecuted( bool executed )
mExecuted = executed;
}

void QgsProcessingAlgorithmDialogBase::setResults( const QVariantMap &results )
{
mResults = results;
}

void QgsProcessingAlgorithmDialogBase::finished( bool, const QVariantMap &, QgsProcessingContext &, QgsProcessingFeedback * )
{

@@ -118,9 +118,18 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::

/**
* Returns true if an algorithm was executed in the dialog.
* \see results()
* \see setExecuted()
*/
bool wasExecuted() const { return mExecuted; }

/**
* Returns the results returned by the algorithm executed.
* \see wasExecuted()
* \see setResults()
*/
QVariantMap results() const { return mResults; }

/**
* Creates a new processing feedback object, automatically connected to the appropriate
* slots in this dialog.
@@ -203,9 +212,18 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::

/**
* Sets whether the algorithm was executed through the dialog.
* \see wasExecuted()
* \see setResults()
*/
void setExecuted( bool executed );

/**
* Sets the algorithm results.
* \see results()
* \see setExecuted()
*/
void setResults( const QVariantMap &results );

/**
* Displays an info \a message in the dialog's log.
*/
@@ -250,6 +268,7 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
QgsMessageBar *mMessageBar = nullptr;

bool mExecuted = false;
QVariantMap mResults;
QWidget *mMainWidget = nullptr;
QgsProcessingAlgorithm *mAlgorithm = nullptr;
bool mHelpCollapsed = false;

0 comments on commit ce28cf5

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