mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
accept "true" and "True" as valid values for "hasProcessingProvider"
plugin metadata (fix #41120)
This commit is contained in:
parent
175797521b
commit
dd6ce2d122
@ -185,7 +185,8 @@ class PYTHON_EXPORT QgsPythonUtils
|
||||
/**
|
||||
* Returns TRUE if a plugin implements a Processing provider.
|
||||
*
|
||||
* This is determined by checking the plugin metadata for the "hasProcessingProvider=yes" line.
|
||||
* This is determined by checking the plugin metadata for the "hasProcessingProvider=yes"
|
||||
* or "hasProcessingProvider=true" line.
|
||||
*
|
||||
* \see startProcessingPlugin()
|
||||
* \since QGIS 3.8
|
||||
|
@ -637,7 +637,7 @@ QString QgsPythonUtilsImpl::getPluginMetadata( const QString &pluginName, const
|
||||
|
||||
bool QgsPythonUtilsImpl::pluginHasProcessingProvider( const QString &pluginName )
|
||||
{
|
||||
return getPluginMetadata( pluginName, QStringLiteral( "hasProcessingProvider" ) ).compare( QLatin1String( "yes" ), Qt::CaseInsensitive ) == 0;
|
||||
return getPluginMetadata( pluginName, QStringLiteral( "hasProcessingProvider" ) ).compare( QLatin1String( "yes" ), Qt::CaseInsensitive ) == 0 || getPluginMetadata( pluginName, QStringLiteral( "hasProcessingProvider" ) ).compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0;
|
||||
}
|
||||
|
||||
bool QgsPythonUtilsImpl::loadPlugin( const QString &packageName )
|
||||
|
@ -124,6 +124,9 @@ void TestQgisAppPython::pluginMetadata()
|
||||
QCOMPARE( mQgisApp->mPythonUtils->getPluginMetadata( QStringLiteral( "ProcessingPluginTest" ), QStringLiteral( "name" ) ), QStringLiteral( "processing plugin test" ) );
|
||||
QCOMPARE( mQgisApp->mPythonUtils->getPluginMetadata( QStringLiteral( "ProcessingPluginTest" ), QStringLiteral( "hasProcessingProvider" ) ), QStringLiteral( "yes" ) );
|
||||
QVERIFY( mQgisApp->mPythonUtils->pluginHasProcessingProvider( QStringLiteral( "ProcessingPluginTest" ) ) );
|
||||
// hasProcessingProvider also accepts true/True
|
||||
QCOMPARE( mQgisApp->mPythonUtils->getPluginMetadata( QStringLiteral( "ProcessingPluginTest2" ), QStringLiteral( "hasProcessingProvider" ) ), QStringLiteral( "True" ) );
|
||||
QVERIFY( mQgisApp->mPythonUtils->pluginHasProcessingProvider( QStringLiteral( "ProcessingPluginTest2" ) ) );
|
||||
}
|
||||
|
||||
void TestQgisAppPython::pythonPluginDependencyOrder()
|
||||
|
44
tests/testdata/test_plugin_path/ProcessingPluginTest2/__init__.py
vendored
Normal file
44
tests/testdata/test_plugin_path/ProcessingPluginTest2/__init__.py
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
__init__.py
|
||||
---------------------
|
||||
Date : July 2013
|
||||
Copyright : (C) 2013 by Hugo Mercier
|
||||
Email : hugo dot mercier at oslandia dot com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Hugo Mercier'
|
||||
__date__ = 'July 2013'
|
||||
__copyright__ = '(C) 2013, Hugo Mercier'
|
||||
|
||||
import os
|
||||
|
||||
|
||||
class Test:
|
||||
|
||||
def __init__(self, iface):
|
||||
pass
|
||||
|
||||
def initGui(self):
|
||||
assert False
|
||||
|
||||
def initProcessing(self):
|
||||
pass
|
||||
|
||||
def unload(self):
|
||||
pass
|
||||
|
||||
|
||||
def classFactory(iface):
|
||||
# load Test class from file Test
|
||||
return Test(iface)
|
7
tests/testdata/test_plugin_path/ProcessingPluginTest2/metadata.txt
vendored
Normal file
7
tests/testdata/test_plugin_path/ProcessingPluginTest2/metadata.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
[general]
|
||||
name=processing plugin test 2
|
||||
qgisMinimumVersion=3.8
|
||||
description=desc
|
||||
version=0.1
|
||||
author=matt cauthin
|
||||
hasProcessingProvider=True
|
Loading…
x
Reference in New Issue
Block a user