Skip to content
Permalink
Browse files

[fTools] homogenize UI (contributed by Salvatore Larosa)

  • Loading branch information
alexbruy committed Sep 12, 2013
1 parent 4a95d35 commit e72088cddb8494a3fe2072e540fc56e5f021f0cc
Showing with 887 additions and 698 deletions.
  1. +6 −7 python/plugins/fTools/tools/doGeometry.py
  2. +8 −6 python/plugins/fTools/tools/doGeoprocessing.py
  3. +5 −3 python/plugins/fTools/tools/doIntersectLines.py
  4. +6 −4 python/plugins/fTools/tools/doMeanCoords.py
  5. +6 −9 python/plugins/fTools/tools/doPointsInPolygon.py
  6. +7 −6 python/plugins/fTools/tools/doRandPoints.py
  7. +6 −4 python/plugins/fTools/tools/doRegPoints.py
  8. +6 −4 python/plugins/fTools/tools/doSumLines.py
  9. +8 −7 python/plugins/fTools/tools/doValidate.py
  10. +6 −3 python/plugins/fTools/tools/doVectorGrid.py
  11. +1 −0 python/plugins/fTools/tools/doVisual.py
  12. +2 −2 python/plugins/fTools/tools/frmEliminate.ui
  13. +93 −82 python/plugins/fTools/tools/frmGeometry.ui
  14. +49 −38 python/plugins/fTools/tools/frmGeoprocessing.ui
  15. +75 −63 python/plugins/fTools/tools/frmIntersectLines.ui
  16. +88 −63 python/plugins/fTools/tools/frmMeanCoords.ui
  17. +82 −81 python/plugins/fTools/tools/frmPointDistance.ui
  18. +35 −24 python/plugins/fTools/tools/frmPointsInPolygon.ui
  19. +48 −24 python/plugins/fTools/tools/frmRandPoints.ui
  20. +1 −1 python/plugins/fTools/tools/frmRandom.ui
  21. +133 −119 python/plugins/fTools/tools/frmReProject.ui
  22. +34 −23 python/plugins/fTools/tools/frmRegPoints.ui
  23. +15 −2 python/plugins/fTools/tools/frmSpatialJoin.ui
  24. +84 −71 python/plugins/fTools/tools/frmSumLines.ui
  25. +48 −24 python/plugins/fTools/tools/frmVectorGrid.ui
  26. +2 −2 python/plugins/fTools/tools/frmVectorSplit.ui
  27. +33 −26 python/plugins/fTools/tools/frmVisual.ui
