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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Mar 23 19:26:24 EDT 2010


Author: cfarmer
Date: 2010-03-23 19:26:23 -0400 (Tue, 23 Mar 2010)
New Revision: 13152

Modified:
   trunk/qgis/python/plugins/fTools/tools/doDefineProj.py
Log:
fixes issue with identical input CRSs, now asks if users wants to proceed anyway

Modified: trunk/qgis/python/plugins/fTools/tools/doDefineProj.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/doDefineProj.py	2010-03-23 21:14:15 UTC (rev 13151)
+++ trunk/qgis/python/plugins/fTools/tools/doDefineProj.py	2010-03-23 23:26:23 UTC (rev 13152)
@@ -65,40 +65,43 @@
                     destLayer = self.getVectorLayerByName(self.cmbLayer.currentText())
                     srsDefine = destLayer.srs()
                 if srsDefine == vLayer.srs():
-                    QMessageBox.information(self, self.tr("Define current projection"), self.tr("Identical output spatial reference system chosen"))
+                    responce = QMessageBox.question(self, self.tr("Define current projection"),
+                    self.tr("Identical output spatial reference system chosen\n\nAre you sure you want to proceed?"),
+                    QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
+                    if responce == QMessageBox.No:
+                        return
+                provider = vLayer.dataProvider()
+                self.progressBar.setValue(35)
+                inPath = provider.dataSourceUri()
+                inPath = inPath.remove( QRegExp( "\|.*" ) )
+                self.progressBar.setValue(40)
+                if inPath.endsWith(".shp"):
+                    inPath = inPath.left(inPath.length() - 4)
+                self.progressBar.setValue(55)
+                if not srsDefine.isValid():
+                    QMessageBox.information(self, self.tr("Define current projection"), self.tr("Output spatial reference system is not valid"))
                 else:
-                    provider = vLayer.dataProvider()
-                    self.progressBar.setValue(35)
-                    inPath = provider.dataSourceUri()
-                    inPath = inPath.remove( QRegExp( "\|.*" ) )
-                    self.progressBar.setValue(40)
-                    if inPath.endsWith(".shp"):
-                        inPath = inPath.left(inPath.length() - 4)
-                    self.progressBar.setValue(55)
-                    if not srsDefine.isValid():
-                        QMessageBox.information(self, self.tr("Define current projection"), self.tr("Output spatial reference system is not valid"))
-                    else:
-                        self.progressBar.setValue(60)
-                        outputWkt = srsDefine.toWkt()
-                        self.progressBar.setValue(65)
-                        outputFile = QFile( inPath + ".prj" )
-                        outputFile.open( QIODevice.WriteOnly | QIODevice.Text )
-                        outputPrj = QTextStream( outputFile )
+                    self.progressBar.setValue(60)
+                    outputWkt = srsDefine.toWkt()
+                    self.progressBar.setValue(65)
+                    outputFile = QFile( inPath + ".prj" )
+                    outputFile.open( QIODevice.WriteOnly | QIODevice.Text )
+                    outputPrj = QTextStream( outputFile )
+                    outputPrj << outputWkt
+                    outputPrj.flush()
+                    outputFile.close()
+                    self.progressBar.setValue(70)
+                    checkFile = QFile( inPath + ".qpj" )
+                    if checkFile.exists():
+                        checkFile.open( QIODevice.WriteOnly | QIODevice.Text )
+                        outputPrj = QTextStream( checkFile )
                         outputPrj << outputWkt
                         outputPrj.flush()
-                        outputFile.close()
-                        self.progressBar.setValue(70)
-                        checkFile = QFile( inPath + ".qpj" )
-                        if checkFile.exists():
-                            checkFile.open( QIODevice.WriteOnly | QIODevice.Text )
-                            outputPrj = QTextStream( checkFile )
-                            outputPrj << outputWkt
-                            outputPrj.flush()
-                            checkFile.close()
-                        self.progressBar.setValue(95)
-                        vLayer.setCrs(srsDefine)
-                        self.progressBar.setValue(100)
-                        QMessageBox.information(self, self.tr("Define current projection"), self.tr("Defined Projection For:\n%1.shp").arg( inPath ) )
+                        checkFile.close()
+                    self.progressBar.setValue(95)
+                    vLayer.setCrs(srsDefine)
+                    self.progressBar.setValue(100)
+                    QMessageBox.information(self, self.tr("Define current projection"), self.tr("Defined Projection For:\n%1.shp").arg( inPath ) )
         self.progressBar.setValue(0)
 
     def outProjFile(self):



More information about the QGIS-commit mailing list