[QGIS Commit] r15320 - trunk/qgis/python/plugins/fTools/tools
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Mar 3 07:30:06 EST 2011
Author: alexbruy
Date: 2011-03-03 04:30:06 -0800 (Thu, 03 Mar 2011)
New Revision: 15320
Modified:
trunk/qgis/python/plugins/fTools/tools/ftools_utils.py
Log:
get uniquie values from provider instead of using own function
Modified: trunk/qgis/python/plugins/fTools/tools/ftools_utils.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/ftools_utils.py 2011-03-03 12:20:34 UTC (rev 15319)
+++ trunk/qgis/python/plugins/fTools/tools/ftools_utils.py 2011-03-03 12:30:06 UTC (rev 15320)
@@ -203,7 +203,7 @@
return layer
else:
return None
-
+
# Return QgsMapLayer from a layer name ( as string )
def getMapLayerByName( myName ):
layermap = QgsMapLayerRegistry.instance().mapLayers()
@@ -249,15 +249,7 @@
# Return all unique values in field based on field index
def getUniqueValues( provider, index ):
- allAttrs = provider.attributeIndexes()
- provider.select( allAttrs )
- f = QgsFeature()
- values = []
- check = []
- while provider.nextFeature( f ):
- if not f.attributeMap()[ index ].toString() in check:
- values.append( f.attributeMap()[ index ] )
- check.append( f.attributeMap()[ index ].toString() )
+ values = provider.uniqueValues( index )
return values
# Generate a save file dialog with a dropdown box for choosing encoding style
More information about the QGIS-commit
mailing list