mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
Fix multi layer parameters in models not giving all options for inputs
This commit is contained in:
parent
c54667c3b1
commit
b318aff6ff
@ -524,20 +524,20 @@ class MultipleInputWidgetWrapper(WidgetWrapper):
|
||||
|
||||
def _getOptions(self):
|
||||
if self.param.layerType() == QgsProcessing.TypeVectorAny:
|
||||
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFeatureSource, QgsProcessingOutputVectorLayer)
|
||||
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer)
|
||||
elif self.param.layerType() == QgsProcessing.TypeVectorPoint:
|
||||
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFeatureSource, QgsProcessingOutputVectorLayer,
|
||||
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
|
||||
[QgsProcessing.TypeVectorPoint, QgsProcessing.TypeVectorAny])
|
||||
elif self.param.layerType() == QgsProcessing.TypeVectorLine:
|
||||
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFeatureSource, QgsProcessingOutputVectorLayer,
|
||||
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
|
||||
[QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorAny])
|
||||
elif self.param.layerType() == QgsProcessing.TypeVectorPolygon:
|
||||
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFeatureSource, QgsProcessingOutputVectorLayer,
|
||||
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
|
||||
[QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeVectorAny])
|
||||
elif self.param.layerType() == QgsProcessing.TypeRaster:
|
||||
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterRasterLayer, QgsProcessingOutputRasterLayer)
|
||||
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterRasterLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputRasterLayer)
|
||||
elif self.param.layerType() == QgsProcessing.TypeTable:
|
||||
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterVectorLayer, OutputTable)
|
||||
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), OutputTable)
|
||||
else:
|
||||
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFile, OutputFile)
|
||||
options = sorted(options, key=lambda opt: self.dialog.resolveValueDescription(opt))
|
||||
|
||||
@ -44,6 +44,7 @@ from qgis.core import (QgsProcessingParameterDefinition,
|
||||
QgsProcessingModelChildAlgorithm,
|
||||
QgsProcessingModelChildParameterSource,
|
||||
QgsProcessingParameterFeatureSink,
|
||||
QgsProcessingParameterMultipleLayers,
|
||||
QgsProcessingParameterRasterDestination,
|
||||
QgsProcessingParameterFileDestination,
|
||||
QgsProcessingParameterFolderDestination,
|
||||
@ -236,11 +237,11 @@ class ModelerParametersDialog(QDialog):
|
||||
# upgrade paramType to list
|
||||
if paramType is None:
|
||||
paramType = []
|
||||
elif not isinstance(paramType, list):
|
||||
elif not isinstance(paramType, (tuple, list)):
|
||||
paramType = [paramType]
|
||||
if outTypes is None:
|
||||
outTypes = []
|
||||
elif not isinstance(outTypes, list):
|
||||
elif not isinstance(outTypes, (tuple, list)):
|
||||
outTypes = [outTypes]
|
||||
|
||||
return self.model.availableSourcesForChild(self.childId, [p.typeName() for p in paramType if issubclass(p, QgsProcessingParameterDefinition)],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user