Skip to content
Permalink
Browse files

[processing] Default to hiding help button for algorithms

And require that showing help is opt-in. Apart from a handful
of built-in providers, most providers will not have help pages
available within the QGIS documentation (including model and
script algorithms). Accordingly, we should hide the help button
by default and only show it for these selected providers.

Note that 3rd party algorithms can still specify custom helpUrl
urls, in which case the button WILL be shown.
  • Loading branch information
nyalldawson committed Sep 25, 2018
1 parent e2082a0 commit 95d68e9172d1a9eef9b208af4eef67e7a437fee9
@@ -47,6 +47,8 @@ Constructor for QgsProcessingModelAlgorithm.

virtual QString shortDescription() const;

virtual QString helpUrl() const;

virtual Flags flags() const;


@@ -60,8 +60,8 @@ string should not be localised.
virtual QString helpId() const;
%Docstring
Returns the provider help id string, used for creating QgsHelp urls for algorithms
belong to this provider. By default, this returns the provider's id(). This string
should not be localised.
belong to this provider. By default, this returns the an empty string, meaning that
no QgsHelp url should be created for the provider's algorithms.

.. seealso:: :py:func:`id`
%End
@@ -132,6 +132,9 @@ def longName(self):
def id(self):
return 'gdal'

def helpId(self):
return 'gdal'

def icon(self):
return QgsApplication.getThemeIcon("/providerGdal.svg")

@@ -128,6 +128,9 @@ def longName(self):
def id(self):
return 'grass7'

def helpId(self):
return 'grass7'

def icon(self):
return QgsApplication.getThemeIcon("/providerGrass.svg")

@@ -289,6 +289,9 @@ def getAlgs(self):
def id(self):
return 'qgis'

def helpId(self):
return 'qgis'

def name(self):
return 'QGIS'

@@ -128,6 +128,9 @@ def longName(self):
def id(self):
return 'saga'

def helpId(self):
return 'saga'

def defaultVectorFileExtension(self, hasGeometry=True):
return 'shp' if hasGeometry else 'dbf'

@@ -81,6 +81,11 @@ QString QgsProcessingModelAlgorithm::shortDescription() const
return mHelpContent.value( QStringLiteral( "SHORT_DESCRIPTION" ) ).toString();
}

QString QgsProcessingModelAlgorithm::helpUrl() const
{
return QString();
}

QgsProcessingAlgorithm::Flags QgsProcessingModelAlgorithm::flags() const
{
// TODO - check child algorithms, if they all support threading, then the model supports threading...
@@ -52,6 +52,7 @@ class CORE_EXPORT QgsProcessingModelAlgorithm : public QgsProcessingAlgorithm
QString svgIconPath() const override;
QString shortHelpString() const override;
QString shortDescription() const override;
QString helpUrl() const override;
Flags flags() const override;

bool canExecute( QString *errorMessage SIP_OUT = nullptr ) const override;
@@ -43,7 +43,7 @@ QString QgsProcessingProvider::svgIconPath() const

QString QgsProcessingProvider::helpId() const
{
return id();
return QString();
}

QString QgsProcessingProvider::longName() const
@@ -72,8 +72,8 @@ class CORE_EXPORT QgsProcessingProvider : public QObject

/**
* Returns the provider help id string, used for creating QgsHelp urls for algorithms
* belong to this provider. By default, this returns the provider's id(). This string
* should not be localised.
* belong to this provider. By default, this returns the an empty string, meaning that
* no QgsHelp url should be created for the provider's algorithms.
* \see id()
*/
virtual QString helpId() const;
@@ -143,6 +143,11 @@ void QgsProcessingAlgorithmDialogBase::setAlgorithm( QgsProcessingAlgorithm *alg
textShortHelp->setHtml( algHelp );
connect( textShortHelp, &QTextBrowser::anchorClicked, this, &QgsProcessingAlgorithmDialogBase::linkClicked );
}

if ( algorithm->helpUrl().isEmpty() && algorithm->provider()->helpId().isEmpty() )
{
mButtonBox->removeButton( mButtonBox->button( QDialogButtonBox::Help ) );
}
}

QgsProcessingAlgorithm *QgsProcessingAlgorithmDialogBase::algorithm()

0 comments on commit 95d68e9

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