Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Mark some Processing methods as deprecated
  • Loading branch information
nyalldawson committed Mar 28, 2019
1 parent 7aca208 commit 234c171
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 1 deletion.
119 changes: 119 additions & 0 deletions python/plugins/processing/gui/wrappers.py
Expand Up @@ -273,6 +273,16 @@ def value(self):

class BooleanWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("BooleanWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createLabel(self):
if self.dialogType == DIALOG_STANDARD:
return None
Expand Down Expand Up @@ -313,6 +323,16 @@ def value(self):

class CrsWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("CrsWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self):
if self.dialogType == DIALOG_MODELER:
self.combo = QComboBox()
Expand Down Expand Up @@ -458,6 +478,16 @@ def value(self):

class PointWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("PointWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
return PointSelectionPanel(self.dialog, self.parameterDefinition().defaultValue())
Expand Down Expand Up @@ -506,6 +536,16 @@ def value(self):

class FileWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("FileWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
return FileSelectionPanel(self.parameterDefinition().behavior() == QgsProcessingParameterFile.Folder,
Expand Down Expand Up @@ -572,6 +612,16 @@ def value(self):

class FixedTableWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("FixedTableWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
return FixedTablePanel(self.parameterDefinition())
Expand Down Expand Up @@ -768,6 +818,16 @@ def value(self):

class NumberWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("NumberWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
widget = NumberInputPanel(self.parameterDefinition())
Expand Down Expand Up @@ -799,6 +859,16 @@ def parentLayerChanged(self, wrapper):

class DistanceWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("DistanceWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
widget = DistanceInputPanel(self.parameterDefinition())
Expand Down Expand Up @@ -835,6 +905,16 @@ def parentParameterChanged(self, wrapper):

class RangeWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("RangeWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self):
widget = RangePanel(self.parameterDefinition())
widget.hasChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
Expand Down Expand Up @@ -1033,6 +1113,16 @@ def selectFile(self):
class EnumWidgetWrapper(WidgetWrapper):
NOT_SELECTED = '[Not selected]'

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("EnumWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self, useCheckBoxes=False, columns=1):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
self._useCheckBoxes = useCheckBoxes
Expand Down Expand Up @@ -1271,6 +1361,16 @@ def validator(v):

class StringWidgetWrapper(WidgetWrapper):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("StringWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

def createWidget(self):
if self.dialogType == DIALOG_STANDARD:
if self.parameterDefinition().multiLine():
Expand Down Expand Up @@ -1367,6 +1467,14 @@ def validator(v):
class ExpressionWidgetWrapper(WidgetWrapper):

def __init__(self, param, dialog, row=0, col=0, **kwargs):
"""
.. deprecated:: 3.4
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("StringWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

super().__init__(param, dialog, row, col, **kwargs)
self.context = dataobjects.createContext()

Expand Down Expand Up @@ -1881,28 +1989,37 @@ def create_wrapper_from_metadata(param, dialog, row=0, col=0):
def create_wrapper_from_class(param, dialog, row=0, col=0):
wrapper = None
if param.type() == 'boolean':
# deprecated, moved to c++
wrapper = BooleanWidgetWrapper
elif param.type() == 'crs':
# deprecated, moved to c++
wrapper = CrsWidgetWrapper
elif param.type() == 'extent':
wrapper = ExtentWidgetWrapper
elif param.type() == 'point':
# deprecated, moved to c++
wrapper = PointWidgetWrapper
elif param.type() == 'file':
# deprecated, moved to c++
wrapper = FileWidgetWrapper
elif param.type() == 'multilayer':
wrapper = MultipleLayerWidgetWrapper
elif param.type() == 'number':
# deprecated, moved to c++
wrapper = NumberWidgetWrapper
elif param.type() == 'distance':
# deprecated, moved to c++
wrapper = DistanceWidgetWrapper
elif param.type() == 'raster':
wrapper = RasterWidgetWrapper
elif param.type() == 'enum':
# deprecated, moved to c++
wrapper = EnumWidgetWrapper
elif param.type() == 'string':
# deprecated, moved to c++
wrapper = StringWidgetWrapper
elif param.type() == 'expression':
# deprecated, moved to c++
wrapper = ExpressionWidgetWrapper
elif param.type() == 'vector':
wrapper = VectorLayerWidgetWrapper
Expand All @@ -1915,8 +2032,10 @@ def create_wrapper_from_class(param, dialog, row=0, col=0):
elif param.type() == 'layer':
wrapper = MapLayerWidgetWrapper
elif param.type() == 'range':
# deprecated, moved to c++
wrapper = RangeWidgetWrapper
elif param.type() == 'matrix':
# deprecated, moved to c++
wrapper = FixedTableWidgetWrapper
elif param.type() == 'mesh':
wrapper = MeshWidgetWrapper
Expand Down
9 changes: 8 additions & 1 deletion python/plugins/processing/tools/dataobjects.py
Expand Up @@ -105,8 +105,15 @@ def createExpressionContext():


def load(fileName, name=None, crs=None, style=None, isRaster=False):
"""Loads a layer/table into the current project, given its file.
"""
Loads a layer/table into the current project, given its file.
.. deprecated:: 3.0
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("processing.load is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

if fileName is None:
return
Expand Down
8 changes: 8 additions & 0 deletions python/plugins/processing/tools/system.py
Expand Up @@ -118,6 +118,14 @@ def tempHelpFolder():


def escapeAndJoin(strList):
"""
.. deprecated:: 3.0
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("processing.escapeAndJoin is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

joined = ''
for s in strList:
if s[0] != '-' and ' ' in s:
Expand Down

0 comments on commit 234c171

Please sign in to comment.