[QGIS Commit] r13020 - trunk/qgis/python/plugins/fTools/tools

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Mar 7 21:08:16 EST 2010


Author: cfarmer
Date: 2010-03-07 21:08:14 -0500 (Sun, 07 Mar 2010)
New Revision: 13020

Modified:
   trunk/qgis/python/plugins/fTools/tools/doSubsetSelect.py
Log:
Removes limitation on maximum no of selectable features. Fixes #2503. Patch thanks to alexbruy.

Modified: trunk/qgis/python/plugins/fTools/tools/doSubsetSelect.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/doSubsetSelect.py	2010-03-08 02:01:33 UTC (rev 13019)
+++ trunk/qgis/python/plugins/fTools/tools/doSubsetSelect.py	2010-03-08 02:08:14 UTC (rev 13020)
@@ -1,8 +1,8 @@
 #-----------------------------------------------------------
-# 
+#
 # Random selection within subsets
 #
-# A QGIS plugin for randomly selecting features from 
+# A QGIS plugin for randomly selecting features from
 # within multiple user defined subsets based on an input field.
 #
 # Copyright (C) 2008  Carson Farmer
@@ -11,23 +11,23 @@
 # WEB  : www.geog.uvic.ca/spar/carson
 #
 #-----------------------------------------------------------
-# 
+#
 # licensed under the terms of GNU GPL 2
-# 
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License along
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-# 
+#
 #--------------------------------------------------------------------
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
@@ -42,7 +42,7 @@
 		self.iface = iface
 		# Set up the user interface from Designer.
 		self.setupUi(self)
-		QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)		
+		QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
 		self.setWindowTitle(self.tr("Random selection within subsets"))
 		# populate layer list
 		self.progressBar.setValue(0)
@@ -58,6 +58,8 @@
 		changedField = self.getFieldList(changedLayer)
 		for i in changedField:
 			self.inField.addItem(unicode(changedField[i].name()))
+		maxFeatures = changedLayer.dataProvider().featureCount()
+		self.spnNumber.setMaximum( maxFeatures )
 
 	def accept(self):
 		if self.inShape.currentText() == "":
@@ -158,7 +160,7 @@
 		return myFields
 
 	def getUniqueValues(self, provider, index):
-		allAttrs = provider.attributeIndexes()    
+		allAttrs = provider.attributeIndexes()
 		provider.select(allAttrs)
 		feat = QgsFeature()
 		values = []



More information about the QGIS-commit mailing list