Skip to content

Commit

Permalink
get uniquie values from provider instead of using own function
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15320 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
alexbruy committed Mar 3, 2011
1 parent b4ea9e2 commit fbfca24
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions python/plugins/fTools/tools/ftools_utils.py
Expand Up @@ -203,7 +203,7 @@ def getVectorLayerByName( myName ):
return layer
else:
return None

# Return QgsMapLayer from a layer name ( as string )
def getMapLayerByName( myName ):
layermap = QgsMapLayerRegistry.instance().mapLayers()
Expand Down Expand Up @@ -249,15 +249,7 @@ def addShapeToCanvas( shapefile_path ):

# 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
Expand Down

0 comments on commit fbfca24

Please sign in to comment.