Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix python error when trying to export db manager table
  • Loading branch information
nyalldawson committed Feb 13, 2018
1 parent 6b4e734 commit ad84961
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/plugins/db_manager/dlg_export_vector.py
Expand Up @@ -78,16 +78,16 @@ def chooseOutputFile(self):
lastUsedDir = settings.value(self.lastUsedVectorDirSettingsKey, ".")

# get selected filter
selectedFilter = self.cboFileFormat.currentData()
selected_driver = self.cboFileFormat.currentData()
selected_filter = QgsVectorFileWriter.filterForDriver(selected_driver)

# ask for a filename
filename, filter = QFileDialog.getSaveFileName(self, self.tr("Choose where to save the file"), lastUsedDir,
selectedFilter)
selected_filter)
if filename == "":
return

filterString = QgsVectorFileWriter.filterForDriver(selectedFilter)
ext = filterString[filterString.find('.'):]
ext = selected_filter[selected_filter.find('.'):]
ext = ext[:ext.find(' ')]

if not filename.lower().endswith(ext):
Expand All @@ -112,8 +112,8 @@ def populateEncodings(self):

def populateFileFilters(self):
# populate the combo with supported vector file formats
for name, filt in list(QgsVectorFileWriter.ogrDriverList().items()):
self.cboFileFormat.addItem(name, filt)
for driver in QgsVectorFileWriter.ogrDriverList():
self.cboFileFormat.addItem(driver.longName, driver.driverName)

# set the last used filter
settings = QgsSettings()
Expand Down

0 comments on commit ad84961

Please sign in to comment.