Package: qgis / 2.4.0-1

0001-processing-methods-in-dataobjects.py-now-return-laye.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 50113cda90596a7642e85e88372cf4b3ca7f5e69 Mon Sep 17 00:00:00 2001
From: Victor Olaya <volayaf@gmail.com>
Date: Sat, 28 Jun 2014 16:48:24 +0200
Subject: [processing] methods in dataobjects.py now return layers ordered by
 name
Origin: https://github.com/qgis/QGIS/commit/50113cda90596a7642e85e88372cf4b3ca7f5e69
Bug: http://hub.qgis.org/issues/10446

fixes #10446

--- a/python/plugins/processing/tools/dataobjects.py
+++ b/python/plugins/processing/tools/dataobjects.py
@@ -76,7 +76,7 @@ def getRasterLayers():
         if layer.type() == layer.RasterLayer:
             if layer.providerType() == 'gdal':  # only gdal file-based layers
                 raster.append(layer)
-    return raster
+    return sorted(raster,  key=lambda layer: layer.name().lower())
 
 
 def getVectorLayers(shapetype=[-1]):
@@ -86,17 +86,16 @@ def getVectorLayers(shapetype=[-1]):
         if layer.type() == layer.VectorLayer:
             if shapetype == ALL_TYPES or layer.geometryType() in shapetype:
                 uri = unicode(layer.source())
-                if not uri.lower().endswith('csv') \
-                        and not uri.lower().endswith('dbf'):
+                if not uri.lower().endswith('csv') and not uri.lower().endswith('dbf'):
                     vector.append(layer)
-    return vector
+    return sorted(vector,  key=lambda layer: layer.name().lower())
 
 
 def getAllLayers():
     layers = []
     layers += getRasterLayers()
     layers += getVectorLayers()
-    return layers
+    return sorted(layers,  key=lambda layer: layer.name().lower())
 
 
 def getTables():
@@ -105,7 +104,7 @@ def getTables():
     for layer in layers:
         if layer.type() == layer.VectorLayer:
             tables.append(layer)
-    return tables
+    return sorted(tables,  key=lambda table: table.name().lower())
 
 
 def extent(layers):