def fetchResults(self, string, context, feedback): for i in range(3): #if feedback.isCanceled(): # return sleep(0.00001) result = QgsLocatorResult() result.displayString = self.prefix + str(i) self.resultFetched.emit(result)
def fetchResults(self, string, context, feedback): for a in QgsApplication.processingRegistry().algorithms(): if feedback.isCanceled(): return if a.flags() & QgsProcessingAlgorithm.FlagHideFromToolbox: continue if QgsLocatorFilter.stringMatches(a.displayName(), string) or [t for t in a.tags() if QgsLocatorFilter.stringMatches(t, string)]: result = QgsLocatorResult() result.filter = self result.displayString = a.displayName() result.icon = a.icon() result.userData = a.id() if string and QgsLocatorFilter.stringMatches(a.displayName(), string): result.score = float(len(string)) / len(a.displayName()) else: result.score = 0 self.resultFetched.emit(result)