[dbmanager] avoid double extension when exports to file a table

This commit is contained in:
Salvatore Larosa 2013-08-02 17:37:36 +02:00
parent 3644402bc7
commit 65f9ec7201

View File

@ -64,12 +64,12 @@ class DlgExportVector(QDialog, Ui_Dialog):
def chooseOutputFile(self): def chooseOutputFile(self):
# get last used dir and format # get last used dir and format
settings = QSettings() settings = QSettings()
lastDir = settings.value("/db_manager/lastUsedDir", "") lastDir = settings.value("/db_manager/lastUsedDir", "")
# ask for a filename # ask for a filename
filename = QFileDialog.getSaveFileName(self, self.tr("Choose where to save the file"), lastDir, self.tr("Shapefiles") + " (*.shp)") filename = QFileDialog.getSaveFileName(self, self.tr("Choose where to save the file"), lastDir, self.tr("Shapefiles") + " (*.shp)")
if filename == "": if filename == "":
return return
if filename[:-4] != ".shp": if filename[-4:] != ".shp":
filename += ".shp" filename += ".shp"
# store the last used dir and format # store the last used dir and format
settings.setValue("/db_manager/lastUsedDir", QFileInfo(filename).filePath()) settings.setValue("/db_manager/lastUsedDir", QFileInfo(filename).filePath())