Skip to content

Commit fbfca24

Browse files
author
alexbruy
committedMar 3, 2011
get uniquie values from provider instead of using own function
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15320 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed
 

‎python/plugins/fTools/tools/ftools_utils.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def getVectorLayerByName( myName ):
203203
return layer
204204
else:
205205
return None
206-
206+
207207
# Return QgsMapLayer from a layer name ( as string )
208208
def getMapLayerByName( myName ):
209209
layermap = QgsMapLayerRegistry.instance().mapLayers()
@@ -249,15 +249,7 @@ def addShapeToCanvas( shapefile_path ):
249249

250250
# Return all unique values in field based on field index
251251
def getUniqueValues( provider, index ):
252-
allAttrs = provider.attributeIndexes()
253-
provider.select( allAttrs )
254-
f = QgsFeature()
255-
values = []
256-
check = []
257-
while provider.nextFeature( f ):
258-
if not f.attributeMap()[ index ].toString() in check:
259-
values.append( f.attributeMap()[ index ] )
260-
check.append( f.attributeMap()[ index ].toString() )
252+
values = provider.uniqueValues( index )
261253
return values
262254

263255
# Generate a save file dialog with a dropdown box for choosing encoding style

0 commit comments

Comments
 (0)
Please sign in to comment.