mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
[processing] Gracefully handle algorithms with no provider set
Fixes #51971
This commit is contained in:
parent
f453d2cc0d
commit
603ccb2904
@ -205,7 +205,7 @@ class AlgorithmDialog(QgsProcessingAlgorithmDialogBase):
|
||||
|
||||
self.clearProgress()
|
||||
self.feedback.pushVersionInfo(self.algorithm().provider())
|
||||
if self.algorithm().provider().warningMessage():
|
||||
if self.algorithm().provider() and self.algorithm().provider().warningMessage():
|
||||
self.feedback.reportError(self.algorithm().provider().warningMessage())
|
||||
|
||||
self.feedback.pushInfo(
|
||||
|
@ -87,7 +87,11 @@ class AlgorithmLocatorFilter(QgsLocatorFilter):
|
||||
|
||||
string = string.lower()
|
||||
tagScore = 0
|
||||
tags = [*a.tags(), a.provider().name()]
|
||||
if a.provider():
|
||||
tags = [*a.tags(), a.provider().name()]
|
||||
else:
|
||||
tags = a.tags()
|
||||
|
||||
if a.group():
|
||||
tags.append(a.group())
|
||||
|
||||
@ -178,7 +182,11 @@ class InPlaceAlgorithmLocatorFilter(QgsLocatorFilter):
|
||||
|
||||
string = string.lower()
|
||||
tagScore = 0
|
||||
tags = [*a.tags(), a.provider().name()]
|
||||
if a.provider():
|
||||
tags = [*a.tags(), a.provider().name()]
|
||||
else:
|
||||
tags = a.tags()
|
||||
|
||||
if a.group():
|
||||
tags.append(a.group())
|
||||
|
||||
|
@ -1439,7 +1439,7 @@ void QgsProcessingModelAlgorithm::updateDestinationParameters()
|
||||
// add some metadata so we can easily link this parameter back to the child source
|
||||
param->metadata().insert( QStringLiteral( "_modelChildId" ), outputIt->childId() );
|
||||
param->metadata().insert( QStringLiteral( "_modelChildOutputName" ), outputIt->name() );
|
||||
param->metadata().insert( QStringLiteral( "_modelChildProvider" ), childIt->algorithm()->provider()->id() );
|
||||
param->metadata().insert( QStringLiteral( "_modelChildProvider" ), childIt->algorithm()->provider() ? childIt->algorithm()->provider()->id() : QString() );
|
||||
|
||||
param->setDescription( outputIt->description() );
|
||||
param->setDefaultValue( outputIt->defaultValue() );
|
||||
|
@ -314,12 +314,12 @@ void QgsProcessingAlgorithmDialogBase::setAlgorithm( QgsProcessingAlgorithm *alg
|
||||
textShortHelp->show();
|
||||
}
|
||||
|
||||
if ( algorithm->helpUrl().isEmpty() && algorithm->provider()->helpId().isEmpty() )
|
||||
if ( algorithm->helpUrl().isEmpty() && ( !algorithm->provider() || algorithm->provider()->helpId().isEmpty() ) )
|
||||
{
|
||||
mButtonBox->removeButton( mButtonBox->button( QDialogButtonBox::Help ) );
|
||||
}
|
||||
|
||||
const QString warning = algorithm->provider()->warningMessage();
|
||||
const QString warning = algorithm->provider() ? algorithm->provider()->warningMessage() : QString();
|
||||
if ( !warning.isEmpty() )
|
||||
{
|
||||
mMessageBar->pushMessage( warning, Qgis::MessageLevel::Warning );
|
||||
@ -449,7 +449,7 @@ void QgsProcessingAlgorithmDialogBase::finished( bool, const QVariantMap &, QgsP
|
||||
void QgsProcessingAlgorithmDialogBase::openHelp()
|
||||
{
|
||||
QUrl algHelp = mAlgorithm->helpUrl();
|
||||
if ( algHelp.isEmpty() )
|
||||
if ( algHelp.isEmpty() && mAlgorithm->provider() )
|
||||
{
|
||||
algHelp = QgsHelp::helpUrl( QStringLiteral( "processing_algs/%1/%2.html#%3" ).arg( mAlgorithm->provider()->helpId(), mAlgorithm->groupId(), QStringLiteral( "%1%2" ).arg( mAlgorithm->provider()->helpId() ).arg( mAlgorithm->name() ) ) );
|
||||
}
|
||||
|
@ -856,7 +856,8 @@ int QgsProcessingExec::showAlgorithmHelp( const QString &inputId, bool useJson )
|
||||
addAlgorithmInformation( algorithmDetails, alg );
|
||||
json.insert( QStringLiteral( "algorithm_details" ), algorithmDetails );
|
||||
QVariantMap providerJson;
|
||||
addProviderInformation( providerJson, alg->provider() );
|
||||
if ( alg->provider() )
|
||||
addProviderInformation( providerJson, alg->provider() );
|
||||
json.insert( QStringLiteral( "provider_details" ), providerJson );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user