Skip to content

Commit 234c171

Browse files
committed
Mark some Processing methods as deprecated
1 parent 7aca208 commit 234c171

File tree

3 files changed

+135
-1
lines changed

3 files changed

+135
-1
lines changed

python/plugins/processing/gui/wrappers.py

+119
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,16 @@ def value(self):
273273

274274
class BooleanWidgetWrapper(WidgetWrapper):
275275

276+
def __init__(self, *args, **kwargs):
277+
super().__init__(*args, **kwargs)
278+
"""
279+
.. deprecated:: 3.4
280+
Do not use, will be removed in QGIS 4.0
281+
"""
282+
283+
from warnings import warn
284+
warn("BooleanWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
285+
276286
def createLabel(self):
277287
if self.dialogType == DIALOG_STANDARD:
278288
return None
@@ -313,6 +323,16 @@ def value(self):
313323

314324
class CrsWidgetWrapper(WidgetWrapper):
315325

326+
def __init__(self, *args, **kwargs):
327+
super().__init__(*args, **kwargs)
328+
"""
329+
.. deprecated:: 3.4
330+
Do not use, will be removed in QGIS 4.0
331+
"""
332+
333+
from warnings import warn
334+
warn("CrsWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
335+
316336
def createWidget(self):
317337
if self.dialogType == DIALOG_MODELER:
318338
self.combo = QComboBox()
@@ -458,6 +478,16 @@ def value(self):
458478

459479
class PointWidgetWrapper(WidgetWrapper):
460480

481+
def __init__(self, *args, **kwargs):
482+
super().__init__(*args, **kwargs)
483+
"""
484+
.. deprecated:: 3.4
485+
Do not use, will be removed in QGIS 4.0
486+
"""
487+
488+
from warnings import warn
489+
warn("PointWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
490+
461491
def createWidget(self):
462492
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
463493
return PointSelectionPanel(self.dialog, self.parameterDefinition().defaultValue())
@@ -506,6 +536,16 @@ def value(self):
506536

507537
class FileWidgetWrapper(WidgetWrapper):
508538

539+
def __init__(self, *args, **kwargs):
540+
super().__init__(*args, **kwargs)
541+
"""
542+
.. deprecated:: 3.4
543+
Do not use, will be removed in QGIS 4.0
544+
"""
545+
546+
from warnings import warn
547+
warn("FileWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
548+
509549
def createWidget(self):
510550
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
511551
return FileSelectionPanel(self.parameterDefinition().behavior() == QgsProcessingParameterFile.Folder,
@@ -572,6 +612,16 @@ def value(self):
572612

573613
class FixedTableWidgetWrapper(WidgetWrapper):
574614

615+
def __init__(self, *args, **kwargs):
616+
super().__init__(*args, **kwargs)
617+
"""
618+
.. deprecated:: 3.4
619+
Do not use, will be removed in QGIS 4.0
620+
"""
621+
622+
from warnings import warn
623+
warn("FixedTableWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
624+
575625
def createWidget(self):
576626
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
577627
return FixedTablePanel(self.parameterDefinition())
@@ -768,6 +818,16 @@ def value(self):
768818

769819
class NumberWidgetWrapper(WidgetWrapper):
770820

821+
def __init__(self, *args, **kwargs):
822+
super().__init__(*args, **kwargs)
823+
"""
824+
.. deprecated:: 3.4
825+
Do not use, will be removed in QGIS 4.0
826+
"""
827+
828+
from warnings import warn
829+
warn("NumberWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
830+
771831
def createWidget(self):
772832
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
773833
widget = NumberInputPanel(self.parameterDefinition())
@@ -799,6 +859,16 @@ def parentLayerChanged(self, wrapper):
799859

800860
class DistanceWidgetWrapper(WidgetWrapper):
801861

862+
def __init__(self, *args, **kwargs):
863+
super().__init__(*args, **kwargs)
864+
"""
865+
.. deprecated:: 3.4
866+
Do not use, will be removed in QGIS 4.0
867+
"""
868+
869+
from warnings import warn
870+
warn("DistanceWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
871+
802872
def createWidget(self):
803873
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
804874
widget = DistanceInputPanel(self.parameterDefinition())
@@ -835,6 +905,16 @@ def parentParameterChanged(self, wrapper):
835905

836906
class RangeWidgetWrapper(WidgetWrapper):
837907

908+
def __init__(self, *args, **kwargs):
909+
super().__init__(*args, **kwargs)
910+
"""
911+
.. deprecated:: 3.4
912+
Do not use, will be removed in QGIS 4.0
913+
"""
914+
915+
from warnings import warn
916+
warn("RangeWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
917+
838918
def createWidget(self):
839919
widget = RangePanel(self.parameterDefinition())
840920
widget.hasChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
@@ -1033,6 +1113,16 @@ def selectFile(self):
10331113
class EnumWidgetWrapper(WidgetWrapper):
10341114
NOT_SELECTED = '[Not selected]'
10351115

1116+
def __init__(self, *args, **kwargs):
1117+
super().__init__(*args, **kwargs)
1118+
"""
1119+
.. deprecated:: 3.4
1120+
Do not use, will be removed in QGIS 4.0
1121+
"""
1122+
1123+
from warnings import warn
1124+
warn("EnumWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
1125+
10361126
def createWidget(self, useCheckBoxes=False, columns=1):
10371127
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
10381128
self._useCheckBoxes = useCheckBoxes
@@ -1271,6 +1361,16 @@ def validator(v):
12711361

12721362
class StringWidgetWrapper(WidgetWrapper):
12731363

1364+
def __init__(self, *args, **kwargs):
1365+
super().__init__(*args, **kwargs)
1366+
"""
1367+
.. deprecated:: 3.4
1368+
Do not use, will be removed in QGIS 4.0
1369+
"""
1370+
1371+
from warnings import warn
1372+
warn("StringWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
1373+
12741374
def createWidget(self):
12751375
if self.dialogType == DIALOG_STANDARD:
12761376
if self.parameterDefinition().multiLine():
@@ -1367,6 +1467,14 @@ def validator(v):
13671467
class ExpressionWidgetWrapper(WidgetWrapper):
13681468

13691469
def __init__(self, param, dialog, row=0, col=0, **kwargs):
1470+
"""
1471+
.. deprecated:: 3.4
1472+
Do not use, will be removed in QGIS 4.0
1473+
"""
1474+
1475+
from warnings import warn
1476+
warn("StringWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
1477+
13701478
super().__init__(param, dialog, row, col, **kwargs)
13711479
self.context = dataobjects.createContext()
13721480

@@ -1881,28 +1989,37 @@ def create_wrapper_from_metadata(param, dialog, row=0, col=0):
18811989
def create_wrapper_from_class(param, dialog, row=0, col=0):
18821990
wrapper = None
18831991
if param.type() == 'boolean':
1992+
# deprecated, moved to c++
18841993
wrapper = BooleanWidgetWrapper
18851994
elif param.type() == 'crs':
1995+
# deprecated, moved to c++
18861996
wrapper = CrsWidgetWrapper
18871997
elif param.type() == 'extent':
18881998
wrapper = ExtentWidgetWrapper
18891999
elif param.type() == 'point':
2000+
# deprecated, moved to c++
18902001
wrapper = PointWidgetWrapper
18912002
elif param.type() == 'file':
2003+
# deprecated, moved to c++
18922004
wrapper = FileWidgetWrapper
18932005
elif param.type() == 'multilayer':
18942006
wrapper = MultipleLayerWidgetWrapper
18952007
elif param.type() == 'number':
2008+
# deprecated, moved to c++
18962009
wrapper = NumberWidgetWrapper
18972010
elif param.type() == 'distance':
2011+
# deprecated, moved to c++
18982012
wrapper = DistanceWidgetWrapper
18992013
elif param.type() == 'raster':
19002014
wrapper = RasterWidgetWrapper
19012015
elif param.type() == 'enum':
2016+
# deprecated, moved to c++
19022017
wrapper = EnumWidgetWrapper
19032018
elif param.type() == 'string':
2019+
# deprecated, moved to c++
19042020
wrapper = StringWidgetWrapper
19052021
elif param.type() == 'expression':
2022+
# deprecated, moved to c++
19062023
wrapper = ExpressionWidgetWrapper
19072024
elif param.type() == 'vector':
19082025
wrapper = VectorLayerWidgetWrapper
@@ -1915,8 +2032,10 @@ def create_wrapper_from_class(param, dialog, row=0, col=0):
19152032
elif param.type() == 'layer':
19162033
wrapper = MapLayerWidgetWrapper
19172034
elif param.type() == 'range':
2035+
# deprecated, moved to c++
19182036
wrapper = RangeWidgetWrapper
19192037
elif param.type() == 'matrix':
2038+
# deprecated, moved to c++
19202039
wrapper = FixedTableWidgetWrapper
19212040
elif param.type() == 'mesh':
19222041
wrapper = MeshWidgetWrapper

python/plugins/processing/tools/dataobjects.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,15 @@ def createExpressionContext():
105105

106106

107107
def load(fileName, name=None, crs=None, style=None, isRaster=False):
108-
"""Loads a layer/table into the current project, given its file.
109108
"""
109+
Loads a layer/table into the current project, given its file.
110+
111+
.. deprecated:: 3.0
112+
Do not use, will be removed in QGIS 4.0
113+
"""
114+
115+
from warnings import warn
116+
warn("processing.load is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
110117

111118
if fileName is None:
112119
return

python/plugins/processing/tools/system.py

+8
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ def tempHelpFolder():
118118

119119

120120
def escapeAndJoin(strList):
121+
"""
122+
.. deprecated:: 3.0
123+
Do not use, will be removed in QGIS 4.0
124+
"""
125+
126+
from warnings import warn
127+
warn("processing.escapeAndJoin is deprecated and will be removed in QGIS 4.0", DeprecationWarning)
128+
121129
joined = ''
122130
for s in strList:
123131
if s[0] != '-' and ' ' in s:

0 commit comments

Comments
 (0)