@@ -281,14 +281,13 @@ def runFinishedFromThread( self, success ):
QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
if success:
if ( self.myFunction == 5 and self.chkWriteShapefile.isChecked() ) or self.myFunction != 5:
addToTOC = QMessageBox.question( self, self.tr("Geometry"),
self.tr( "Created output shapefile:\n{0}\n{1}\n\nWould you like to add the new layer to the TOC?" ).format( self.shapefileName, extra ),
QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton )
if addToTOC == QMessageBox.Yes:
if not ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) ):
QMessageBox.warning( self, self.tr( "Geometry"),
self.tr( "Error loading output shapefile:\n{0}" ).format( self.shapefileName ) )
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(self.shapefileName))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Geometry"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( self.shapefileName ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Geometry"),self.tr("Created output shapefile:\n%s\n%s" ) % ( unicode( self.shapefileName ), extra ))
else:
QMessageBox.information( self, self.tr( "Geometry" ),
self.tr( "Layer '{0}' updated" ).format( self.inShape.currentText() ) )
@@ -247,8 +247,8 @@ def runFinishedFromThread( self, results ):
out_text = self.tr( "\nWarnings:" )
end_text = self.tr( "\nSome output geometries may be missing or invalid.\n\nWould you like to add the new layer anyway?" )
else:
out_text = "\n"
end_text = self.tr( "\n\nWould you like to add the new layer to the TOC?" )
out_text = ""
end_text = ""
if not results[2] is None:
if not results[2]:
out_text = out_text + self.tr( "\nInput CRS error: Different input coordinate reference systems detected, results may not be as expected.")
@@ -258,11 +258,13 @@ def runFinishedFromThread( self, results ):
out_text = out_text + self.tr( "\nFeature geometry error: One or more output features ignored due to invalid geometry.")
if not results[0]:
out_text = out_text + self.tr( "\nGEOS geoprocessing error: One or more input features have invalid geometry.")
addToTOC = QMessageBox.question( self, self.tr("Geoprocessing"), self.tr( "Created output shapefile:\n%s\n%s%s" ) % ( unicode( self.shapefileName ), out_text, end_text ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton )
if addToTOC == QMessageBox.Yes:
if not ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) ):
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( self.shapefileName ) ))
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(self.shapefileName))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( self.shapefileName ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Geoprocessing"),self.tr("Created output shapefile:\n%s\n%s%s" ) % ( unicode( self.shapefileName ), out_text, end_text ))

def runStatusFromThread( self, status ):
self.progressBar.setValue( status )
@@ -95,11 +95,13 @@ def accept(self):
self.outShape.clear()
self.compute(line1, line2, field1, field2, outPath, self.progressBar)
self.progressBar.setValue(100)
addToTOC = QMessageBox.question(self, self.tr("Generate Centroids"), self.tr("Created output point shapefile:\n%s\n\nWould you like to add the new layer to the TOC?") % ( outPath ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
if addToTOC == QMessageBox.Yes:
if not ftools_utils.addShapeToCanvas( unicode( outPath ) ):
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(outPath))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( outPath ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Generate Centroids"),self.tr("Created output shapefile:\n%s" ) % ( unicode( outPath )))
self.progressBar.setValue(0)
self.buttonOk.setEnabled( True )

@@ -90,11 +90,13 @@ def accept(self):
self.compute(inName, outPath, self.weightField.currentText(), self.sizeValue.value(), self.uniqueField.currentText())
self.progressBar.setValue(100)
self.outShape.clear()
addToTOC = QMessageBox.question(self, self.tr("Coordinate statistics"), self.tr("Created output point shapefile:\n%s\n\nWould you like to add the new layer to the TOC?") % ( outPath ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
if addToTOC == QMessageBox.Yes:
vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
QgsMapLayerRegistry.instance().addMapLayers([vlayer])
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(outPath))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Coordinate statistics"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( outPath ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Coordinate statistics"),self.tr("Created output shapefile:\n%s" ) % ( unicode( outPath )))
self.progressBar.setValue(0)
self.buttonOk.setEnabled( True )

@@ -112,16 +112,13 @@ def updateProgress(self):

def processFinished(self):
self.stopProcessing()

addToTOC = QMessageBox.question(self, self.tr("Count Points in Polygon"),
self.tr("Created output shapefile:\n%s\n\nWould you like to add the new layer to the TOC?") % (self.outShape.text()),
QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
if addToTOC == QMessageBox.Yes:
fileInfo = QFileInfo( self.outShape.text() )
layerName = fileInfo.completeBaseName()
layer = QgsVectorLayer(self.outShape.text(), layerName, "ogr")
QgsMapLayerRegistry.instance().addMapLayers([layer])
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(self.outShape.text()))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Count Points in Polygon"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( outPath ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Count Points in Polygon"),self.tr("Created output shapefile:\n%s" ) % ( unicode( self.outShape.text() )))

self.restoreGui()

@@ -119,12 +119,13 @@ def accept(self):
if self.randomize(inLayer, outPath, minimum, design, value):
self.progressBar.setValue(100)
self.outShape.clear()
addToTOC = QMessageBox.question(self, self.tr("Random Points"),
self.tr("Created output point shapefile:\n%s\n\nWould you like to add the new layer to the TOC?") % (outPath), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
if addToTOC == QMessageBox.Yes:
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
QgsMapLayerRegistry.instance().addMapLayers([self.vlayer])
self.populateLayers()
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(outPath))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Random Points"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( outPath ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Random Points"),self.tr("Created output shapefile:\n%s" ) % ( unicode( outPath )))
self.progressBar.setValue(0)
self.buttonOk.setEnabled( True )

@@ -84,11 +84,13 @@ def accept(self):
print crs.isValid()
if not crs.isValid(): crs = None
self.regularize(boundBox, outPath, offset, value, self.rdoSpacing.isChecked(), self.spnInset.value(), crs)
addToTOC = QMessageBox.question(self, self.tr("Generate Regular Points"), self.tr("Created output point shapefile:\n%s\n\nWould you like to add the new layer to the TOC?") % ( outPath ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
if addToTOC == QMessageBox.Yes:
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
QgsMapLayerRegistry.instance().addMapLayers([self.vlayer])
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(outPath))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Generate Regular Points"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( outPath ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Generate Regular Points"),self.tr("Created output shapefile:\n%s" ) % ( unicode( outPath )))
self.progressBar.setValue(0)
self.buttonOk.setEnabled( True )

