Skip to content

Commit

Permalink
Add only parameters with description and headers with parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
pathmapper authored and nyalldawson committed Sep 6, 2021
1 parent 4659870 commit 39b6d03
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
18 changes: 12 additions & 6 deletions python/plugins/processing/gui/HelpEditionDialog.py
Expand Up @@ -86,17 +86,23 @@ def accept(self):


def getHtml(self): def getHtml(self):
s = '<p>' + self.getDescription(self.ALG_DESC) + '</p>\n' s = '<p>' + self.getDescription(self.ALG_DESC) + '</p>\n'
s += self.tr('<h2>Input parameters</h2>\n') inputs = ""
for param in self.alg.parameterDefinitions(): for param in self.alg.parameterDefinitions():
if param.flags() & QgsProcessingParameterDefinition.FlagHidden or param.isDestination(): if param.flags() & QgsProcessingParameterDefinition.FlagHidden or param.isDestination():
continue continue


s += '<h3>' + param.description() + '</h3>\n' if self.getDescription(param.name()):
s += '<p>' + self.getDescription(param.name()) + '</p>\n' inputs += '<h3>' + param.description() + '</h3>\n'
s += self.tr('<h2>Outputs</h2>\n') inputs += '<p>' + self.getDescription(param.name()) + '</p>\n'
if inputs:
s += self.tr('<h2>Input parameters</h2>\n') + inputs
outputs = ""
for out in self.alg.outputDefinitions(): for out in self.alg.outputDefinitions():
s += '<h3>' + out.description() + '</h3>\n' if self.getDescription(param.name()):
s += '<p>' + self.getDescription(out.name()) + '</p>\n' outputs += '<h3>' + out.description() + '</h3>\n'
outputs += '<p>' + self.getDescription(out.name()) + '</p>\n'
if outputs:
s += self.tr('<h2>Outputs</h2>\n') + outputs
return s return s


def fillTree(self): def fillTree(self):
Expand Down
14 changes: 10 additions & 4 deletions src/core/processing/qgsprocessingutils.cpp
Expand Up @@ -1048,8 +1048,11 @@ QString QgsProcessingUtils::formatHelpMapAsHtml( const QVariantMap &map, const Q
if ( def->flags() & QgsProcessingParameterDefinition::FlagHidden || def->isDestination() ) if ( def->flags() & QgsProcessingParameterDefinition::FlagHidden || def->isDestination() )
continue; continue;


inputs += QStringLiteral( "<h3>" ) + def->description() + QStringLiteral( "</h3>\n" ); if ( !getText( def->name() ).isEmpty() )
inputs += QStringLiteral( "<p>" ) + getText( def->name() ) + QStringLiteral( "</p>\n" ); {
inputs += QStringLiteral( "<h3>" ) + def->description() + QStringLiteral( "</h3>\n" );
inputs += QStringLiteral( "<p>" ) + getText( def->name() ) + QStringLiteral( "</p>\n" );
}
} }
if ( !inputs.isEmpty() ) if ( !inputs.isEmpty() )
s += QObject::tr( "<h2>Input parameters</h2>\n" ) + inputs; s += QObject::tr( "<h2>Input parameters</h2>\n" ) + inputs;
Expand All @@ -1058,8 +1061,11 @@ QString QgsProcessingUtils::formatHelpMapAsHtml( const QVariantMap &map, const Q
const auto outputDefinitions = algorithm->outputDefinitions(); const auto outputDefinitions = algorithm->outputDefinitions();
for ( const QgsProcessingOutputDefinition *def : outputDefinitions ) for ( const QgsProcessingOutputDefinition *def : outputDefinitions )
{ {
outputs += QStringLiteral( "<h3>" ) + def->description() + QStringLiteral( "</h3>\n" ); if ( !getText( def->name() ).isEmpty() )
outputs += QStringLiteral( "<p>" ) + getText( def->name() ) + QStringLiteral( "</p>\n" ); {
outputs += QStringLiteral( "<h3>" ) + def->description() + QStringLiteral( "</h3>\n" );
outputs += QStringLiteral( "<p>" ) + getText( def->name() ) + QStringLiteral( "</p>\n" );
}
} }
if ( !outputs.isEmpty() ) if ( !outputs.isEmpty() )
s += QObject::tr( "<h2>Outputs</h2>\n" ) + outputs; s += QObject::tr( "<h2>Outputs</h2>\n" ) + outputs;
Expand Down

0 comments on commit 39b6d03

Please sign in to comment.