Skip to content

Commit

Permalink
[processing] Default to hiding help button for algorithms
Browse files Browse the repository at this point in the history
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 95d68e9
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 5 deletions.
Expand Up @@ -47,6 +47,8 @@ Constructor for QgsProcessingModelAlgorithm.

virtual QString shortDescription() const;

virtual QString helpUrl() const;

virtual Flags flags() const;


Expand Down
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py
Expand Up @@ -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")

Expand Down
Expand Up @@ -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")

Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/algs/qgis/QgisAlgorithmProvider.py
Expand Up @@ -289,6 +289,9 @@ def getAlgs(self):
def id(self):
return 'qgis'

def helpId(self):
return 'qgis'

def name(self):
return 'QGIS'

Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
Expand Up @@ -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'

Expand Down
5 changes: 5 additions & 0 deletions src/core/processing/models/qgsprocessingmodelalgorithm.cpp
Expand Up @@ -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...
Expand Down
1 change: 1 addition & 0 deletions src/core/processing/models/qgsprocessingmodelalgorithm.h
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingprovider.cpp
Expand Up @@ -43,7 +43,7 @@ QString QgsProcessingProvider::svgIconPath() const

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

QString QgsProcessingProvider::longName() const
Expand Down
4 changes: 2 additions & 2 deletions src/core/processing/qgsprocessingprovider.h
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/gui/processing/qgsprocessingalgorithmdialogbase.cpp
Expand Up @@ -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()
Expand Down

0 comments on commit 95d68e9

Please sign in to comment.