Skip to content
Permalink
Browse files

allow selection of file paths for mesh layers [processings] (#8702)

allow selection of file paths for mesh layers
  • Loading branch information
PeterPetrik committed Dec 20, 2018
1 parent be34a0e commit 9ce7e54fb17c355f0b1fa919f05531ca8a045e90
@@ -40,6 +40,7 @@
QgsProcessingParameterRasterLayer,
QgsProcessingParameterDefinition,
QgsProcessingParameterVectorLayer,
QgsProcessingParameterMeshLayer,
QgsProcessingParameterFeatureSource)

from processing.gui.MultipleInputDialog import MultipleInputDialog
@@ -101,11 +102,15 @@ def showPopupMenu(self):
def showLayerSelectionDialog(self):
layers = []
if (isinstance(self.param, QgsProcessingParameterRasterLayer) or
(isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() == QgsProcessing.TypeRaster)):
(isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() == QgsProcessing.TypeRaster)):
layers = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance())
elif isinstance(self.param, QgsProcessingParameterVectorLayer):
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
elif (isinstance(self.param, QgsProcessingParameterMeshLayer) or
(isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() == QgsProcessing.TypeMesh)):
layers = QgsProcessingUtils.compatibleMeshLayers(QgsProject.instance())
else:
datatypes = [QgsProcessing.TypeVectorAnyGeometry]
if isinstance(self.param, QgsProcessingParameterFeatureSource):
@@ -1015,7 +1015,13 @@ def setComboBoxFilters(self, combo):
def selectFile(self):
filename, selected_filter = self.getFileName(self.combo.currentText())
if filename:
self.combo.setEditText(filename)
if isinstance(self.combo, QgsMapLayerComboBox):
items = self.combo.additionalItems()
items.append(filename)
self.combo.setAdditionalItems(items)
self.combo.setCurrentIndex(self.combo.findText(filename))
else:
self.combo.setEditText(filename)
self.widgetValueHasChanged.emit(self)


0 comments on commit 9ce7e54

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