[processing] allow selecting input from open layers only if input is a

layer-type (e.g. raster, vector, mesh). All other inputs can be selected
only from filesystem
This commit is contained in:
Alexander Bruy 2019-05-14 15:34:55 +03:00
parent 449c9ce86c
commit 5844a0fc90

View File

@ -85,8 +85,13 @@ class BatchInputSelectionPanel(QWidget):
def showPopupMenu(self):
popupmenu = QMenu()
if (isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() != QgsProcessing.TypeFile):
isLayerParam = isinstance(self.param, (QgsProcessingParameterRasterLayer,
QgsProcessingParameterVectorLayer,
QgsProcessingParameterMeshLayer,
QgsProcessingParameterFeatureSource))
if isLayerParam or (isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() != QgsProcessing.TypeFile):
selectLayerAction = QAction(self.tr('Select from Open Layers…'), self.pushButton)
selectLayerAction.triggered.connect(self.showLayerSelectionDialog)
popupmenu.addAction(selectLayerAction)