Skip to content

Commit b318aff

Browse files
committed
Fix multi layer parameters in models not giving all options for inputs
1 parent c54667c commit b318aff

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

python/plugins/processing/gui/wrappers.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -524,20 +524,20 @@ class MultipleInputWidgetWrapper(WidgetWrapper):
524524

525525
def _getOptions(self):
526526
if self.param.layerType() == QgsProcessing.TypeVectorAny:
527-
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFeatureSource, QgsProcessingOutputVectorLayer)
527+
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer)
528528
elif self.param.layerType() == QgsProcessing.TypeVectorPoint:
529-
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFeatureSource, QgsProcessingOutputVectorLayer,
529+
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
530530
[QgsProcessing.TypeVectorPoint, QgsProcessing.TypeVectorAny])
531531
elif self.param.layerType() == QgsProcessing.TypeVectorLine:
532-
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFeatureSource, QgsProcessingOutputVectorLayer,
532+
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
533533
[QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorAny])
534534
elif self.param.layerType() == QgsProcessing.TypeVectorPolygon:
535-
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFeatureSource, QgsProcessingOutputVectorLayer,
535+
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
536536
[QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeVectorAny])
537537
elif self.param.layerType() == QgsProcessing.TypeRaster:
538-
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterRasterLayer, QgsProcessingOutputRasterLayer)
538+
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterRasterLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputRasterLayer)
539539
elif self.param.layerType() == QgsProcessing.TypeTable:
540-
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterVectorLayer, OutputTable)
540+
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), OutputTable)
541541
else:
542542
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFile, OutputFile)
543543
options = sorted(options, key=lambda opt: self.dialog.resolveValueDescription(opt))

python/plugins/processing/modeler/ModelerParametersDialog.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
QgsProcessingModelChildAlgorithm,
4545
QgsProcessingModelChildParameterSource,
4646
QgsProcessingParameterFeatureSink,
47+
QgsProcessingParameterMultipleLayers,
4748
QgsProcessingParameterRasterDestination,
4849
QgsProcessingParameterFileDestination,
4950
QgsProcessingParameterFolderDestination,
@@ -236,11 +237,11 @@ def getAvailableValuesOfType(self, paramType, outTypes=[], dataTypes=[]):
236237
# upgrade paramType to list
237238
if paramType is None:
238239
paramType = []
239-
elif not isinstance(paramType, list):
240+
elif not isinstance(paramType, (tuple, list)):
240241
paramType = [paramType]
241242
if outTypes is None:
242243
outTypes = []
243-
elif not isinstance(outTypes, list):
244+
elif not isinstance(outTypes, (tuple, list)):
244245
outTypes = [outTypes]
245246

246247
return self.model.availableSourcesForChild(self.childId, [p.typeName() for p in paramType if issubclass(p, QgsProcessingParameterDefinition)],

0 commit comments

Comments
 (0)