Skip to content

Commit

Permalink
Remove AlgorithmProvider
Browse files Browse the repository at this point in the history
Totally ported to QgsProcessingProvider
  • Loading branch information
nyalldawson committed Apr 7, 2017
1 parent 42a6141 commit fdcf04f
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 71 deletions.
2 changes: 1 addition & 1 deletion doc/api_break.dox
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/r/RAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__()
Expand Down
41 changes: 0 additions & 41 deletions python/plugins/processing/core/AlgorithmProvider.py

This file was deleted.

8 changes: 4 additions & 4 deletions python/plugins/processing/core/Processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/modeler/ModelerAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,7 +46,7 @@
pluginPath = os.path.split(os.path.dirname(__file__))[0]


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

def __init__(self):
super().__init__()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/script/ScriptAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -44,7 +44,7 @@
pluginPath = os.path.split(os.path.dirname(__file__))[0]


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

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

0 comments on commit fdcf04f

Please sign in to comment.