@@ -130,7 +130,6 @@ def cancelThread( self ):
130
130
self .testThread .stop ()
131
131
QApplication .restoreOverrideCursor ()
132
132
self .buttonOk .setEnabled ( True )
133
- QApplication .restoreOverrideCursor ()
134
133
135
134
def runFinishedFromThread ( self , output ):
136
135
self .testThread .stop ()
@@ -217,8 +216,9 @@ def list_unique_values( self, vlayer, myField ):
217
216
lstUnique = []
218
217
nFeat = len ( unique )
219
218
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 ) )
222
222
for item in unique :
223
223
nElement += 1
224
224
self .emit ( SIGNAL ( "runStatus(PyQt_PyObject)" ), nElement )
@@ -270,8 +270,9 @@ def basic_statistics( self, vlayer, myField ):
270
270
self .emit ( SIGNAL ( "runStatus(PyQt_PyObject)" ), nElement )
271
271
else : # there is no selection, process the whole layer
272
272
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 ) )
275
276
vprovider .select ( allAttrs )
276
277
while vprovider .nextFeature ( feat ):
277
278
atMap = feat .attributeMap ()
@@ -335,8 +336,9 @@ def basic_statistics( self, vlayer, myField ):
335
336
else : # there is no selection, process the whole layer
336
337
nFeat = vprovider .featureCount ()
337
338
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 ) )
340
342
vprovider .select ( allAttrs )
341
343
while vprovider .nextFeature ( feat ):
342
344
atMap = feat .attributeMap ()
@@ -397,8 +399,9 @@ def nearest_neighbour_analysis( self, vlayer ):
397
399
vprovider .rewind ()
398
400
nFeat = vprovider .featureCount ()
399
401
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 ) )
402
405
while vprovider .nextFeature ( feat ):
403
406
neighbourID = index .nearestNeighbor ( feat .geometry ().asPoint (), 2 )[ 1 ]
404
407
vprovider .featureAtId ( neighbourID , neighbour , True , [] )
@@ -430,8 +433,9 @@ def check_geometry( self, vlayer ):
430
433
lstErrors = []
431
434
nFeat = vprovider .featureCount ()
432
435
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 ) )
435
439
436
440
while vprovider .nextFeature ( feat ):
437
441
geom = QgsGeometry ( feat .geometry () )
0 commit comments