Skip to content
Permalink
Browse files

[processing] Correctly handle layer type parameter values when

creating an algorithm dialog using processing.execAlgorithmDialog()
  • Loading branch information
nyalldawson committed Jul 17, 2018
1 parent 7973408 commit c65afbdd9794d732ab4abb72f74caa2890f3186c
Showing with 54 additions and 21 deletions.
  1. +54 −21 python/plugins/processing/gui/wrappers.py
@@ -908,13 +908,24 @@ def setValue(self, value):
return

if self.dialogType == DIALOG_STANDARD:
if self.combo.findText(value) >= 0:
self.combo.setCurrentIndex(self.combo.findText(value))
else:
items = self.combo.additionalItems()
items.append(value)
self.combo.setAdditionalItems(items)
self.combo.setCurrentIndex(self.combo.findText(value))
if isinstance(value, str):
layer = QgsProject.instance().mapLayer(value)
if layer is not None:
value = layer

found = False
if isinstance(value, QgsMapLayer):
self.combo.setLayer(value)
found = self.combo.currentIndex() != -1

if not found:
if self.combo.findText(value) >= 0:
self.combo.setCurrentIndex(self.combo.findText(value))
else:
items = self.combo.additionalItems()
items.append(value)
self.combo.setAdditionalItems(items)
self.combo.setCurrentIndex(self.combo.findText(value))
elif self.dialogType == DIALOG_BATCH:
self.widget.setValue(value)
else:
@@ -1146,13 +1157,24 @@ def setValue(self, value):
return

if self.dialogType == DIALOG_STANDARD:
if self.combo.findText(value) >= 0:
self.combo.setCurrentIndex(self.combo.findText(value))
else:
items = self.combo.additionalItems()
items.append(value)
self.combo.setAdditionalItems(items)
self.combo.setCurrentIndex(self.combo.findText(value))
if isinstance(value, str):
layer = QgsProject.instance().mapLayer(value)
if layer is not None:
value = layer

found = False
if isinstance(value, QgsMapLayer):
self.combo.setLayer(value)
found = self.combo.currentIndex() != -1

if not found:
if self.combo.findText(value) >= 0:
self.combo.setCurrentIndex(self.combo.findText(value))
else:
items = self.combo.additionalItems()
items.append(value)
self.combo.setAdditionalItems(items)
self.combo.setCurrentIndex(self.combo.findText(value))
elif self.dialogType == DIALOG_BATCH:
self.widget.setValue(value)
else:
@@ -1448,13 +1470,24 @@ def setValue(self, value):
return

if self.dialogType == DIALOG_STANDARD:
if self.combo.findText(value) >= 0:
self.combo.setCurrentIndex(self.combo.findText(value))
else:
items = self.combo.additionalItems()
items.append(value)
self.combo.setAdditionalItems(items)
self.combo.setCurrentIndex(self.combo.findText(value))
if isinstance(value, str):
layer = QgsProject.instance().mapLayer(value)
if layer is not None:
value = layer

found = False
if isinstance(value, QgsMapLayer):
self.combo.setLayer(value)
found = self.combo.currentIndex() != -1

if not found:
if self.combo.findText(value) >= 0:
self.combo.setCurrentIndex(self.combo.findText(value))
else:
items = self.combo.additionalItems()
items.append(value)
self.combo.setAdditionalItems(items)
self.combo.setCurrentIndex(self.combo.findText(value))
elif self.dialogType == DIALOG_BATCH:
return self.widget.setValue(value)
else:

0 comments on commit c65afbd

Please sign in to comment.
You can’t perform that action at this time.