Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[processing] Fix warning when loading algorithm dialog and no layers
- Loading branch information
Showing
with
9 additions
and
6 deletions.
-
+9
−6
python/plugins/processing/gui/wrappers.py
|
@@ -1630,12 +1630,15 @@ def setLayer(self, layer): |
|
|
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 |
|
|
|
|
|