Skip to content

Commit 8b729f3

Browse files
author
jef
committed
fix #2844
git-svn-id: http://svn.osgeo.org/qgis/trunk@13854 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 6ddd5e9 commit 8b729f3

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

python/plugins/fTools/tools/doVisual.py

+15-11
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ def cancelThread( self ):
130130
self.testThread.stop()
131131
QApplication.restoreOverrideCursor()
132132
self.buttonOk.setEnabled( True )
133-
QApplication.restoreOverrideCursor()
134133

135134
def runFinishedFromThread( self, output ):
136135
self.testThread.stop()
@@ -217,8 +216,9 @@ def list_unique_values( self, vlayer, myField ):
217216
lstUnique = []
218217
nFeat = len( unique )
219218
nElement = 0
220-
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
221-
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
219+
if nFeat > 0:
220+
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
221+
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
222222
for item in unique:
223223
nElement += 1
224224
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
@@ -270,8 +270,9 @@ def basic_statistics( self, vlayer, myField ):
270270
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
271271
else: # there is no selection, process the whole layer
272272
nFeat = vprovider.featureCount()
273-
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
274-
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
273+
if nFeat > 0:
274+
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
275+
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
275276
vprovider.select( allAttrs )
276277
while vprovider.nextFeature( feat ):
277278
atMap = feat.attributeMap()
@@ -335,8 +336,9 @@ def basic_statistics( self, vlayer, myField ):
335336
else: # there is no selection, process the whole layer
336337
nFeat = vprovider.featureCount()
337338
uniqueVal = ftools_utils.getUniqueValuesCount( vlayer, index, False )
338-
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
339-
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
339+
if nFeat > 0:
340+
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
341+
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
340342
vprovider.select( allAttrs )
341343
while vprovider.nextFeature( feat ):
342344
atMap = feat.attributeMap()
@@ -397,8 +399,9 @@ def nearest_neighbour_analysis( self, vlayer ):
397399
vprovider.rewind()
398400
nFeat = vprovider.featureCount()
399401
nElement = 0
400-
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
401-
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
402+
if nFeat > 0:
403+
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
404+
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
402405
while vprovider.nextFeature( feat ):
403406
neighbourID = index.nearestNeighbor( feat.geometry().asPoint(), 2 )[ 1 ]
404407
vprovider.featureAtId( neighbourID, neighbour, True, [] )
@@ -430,8 +433,9 @@ def check_geometry( self, vlayer ):
430433
lstErrors = []
431434
nFeat = vprovider.featureCount()
432435
nElement = 0
433-
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
434-
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
436+
if nFeat > 0:
437+
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
438+
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
435439

436440
while vprovider.nextFeature( feat ):
437441
geom = QgsGeometry( feat.geometry() )

0 commit comments

Comments
 (0)