Skip to content

Commit

Permalink
[processing] When user tries to run a subset of a model, validate
Browse files Browse the repository at this point in the history
that all prerequisites have been run already

And if not, show an explanatory warning
  • Loading branch information
nyalldawson committed May 15, 2024
1 parent 1ea04ae commit 04b3cbd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/gui/processing/models/qgsmodeldesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,28 @@ void QgsModelDesignerDialog::run( const QSet<QString> &childAlgorithmSubset )
return;
}

if ( !childAlgorithmSubset.isEmpty() )
{
for ( const QString &child : childAlgorithmSubset )
{
// has user previously run all requirements for this step?
const QSet< QString > requirements = mModel->dependsOnChildAlgorithms( child );
for ( const QString &requirement : requirements )
{
if ( !mLastResult.executedChildIds().contains( requirement ) )
{
QMessageBox messageBox;
messageBox.setWindowTitle( tr( "Run Model" ) );
messageBox.setIcon( QMessageBox::Icon::Warning );
messageBox.setText( tr( "Prerequisite parts of this model have not yet been run. (Try running the full model first)." ) );
messageBox.setStandardButtons( QMessageBox::StandardButton::Ok );
messageBox.exec();
return;
}
}
}
}

std::unique_ptr< QgsProcessingAlgorithmDialogBase > dialog( createExecutionDialog() );
if ( !dialog )
return;
Expand Down

0 comments on commit 04b3cbd

Please sign in to comment.