mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Make model editor dialog more robust while loading models
This commit is contained in:
parent
9d04f87249
commit
0836c60712
@ -177,7 +177,10 @@ class WidgetWrapper(QObject):
|
||||
if combobox is None:
|
||||
combobox = self.widget
|
||||
if isinstance(value, list):
|
||||
value = value[0]
|
||||
if value:
|
||||
value = value[0]
|
||||
else:
|
||||
value = None
|
||||
values = [combobox.itemData(i) for i in range(combobox.count())]
|
||||
try:
|
||||
idx = values.index(value)
|
||||
|
@ -251,11 +251,14 @@ class ModelerParametersDialog(QDialog):
|
||||
for param in alg.algorithm().parameterDefinitions():
|
||||
if param.isDestination() or param.flags() & QgsProcessingParameterDefinition.FlagHidden:
|
||||
continue
|
||||
value = None
|
||||
if param.name() in alg.parameterSources():
|
||||
value = alg.parameterSources()[param.name()]
|
||||
if isinstance(value, list) and len(value) == 1:
|
||||
value = value[0]
|
||||
else:
|
||||
elif isinstance(value, list) and len(value) == 0:
|
||||
value = None
|
||||
if value is None:
|
||||
value = param.defaultValue()
|
||||
|
||||
if isinstance(value, QgsProcessingModelAlgorithm.ChildParameterSource) and value.source() == QgsProcessingModelAlgorithm.ChildParameterSource.StaticValue:
|
||||
|
Loading…
x
Reference in New Issue
Block a user