Navigation Menu

Skip to content

Commit

Permalink
When exporting a model to python, export comments as python comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 5, 2020
1 parent 0af98f9 commit 889563e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/processing/models/qgsprocessingmodelalgorithm.cpp
Expand Up @@ -465,6 +465,11 @@ QStringList QgsProcessingModelAlgorithm::asPythonCode( const QgsProcessing::Pyth
friendlyOutputNames.insert( defClone->name(), friendlyName );
defClone->setName( friendlyName );
}
else
{
if ( !mParameterComponents.value( defClone->name() ).comment()->description().isEmpty() )
lines << indent + indent + QStringLiteral( "# %1" ).arg( mParameterComponents.value( defClone->name() ).comment()->description() );
}

if ( defClone->flags() & QgsProcessingParameterDefinition::FlagAdvanced )
{
Expand Down
Expand Up @@ -177,6 +177,9 @@ QStringList QgsProcessingModelChildAlgorithm::asPythonCode( const QgsProcessing:

if ( !description().isEmpty() )
lines << baseIndent + QStringLiteral( "# %1" ).arg( description() );
if ( !mComment.description().isEmpty() )
lines << baseIndent + QStringLiteral( "# %1" ).arg( mComment.description() );

QStringList paramParts;
for ( auto paramIt = mParams.constBegin(); paramIt != mParams.constEnd(); ++paramIt )
{
Expand Down

0 comments on commit 889563e

Please sign in to comment.