mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -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:
|
if combobox is None:
|
||||||
combobox = self.widget
|
combobox = self.widget
|
||||||
if isinstance(value, list):
|
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())]
|
values = [combobox.itemData(i) for i in range(combobox.count())]
|
||||||
try:
|
try:
|
||||||
idx = values.index(value)
|
idx = values.index(value)
|
||||||
|
@ -251,11 +251,14 @@ class ModelerParametersDialog(QDialog):
|
|||||||
for param in alg.algorithm().parameterDefinitions():
|
for param in alg.algorithm().parameterDefinitions():
|
||||||
if param.isDestination() or param.flags() & QgsProcessingParameterDefinition.FlagHidden:
|
if param.isDestination() or param.flags() & QgsProcessingParameterDefinition.FlagHidden:
|
||||||
continue
|
continue
|
||||||
|
value = None
|
||||||
if param.name() in alg.parameterSources():
|
if param.name() in alg.parameterSources():
|
||||||
value = alg.parameterSources()[param.name()]
|
value = alg.parameterSources()[param.name()]
|
||||||
if isinstance(value, list) and len(value) == 1:
|
if isinstance(value, list) and len(value) == 1:
|
||||||
value = value[0]
|
value = value[0]
|
||||||
else:
|
elif isinstance(value, list) and len(value) == 0:
|
||||||
|
value = None
|
||||||
|
if value is None:
|
||||||
value = param.defaultValue()
|
value = param.defaultValue()
|
||||||
|
|
||||||
if isinstance(value, QgsProcessingModelAlgorithm.ChildParameterSource) and value.source() == QgsProcessingModelAlgorithm.ChildParameterSource.StaticValue:
|
if isinstance(value, QgsProcessingModelAlgorithm.ChildParameterSource) and value.source() == QgsProcessingModelAlgorithm.ChildParameterSource.StaticValue:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user