Skip to content
Permalink
Browse files
allow users to enter path to shapefiles manually in Merge shapefiles …
…tool (apply #2897)

git-svn-id: http://svn.osgeo.org/qgis/trunk@13963 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
alexbruy committed Jul 25, 2010
1 parent 621698f commit 72c7def022379db952f9a7dc5f3525994799c014
Showing with 27 additions and 12 deletions.
  1. +27 −12 python/plugins/fTools/tools/doMergeShapes.py
@@ -17,6 +17,7 @@ def __init__( self, iface ):
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 @@ def inputDir( self ):
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

self.progressFiles.setRange( 0, self.inputFiles.count() )
#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.leInputDir.setText( inDir )

def outFile( self ):
@@ -56,6 +57,20 @@ def reject( self ):
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 ):

0 comments on commit 72c7def

Please sign in to comment.