[BACKPORT] sort layers and fields alphabetically in fTools (fix #4412)

This commit is contained in:
Alexander Bruy 2011-12-14 12:21:34 +02:00
parent 7442047542
commit f61988e77e

View File

@ -31,6 +31,8 @@ from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import *
import locale
# From two input attribute maps, create single attribute map
def combineVectorAttributes( atMapA, atMapB ):
attribA = atMapA.values()
@ -183,7 +185,7 @@ def getLayerNames( vTypes ):
elif layer.type() == QgsMapLayer.RasterLayer:
if "Raster" in vTypes:
layerlist.append( unicode( layer.name() ) )
return layerlist
return sorted( layerlist, cmp=locale.strcoll )
# Return list of names of all fields from input QgsVectorLayer
def getFieldNames( vlayer ):
@ -192,7 +194,7 @@ def getFieldNames( vlayer ):
for name, field in fieldmap.iteritems():
if not field.name() in fieldlist:
fieldlist.append( unicode( field.name() ) )
return fieldlist
return sorted( fieldlist, cmp=locale.strcoll )
# Return QgsVectorLayer from a layer name ( as string )
def getVectorLayerByName( myName ):