Skip to content

Commit 31ce45e

Browse files
author
cfarmer
committed
Removes limitation on maximum no of selectable features. Fixes #2503. Patch thanks to alexbruy.
git-svn-id: http://svn.osgeo.org/qgis/trunk@13020 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ebc2e6f commit 31ce45e

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

python/plugins/fTools/tools/doSubsetSelect.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#-----------------------------------------------------------
2-
#
2+
#
33
# Random selection within subsets
44
#
5-
# A QGIS plugin for randomly selecting features from
5+
# A QGIS plugin for randomly selecting features from
66
# within multiple user defined subsets based on an input field.
77
#
88
# Copyright (C) 2008 Carson Farmer
@@ -11,23 +11,23 @@
1111
# WEB : www.geog.uvic.ca/spar/carson
1212
#
1313
#-----------------------------------------------------------
14-
#
14+
#
1515
# licensed under the terms of GNU GPL 2
16-
#
16+
#
1717
# This program is free software; you can redistribute it and/or modify
1818
# it under the terms of the GNU General Public License as published by
1919
# the Free Software Foundation; either version 2 of the License, or
2020
# (at your option) any later version.
21-
#
21+
#
2222
# This program is distributed in the hope that it will be useful,
2323
# but WITHOUT ANY WARRANTY; without even the implied warranty of
2424
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2525
# GNU General Public License for more details.
26-
#
26+
#
2727
# You should have received a copy of the GNU General Public License along
2828
# with this program; if not, write to the Free Software Foundation, Inc.,
2929
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30-
#
30+
#
3131
#--------------------------------------------------------------------
3232
from PyQt4.QtCore import *
3333
from PyQt4.QtGui import *
@@ -42,7 +42,7 @@ def __init__(self, iface):
4242
self.iface = iface
4343
# Set up the user interface from Designer.
4444
self.setupUi(self)
45-
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
45+
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
4646
self.setWindowTitle(self.tr("Random selection within subsets"))
4747
# populate layer list
4848
self.progressBar.setValue(0)
@@ -58,6 +58,8 @@ def update(self, inputLayer):
5858
changedField = self.getFieldList(changedLayer)
5959
for i in changedField:
6060
self.inField.addItem(unicode(changedField[i].name()))
61+
maxFeatures = changedLayer.dataProvider().featureCount()
62+
self.spnNumber.setMaximum( maxFeatures )
6163

6264
def accept(self):
6365
if self.inShape.currentText() == "":
@@ -158,7 +160,7 @@ def getFieldList(self, vlayer):
158160
return myFields
159161

160162
def getUniqueValues(self, provider, index):
161-
allAttrs = provider.attributeIndexes()
163+
allAttrs = provider.attributeIndexes()
162164
provider.select(allAttrs)
163165
feat = QgsFeature()
164166
values = []

0 commit comments

Comments
 (0)