Skip to content
Permalink
Browse files

[processing] scripts also can be feature-based algorithms

  • Loading branch information
alexbruy committed Feb 5, 2018
1 parent cd7bb16 commit fa5ab81a2a0867fac090551770652840b50d18f6
@@ -37,7 +37,11 @@
QFileDialog)

from qgis.gui import QgsGui, QgsErrorDialog
from qgis.core import QgsApplication, QgsSettings, QgsError, QgsProcessingAlgorithm
from qgis.core import (QgsApplication,
QgsSettings,
QgsError,
QgsProcessingAlgorithm,
QgsProcessingFeatureBasedAlgorithm)
from qgis.utils import iface, OverrideCursor

from processing.gui.AlgorithmDialog import AlgorithmDialog
@@ -208,7 +212,7 @@ def runAlgorithm(self):

alg = None
for k, v in d.items():
if inspect.isclass(v) and issubclass(v, QgsProcessingAlgorithm) and v.__name__ != "QgsProcessingAlgorithm":
if inspect.isclass(v) and issubclass(v, (QgsProcessingAlgorithm, QgsProcessingFeatureBasedAlgorithm)) and v.__name__ not in ("QgsProcessingAlgorithm", "QgsProcessingFeatureBasedAlgorithm"):
alg = v()
break

@@ -31,7 +31,10 @@

from qgis.PyQt.QtCore import QCoreApplication

from qgis.core import QgsProcessingAlgorithm, QgsMessageLog
from qgis.core import (QgsProcessingAlgorithm,
QgsProcessingFeatureBasedAlgorithm,
QgsMessageLog
)

from processing.core.ProcessingConfig import ProcessingConfig
from processing.tools.system import mkdir, userFolder
@@ -64,7 +67,7 @@ def loadAlgorithm(moduleName, filePath):
spec.loader.exec_module(module)
for x in dir(module):
obj = getattr(module, x)
if inspect.isclass(obj) and issubclass(obj, QgsProcessingAlgorithm) and obj.__name__ != "QgsProcessingAlgorithm":
if inspect.isclass(obj) and issubclass(obj, (QgsProcessingAlgorithm, QgsProcessingFeatureBasedAlgorithm)) and obj.__name__ not in ("QgsProcessingAlgorithm", "QgsProcessingFeatureBasedAlgorithm"):
scriptsRegistry[x] = filePath
return obj()
except ImportError as e:

0 comments on commit fa5ab81

Please sign in to comment.
You can’t perform that action at this time.