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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jul 25 12:14:36 EDT 2010


Author: alexbruy
Date: 2010-07-25 16:14:36 +0000 (Sun, 25 Jul 2010)
New Revision: 13963

Modified:
   trunk/qgis/python/plugins/fTools/tools/doMergeShapes.py
Log:
allow users to enter path to shapefiles manually in Merge shapefiles tool (apply #2897)


Modified: trunk/qgis/python/plugins/fTools/tools/doMergeShapes.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/doMergeShapes.py	2010-07-25 15:20:16 UTC (rev 13962)
+++ trunk/qgis/python/plugins/fTools/tools/doMergeShapes.py	2010-07-25 16:14:36 UTC (rev 13963)
@@ -17,6 +17,7 @@
     self.iface = iface
 
     self.mergeThread = None
+    self.inputFiles = None
 
     self.btnOk = self.buttonBox.button( QDialogButtonBox.Ok )
     self.btnClose = self.buttonBox.button( QDialogButtonBox.Close )
@@ -32,18 +33,18 @@
     if inDir.isEmpty():
       return
 
-    workDir = QDir( inDir )
-    workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot )
-    nameFilter = QStringList() << "*.shp" << "*.SHP"
-    workDir.setNameFilters( nameFilter )
-    self.inputFiles = workDir.entryList()
-    if self.inputFiles.count() == 0:
-      QMessageBox.warning( self, self.tr( "No shapefiles found" ),
-        self.tr( "There are no shapefiles in this directory. Please select another one." ) )
-      self.inputFiles = None
-      return
+    #workDir = QDir( inDir )
+    #workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot )
+    #nameFilter = QStringList() << "*.shp" << "*.SHP"
+    #workDir.setNameFilters( nameFilter )
+    #self.inputFiles = workDir.entryList()
+    #if self.inputFiles.count() == 0:
+    #  QMessageBox.warning( self, self.tr( "No shapefiles found" ),
+    #    self.tr( "There are no shapefiles in this directory. Please select another one." ) )
+    #  self.inputFiles = None
+    #  return
 
-    self.progressFiles.setRange( 0, self.inputFiles.count() )
+    #self.progressFiles.setRange( 0, self.inputFiles.count() )
     self.leInputDir.setText( inDir )
 
   def outFile( self ):
@@ -56,6 +57,20 @@
     QDialog.reject( self )
 
   def accept( self ):
+    if self.inputFiles is None:
+      workDir = QDir( self.leInputDir.text() )
+      workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot )
+      nameFilter = QStringList() << "*.shp" << "*.SHP"
+      workDir.setNameFilters( nameFilter )
+      self.inputFiles = workDir.entryList()
+      if self.inputFiles.count() == 0:
+        QMessageBox.warning( self, self.tr( "No shapefiles found" ),
+          self.tr( "There are no shapefiles in this directory. Please select another one." ) )
+        self.inputFiles = None
+        return
+
+      self.progressFiles.setRange( 0, self.inputFiles.count() )
+
     outFile = QFile( self.outFileName )
     if outFile.exists():
       if not QgsVectorFileWriter.deleteShapeFile( self.outFileName ):



More information about the QGIS-commit mailing list