mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
[processing] Fix warning when loading algorithm dialog and no layers
are present Fixes #21631
This commit is contained in:
parent
db75122089
commit
c66159bd2d
@ -1630,12 +1630,15 @@ class TableFieldWidgetWrapper(WidgetWrapper):
|
||||
if isinstance(layer, QgsProcessingFeatureSourceDefinition):
|
||||
layer, ok = layer.source.valueAsString(self.context.expressionContext())
|
||||
if isinstance(layer, str):
|
||||
layer = QgsProcessingUtils.mapLayerFromString(layer, self.context)
|
||||
if not isinstance(layer, QgsVectorLayer) or not layer.isValid():
|
||||
self.dialog.messageBar().clearWidgets()
|
||||
self.dialog.messageBar().pushMessage("", self.tr("Could not load selected layer/table. Dependent field could not be populated"),
|
||||
level=Qgis.Warning, duration=5)
|
||||
return
|
||||
if not layer: # empty string
|
||||
layer = None
|
||||
else:
|
||||
layer = QgsProcessingUtils.mapLayerFromString(layer, self.context)
|
||||
if not isinstance(layer, QgsVectorLayer) or not layer.isValid():
|
||||
self.dialog.messageBar().clearWidgets()
|
||||
self.dialog.messageBar().pushMessage("", self.tr("Could not load selected layer/table. Dependent field could not be populated"),
|
||||
level=Qgis.Warning, duration=5)
|
||||
return
|
||||
|
||||
self._layer = layer
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user