@@ -73,11 +73,13 @@ def accept(self):
outName = ftools_utils.getShapefileName( outPath )
self.compute(inPoly, inLns, inField, outPath, self.progressBar)
self.outShape.clear()
addToTOC = QMessageBox.question(self, self.tr("Sum line lengths"), self.tr("Created output shapefile:\n%s\n\nWould you like to add the new layer to the TOC?") % (unicode(outPath)), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
if addToTOC == QMessageBox.Yes:
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
QgsMapLayerRegistry.instance().addMapLayers([self.vlayer])
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(outPath))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Sum line lengths"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( outPath ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Sum line lengths"),self.tr("Created output shapefile:\n%s" ) % ( unicode( outPath )))
self.progressBar.setValue(0)
self.buttonOk.setEnabled( True )

@@ -135,6 +135,7 @@ def updateGui( self ):
if self.ckBoxShpError.isChecked():
self.lineEditShpError.setEnabled( True )
self.browseShpError.setEnabled( True )
self.addToCanvasCheck.setEnabled(True)
self.tblUnique.setEnabled( False )
self.lstCount.setEnabled( False )
self.label_2.setEnabled( False )
@@ -143,6 +144,7 @@ def updateGui( self ):
else:
self.lineEditShpError.setEnabled( False )
self.browseShpError.setEnabled( False )
self.addToCanvasCheck.setEnabled(False)
self.tblUnique.setEnabled( True )
self.lstCount.setEnabled( True )
self.label_2.setEnabled( True )
@@ -227,13 +229,12 @@ def runFinishedFromThread( self, success ):
self.buttonOk.setEnabled( True )
if success == "writeShape":
extra = ""
addToTOC = QMessageBox.question( self, self.tr("Geometry"),
self.tr( "Created output shapefile:\n%s\n%s\n\nWould you like to add the new layer to the TOC?" ) % ( unicode( self.shapefileName ), extra ),
QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton )
if addToTOC == QMessageBox.Yes:
if not ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) ):
QMessageBox.warning( self, self.tr( "Geometry"),
self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( self.shapefileName ) ) )
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(self.shapefileName))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Geometry"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( self.shapefileName ) ))
else:
QMessageBox.information(self, self.tr("Geometry"),self.tr("Created output shapefile:\n%s\n%s" ) % ( unicode( self.shapefileName ), extra))
else:
self.tblUnique.setColumnCount( 2 )
count = 0
@@ -146,10 +146,13 @@ def accept(self):
QApplication.setOverrideCursor(Qt.WaitCursor)
self.compute( boundBox, xSpace, ySpace, polygon )
QApplication.restoreOverrideCursor()
addToTOC = QMessageBox.question(self, self.tr("Generate Vector Grid"), self.tr("Created output shapefile:\n%s\n\nWould you like to add the new layer to the TOC?") % (unicode(self.shapefileName)), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
if addToTOC == QMessageBox.Yes:
ftools_utils.addShapeToCanvas( self.shapefileName )
if self.addToCanvasCheck.isChecked():
addCanvasCheck = ftools_utils.addShapeToCanvas(unicode(self.shapefileName))
if not addCanvasCheck:
QMessageBox.warning( self, self.tr("Generate Vector Grid"), self.tr( "Error loading output shapefile:\n%s" ) % ( unicode( self.shapefileName ) ))
self.populateLayers()
else:
QMessageBox.information(self, self.tr("Generate Vector Grid"),self.tr("Created output shapefile:\n%s" ) % ( unicode( self.shapefileName )))
self.progressBar.setValue( 0 )
self.buttonOk.setEnabled( True )

@@ -48,6 +48,7 @@ def __init__( self, iface, function ):
self.lineEditShpError.hide()
self.label_6.hide()
self.line.hide()
self.addToCanvasCheck.hide()
self.buttonBox_2.setOrientation(Qt.Horizontal)

if self.myFunction == 2 or self.myFunction == 3:
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>436</width>
<height>218</height>
<height>242</height>
</rect>
</property>
<property name="windowTitle">
@@ -38,7 +38,7 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="toolOut">
<widget class="QPushButton" name="toolOut">
<property name="text">
<string>Browse</string>
</property>

0 comments on commit e72088c

Please sign in to comment.
You can’t perform that action at this time.