Skip to content
Permalink
Browse files
Remove AlgorithmProvider
Totally ported to QgsProcessingProvider
  • Loading branch information
nyalldawson committed Apr 7, 2017
1 parent 42a6141 commit fdcf04f9f3060f738628a8375111677fa35b6ce8
@@ -2163,7 +2163,7 @@ Processing {#qgis_api_break_3_0_Processing}
----------

- Algorithm providers now subclass the c++ QgsProcessingProvider class, and must be adapted to the API for QgsProcessingProvider. Specifically,
getName() should be replaced with id(), getDescription() with name(), and getIcon with icon().
getName() should be replaced with id(), getDescription() with name(), and getIcon with icon(). AlgorithmProvider was removed.
- Algorithm's processAlgorithm method now passes a QgsProcessingFeedback object instead of the loosely defined progress parameter. Algorithms will
need to update their use of the progress argument to utilize the QgsProcessingFeedback API.
- Similarly, Python processing scripts no longer have access to a progress variable for reporting their progress. Instead they have a feedback
@@ -25,12 +25,12 @@

__revision__ = '$Format:%H$'

from processing.core.AlgorithmProvider import AlgorithmProvider
from qgis.core import QgsProcessingProvider
from processing.core.ProcessingConfig import Setting, ProcessingConfig
from exampleprovider.ExampleAlgorithm import ExampleAlgorithm


class ExampleAlgorithmProvider(AlgorithmProvider):
class ExampleAlgorithmProvider(QgsProcessingProvider):

MY_DUMMY_SETTING = 'MY_DUMMY_SETTING'

@@ -81,7 +81,7 @@ def name(self):
def icon(self):
"""We return the default icon.
"""
return AlgorithmProvider.icon(self)
return QgsProcessingProvider.icon(self)

def loadAlgorithms(self):
"""Here we fill the list of algorithms in self.algs.
@@ -28,8 +28,8 @@
import os

from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsApplication
from processing.core.AlgorithmProvider import AlgorithmProvider
from qgis.core import (QgsApplication,
QgsProcessingProvider)
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from .GdalUtils import GdalUtils

@@ -88,7 +88,7 @@
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class GdalAlgorithmProvider(AlgorithmProvider):
class GdalAlgorithmProvider(QgsProcessingProvider):

"""This provider incorporates GDAL-based algorithms into the
Processing framework.
@@ -28,9 +28,9 @@

import os
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsApplication
from qgis.core import (QgsApplication,
QgsProcessingProvider)
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.core.ProcessingLog import ProcessingLog
from .Grass7Utils import Grass7Utils
from .Grass7Algorithm import Grass7Algorithm
@@ -41,7 +41,7 @@
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class Grass7AlgorithmProvider(AlgorithmProvider):
class Grass7AlgorithmProvider(QgsProcessingProvider):

def __init__(self):
super().__init__()
@@ -33,9 +33,9 @@
except:
hasPlotly = False

from qgis.core import QgsApplication
from qgis.core import (QgsApplication,
QgsProcessingProvider)

from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.script.ScriptUtils import ScriptUtils

from .RegularPoints import RegularPoints
@@ -188,7 +188,7 @@
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class QGISAlgorithmProvider(AlgorithmProvider):
class QGISAlgorithmProvider(QgsProcessingProvider):

def __init__(self):
super().__init__()
@@ -29,10 +29,10 @@
import os

from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsApplication
from qgis.core import (QgsApplication,
QgsProcessingProvider)
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.ProcessingLog import ProcessingLog
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.gui.EditScriptAction import EditScriptAction
from processing.gui.DeleteScriptAction import DeleteScriptAction
from processing.gui.CreateNewScriptAction import CreateNewScriptAction
@@ -49,7 +49,7 @@
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class RAlgorithmProvider(AlgorithmProvider):
class RAlgorithmProvider(QgsProcessingProvider):

def __init__(self):
super().__init__()
@@ -29,7 +29,7 @@
import os
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtCore import QCoreApplication
from processing.core.AlgorithmProvider import AlgorithmProvider
from qgis.core import QgsProcessingProvider
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.ProcessingLog import ProcessingLog
from processing.tools.system import isWindows, isMac
@@ -42,7 +42,7 @@
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class SagaAlgorithmProvider(AlgorithmProvider):
class SagaAlgorithmProvider(QgsProcessingProvider):

def __init__(self):
super().__init__()

This file was deleted.

@@ -38,10 +38,10 @@

from qgis.utils import iface
from qgis.core import (QgsMessageLog,
QgsApplication)
QgsApplication,
QgsProcessingProvider)

import processing
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.script.ScriptUtils import ScriptUtils
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.GeoAlgorithm import GeoAlgorithm
@@ -99,7 +99,7 @@ def removeProvider(provider):

@staticmethod
def activateProvider(providerOrName, activate=True):
provider_id = providerOrName.id() if isinstance(providerOrName, AlgorithmProvider) else providerOrName
provider_id = providerOrName.id() if isinstance(providerOrName, QgsProcessingProvider) else providerOrName
provider = QgsApplication.processingRegistry().providerById(provider_id)
try:
provider.setActive(True)
@@ -114,7 +114,7 @@ def initialize():
if "model" in [p.id() for p in QgsApplication.processingRegistry().providers()]:
return
# Add the basic providers
for c in AlgorithmProvider.__subclasses__():
for c in QgsProcessingProvider.__subclasses__():
Processing.addProvider(c())
# And initialize
ProcessingConfig.initialize()
@@ -27,9 +27,9 @@

import os

from qgis.core import QgsApplication
from qgis.core import (QgsApplication,
QgsProcessingProvider)

from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.ProcessingLog import ProcessingLog
from processing.modeler.ModelerUtils import ModelerUtils
@@ -46,7 +46,7 @@
pluginPath = os.path.split(os.path.dirname(__file__))[0]


class ModelerAlgorithmProvider(AlgorithmProvider):
class ModelerAlgorithmProvider(QgsProcessingProvider):

def __init__(self):
super().__init__()
@@ -27,15 +27,15 @@

import os

from qgis.core import QgsProcessingProvider
from processing.preconfigured.PreconfiguredAlgorithm import PreconfiguredAlgorithm
from processing.preconfigured.PreconfiguredUtils import preconfiguredAlgorithmsFolder
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.preconfigured.NewPreconfiguredAlgorithmAction import NewPreconfiguredAlgorithmAction
from processing.preconfigured.DeletePreconfiguredAlgorithmAction import DeletePreconfiguredAlgorithmAction
from processing.gui.ProviderActions import ProviderContextMenuActions


class PreconfiguredAlgorithmProvider(AlgorithmProvider):
class PreconfiguredAlgorithmProvider(QgsProcessingProvider):

def __init__(self):
super().__init__()
@@ -27,10 +27,10 @@

import os

from qgis.core import QgsApplication
from qgis.core import (QgsApplication,
QgsProcessingProvider)

from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.gui.EditScriptAction import EditScriptAction
from processing.gui.DeleteScriptAction import DeleteScriptAction
from processing.gui.CreateNewScriptAction import CreateNewScriptAction
@@ -44,7 +44,7 @@
pluginPath = os.path.split(os.path.dirname(__file__))[0]


class ScriptAlgorithmProvider(AlgorithmProvider):
class ScriptAlgorithmProvider(QgsProcessingProvider):

def __init__(self):
super().__init__()

0 comments on commit fdcf04f

Please sign in to comment.