Style fixes

This commit is contained in:
Nyall Dawson 2017-05-16 10:32:48 +10:00
parent e260be111e
commit 5a0bcf0776
5 changed files with 8 additions and 7 deletions

View File

@ -118,7 +118,7 @@ class QgsLocatorFilter : QObject
results from this filter. results from this filter.
.. note:: .. note::
Plugins are not permitted to utilise prefixes with < 3 characters, Plugins are not permitted to utilize prefixes with < 3 characters,
as these are reserved for core QGIS functions. If a plugin registers as these are reserved for core QGIS functions. If a plugin registers
a filter with a prefix shorter than 3 characters then the prefix will a filter with a prefix shorter than 3 characters then the prefix will
be ignored. be ignored.

View File

@ -34,6 +34,7 @@ from processing.gui.MessageDialog import MessageDialog
from processing.gui.AlgorithmDialog import AlgorithmDialog from processing.gui.AlgorithmDialog import AlgorithmDialog
from qgis.utils import iface from qgis.utils import iface
class AlgorithmLocatorFilter(QgsLocatorFilter): class AlgorithmLocatorFilter(QgsLocatorFilter):
def __init__(self, parent=None): def __init__(self, parent=None):
@ -51,20 +52,20 @@ class AlgorithmLocatorFilter(QgsLocatorFilter):
def prefix(self): def prefix(self):
return 'a' return 'a'
def fetchResults(self,string,context,feedback): def fetchResults(self, string, context, feedback):
for a in QgsApplication.processingRegistry().algorithms(): for a in QgsApplication.processingRegistry().algorithms():
if feedback.isCanceled(): if feedback.isCanceled():
return return
if a.flags() & QgsProcessingAlgorithm.FlagHideFromToolbox: if a.flags() & QgsProcessingAlgorithm.FlagHideFromToolbox:
continue continue
if QgsLocatorFilter.stringMatches(a.displayName(),string) or [t for t in a.tags() if QgsLocatorFilter.stringMatches(t,string)]: if QgsLocatorFilter.stringMatches(a.displayName(), string) or [t for t in a.tags() if QgsLocatorFilter.stringMatches(t, string)]:
result = QgsLocatorResult() result = QgsLocatorResult()
result.filter = self result.filter = self
result.displayString = a.displayName() result.displayString = a.displayName()
result.icon = a.icon() result.icon = a.icon()
result.userData = a.id() result.userData = a.id()
if QgsLocatorFilter.stringMatches(a.displayName(),string): if string and QgsLocatorFilter.stringMatches(a.displayName(), string):
result.score = float(len(string)) / len(a.displayName()) result.score = float(len(string)) / len(a.displayName())
else: else:
result.score = 0 result.score = 0

View File

@ -108,7 +108,7 @@ QgsActionLocatorFilter::QgsActionLocatorFilter( const QList<QWidget *> &parentOb
setUseWithoutPrefix( false ); setUseWithoutPrefix( false );
} }
void QgsActionLocatorFilter::fetchResults( const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback ) void QgsActionLocatorFilter::fetchResults( const QString &string, const QgsLocatorContext &, QgsFeedback *feedback )
{ {
QList<QAction *> found; QList<QAction *> found;

View File

@ -137,7 +137,7 @@ class GUI_EXPORT QgsLocatorFilter : public QObject
* Returns the search prefix character(s) for this filter. Prefix a search * Returns the search prefix character(s) for this filter. Prefix a search
* with these characters will restrict the locator search to only include * with these characters will restrict the locator search to only include
* results from this filter. * results from this filter.
* \note Plugins are not permitted to utilise prefixes with < 3 characters, * \note Plugins are not permitted to utilize prefixes with < 3 characters,
* as these are reserved for core QGIS functions. If a plugin registers * as these are reserved for core QGIS functions. If a plugin registers
* a filter with a prefix shorter than 3 characters then the prefix will * a filter with a prefix shorter than 3 characters then the prefix will
* be ignored. * be ignored.

View File

@ -510,7 +510,7 @@ QgsLocatorFilterFilter::QgsLocatorFilterFilter( QgsLocatorWidget *locator, QObje
, mLocator( locator ) , mLocator( locator )
{} {}
void QgsLocatorFilterFilter::fetchResults( const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback ) void QgsLocatorFilterFilter::fetchResults( const QString &string, const QgsLocatorContext &, QgsFeedback *feedback )
{ {
if ( !string.isEmpty() ) if ( !string.isEmpty() )
{ {