Skip to content

Commit

Permalink
allow selection of file paths for mesh layers [processings] (#8702)
Browse files Browse the repository at this point in the history
allow selection of file paths for mesh layers
  • Loading branch information
PeterPetrik authored Dec 20, 2018
1 parent be34a0e commit 9ce7e54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions python/plugins/processing/gui/BatchInputSelectionPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
QgsProcessingParameterRasterLayer,
QgsProcessingParameterDefinition,
QgsProcessingParameterVectorLayer,
QgsProcessingParameterMeshLayer,
QgsProcessingParameterFeatureSource)

from processing.gui.MultipleInputDialog import MultipleInputDialog
Expand Down Expand Up @@ -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):
Expand Down
8 changes: 7 additions & 1 deletion python/plugins/processing/gui/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 9ce7e54

Please sign in to comment.