Skip to content

Commit

Permalink
[processing] get layers list using map layer registry
Browse files Browse the repository at this point in the history
fixes #16919
  • Loading branch information
volaya committed Jul 24, 2017
1 parent a3bb3f1 commit 3ee5d18
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/plugins/processing/tools/dataobjects.py
Expand Up @@ -74,7 +74,7 @@ def getSupportedOutputTableExtensions():


def getRasterLayers(sorting=True):
layers = QgsProject.instance().layerTreeRoot().findLayers()
layers = QgsMapLayerRegistry.instance().mapLayers().values()
raster = [lay.layer() for lay in layers if lay.layer() is not None and canUseRasterLayer(lay.layer())]
if sorting:
return sorted(raster, key=lambda layer: layer.name().lower())
Expand All @@ -83,7 +83,7 @@ def getRasterLayers(sorting=True):


def getVectorLayers(shapetype=[-1], sorting=True):
layers = QgsProject.instance().layerTreeRoot().findLayers()
layers = QgsMapLayerRegistry.instance().mapLayers().values()
vector = [lay.layer() for lay in layers if canUseVectorLayer(lay.layer(), shapetype)]
if sorting:
return sorted(vector, key=lambda layer: layer.name().lower())
Expand Down Expand Up @@ -115,7 +115,7 @@ def getAllLayers():


def getTables(sorting=True):
layers = QgsProject.instance().layerTreeRoot().findLayers()
layers = QgsMapLayerRegistry.instance().mapLayers().values()
tables = []
for layer in layers:
mapLayer = layer.layer()
Expand Down

0 comments on commit 3ee5d18

Please sign in to comment.