Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Patch to fix (second problem) #2735. Patch thanks to brushtyler.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13885 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
cfarmer committed Jul 4, 2010
1 parent 3c14621 commit 7ff3877
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/plugins/fTools/tools/doSubsetSelect.py
Expand Up @@ -82,9 +82,10 @@ def accept(self):
self.buttonOk.setEnabled( True )

def compute(self, inVect, inField, value, perc, progressBar):
mlayer = ftools_utils.getMapLayerByName(inVect)
mlayer.removeSelection(True)
vlayer = ftools_utils.getVectorLayerByName(inVect)
vprovider = vlayer.dataProvider()
mlayer = ftools_utils.getMapLayerByName(inVect)
allAttrs = vprovider.attributeIndexes()
vprovider.select(allAttrs)
index = vprovider.fieldNameIndex(inField)
Expand All @@ -93,7 +94,6 @@ def compute(self, inVect, inField, value, perc, progressBar):
unique = ftools_utils.getUniqueValues(vprovider, int(index))
inFeat = QgsFeature()
selran = []
mlayer.removeSelection(True)
nFeat = vprovider.featureCount() * len(unique)
nElement = 0
self.progressBar.setValue(0)
Expand All @@ -111,9 +111,9 @@ def compute(self, inVect, inField, value, perc, progressBar):
self.progressBar.setValue(nElement)
if perc: selVal = int(round((value / 100.0000) * len(FIDs), 0))
else: selVal = value
if selVal >= len(FIDs): selran = FIDs
else: selran = random.sample(FIDs, selVal)
selran.extend(mlayer.selectedFeaturesIds())
mlayer.setSelectedFeatures(selran)
if selVal >= len(FIDs): selFeat = FIDs
else: selFeat = random.sample(FIDs, selVal)
selran.extend(selFeat)
mlayer.setSelectedFeatures(selran)
else:
mlayer.setSelectedFeatures(range(0, mlayer.featureCount()))

0 comments on commit 7ff3877

Please sign in to comment.