Exemple #1
0
    def selectFile(self):
        fileFilter = self.output.getFileFilter(self.alg)

        settings = QSettings()
        if settings.contains("/Processing/LastOutputPath"):
            path = settings.value("/Processing/LastOutputPath")
        else:
            path = ProcessingConfig.getSetting(ProcessingConfig.OUTPUT_FOLDER)

        encoding = settings.value("/Processing/encoding", "System")
        fileDialog = QgsEncodingFileDialog(self, self.tr("Save file"), path, fileFilter, encoding)
        fileDialog.setFileMode(QFileDialog.AnyFile)
        fileDialog.setAcceptMode(QFileDialog.AcceptSave)
        fileDialog.setConfirmOverwrite(True)

        if fileDialog.exec_() == QDialog.Accepted:
            files = fileDialog.selectedFiles()
            encoding = unicode(fileDialog.encoding())
            self.output.encoding = encoding
            fileName = unicode(files[0])
            selectedFileFilter = unicode(fileDialog.selectedNameFilter())
            if not fileName.lower().endswith(tuple(re.findall("\*(\.[a-z]{1,10})", fileFilter))):
                ext = re.search("\*(\.[a-z]{1,10})", selectedFileFilter)
                if ext:
                    fileName += ext.group(1)
            self.leText.setText(fileName)
            settings.setValue("/Processing/LastOutputPath", os.path.dirname(fileName))
            settings.setValue("/Processing/encoding", encoding)
    def selectFile(self):
        output = self.alg.parameterDefinition('OUTPUT')
        fileFilter = getFileFilter(output)

        settings = QgsSettings()
        if settings.contains('/Processing/LastOutputPath'):
            path = settings.value('/Processing/LastOutputPath')
        else:
            path = ProcessingConfig.getSetting(ProcessingConfig.OUTPUT_FOLDER)
        lastEncoding = settings.value('/Processing/encoding', 'System')
        fileDialog = QgsEncodingFileDialog(self,
                                           self.tr('Save file'),
                                           path,
                                           fileFilter,
                                           lastEncoding)
        fileDialog.setFileMode(QFileDialog.AnyFile)
        fileDialog.setAcceptMode(QFileDialog.AcceptSave)
        fileDialog.setOption(QFileDialog.DontConfirmOverwrite, False)
        if fileDialog.exec_() == QDialog.Accepted:
            files = fileDialog.selectedFiles()
            encoding = str(fileDialog.encoding())
            output.encoding = encoding
            filename = str(files[0])
            selectedFileFilter = str(fileDialog.selectedNameFilter())
            if not filename.lower().endswith(
                    tuple(re.findall("\\*(\\.[a-z]{1,10})", fileFilter))):
                ext = re.search("\\*(\\.[a-z]{1,10})", selectedFileFilter)
                if ext:
                    filename = filename + ext.group(1)
            self.leOutputFile.setText(filename)
            settings.setValue('/Processing/LastOutputPath',
                              os.path.dirname(filename))
            settings.setValue('/Processing/encoding', encoding)
Exemple #3
0
    def saveToSpatialite(self):
        fileFilter = self.output.tr("Spatialite files(*.sqlite)", "OutputFile")

        settings = QSettings()
        if settings.contains("/Processing/LastOutputPath"):
            path = settings.value("/Processing/LastOutputPath")
        else:
            path = ProcessingConfig.getSetting(ProcessingConfig.OUTPUT_FOLDER)

        encoding = settings.value("/Processing/encoding", "System")
        fileDialog = QgsEncodingFileDialog(self, self.tr("Save Spatialite"), path, fileFilter, encoding)
        fileDialog.setFileMode(QFileDialog.AnyFile)
        fileDialog.setAcceptMode(QFileDialog.AcceptSave)
        fileDialog.setConfirmOverwrite(False)

        if fileDialog.exec_() == QDialog.Accepted:
            files = fileDialog.selectedFiles()
            encoding = unicode(fileDialog.encoding())
            self.output.encoding = encoding
            fileName = unicode(files[0])
            selectedFileFilter = unicode(fileDialog.selectedNameFilter())
            if not fileName.lower().endswith(tuple(re.findall("\*(\.[a-z]{1,10})", fileFilter))):
                ext = re.search("\*(\.[a-z]{1,10})", selectedFileFilter)
                if ext:
                    fileName += ext.group(1)
            settings.setValue("/Processing/LastOutputPath", os.path.dirname(fileName))
            settings.setValue("/Processing/encoding", encoding)

            uri = QgsDataSourceUri()
            uri.setDatabase(fileName)
            uri.setDataSource("", self.output.name.lower(), "the_geom" if self.output.hasGeometry() else None)
            self.leText.setText("spatialite:" + uri.uri())
    def saveToSpatialite(self):
        fileFilter = self.tr('SpatiaLite files (*.sqlite)', 'OutputFile')

        settings = QgsSettings()
        if settings.contains('/Processing/LastOutputPath'):
            path = settings.value('/Processing/LastOutputPath')
        else:
            path = ProcessingConfig.getSetting(ProcessingConfig.OUTPUT_FOLDER)

        fileDialog = QgsEncodingFileDialog(
            self, self.tr('Save SpatiaLite'), path, fileFilter, self.encoding)
        fileDialog.setFileMode(QFileDialog.AnyFile)
        fileDialog.setAcceptMode(QFileDialog.AcceptSave)
        fileDialog.setOption(QFileDialog.DontConfirmOverwrite, True)

        if fileDialog.exec_() == QDialog.Accepted:
            self.use_temporary = False
            files = fileDialog.selectedFiles()
            self.encoding = str(fileDialog.encoding())
            fileName = str(files[0])
            selectedFileFilter = str(fileDialog.selectedNameFilter())
            if not fileName.lower().endswith(
                    tuple(re.findall("\\*(\\.[a-z]{1,10})", fileFilter))):
                ext = re.search("\\*(\\.[a-z]{1,10})", selectedFileFilter)
                if ext:
                    fileName += ext.group(1)
            settings.setValue('/Processing/LastOutputPath',
                              os.path.dirname(fileName))
            settings.setValue('/Processing/encoding', self.encoding)

            uri = QgsDataSourceUri()
            uri.setDatabase(fileName)
            uri.setDataSource('', self.parameter.name().lower(),
                              'the_geom' if isinstance(self.parameter, QgsProcessingParameterFeatureSink) and self.parameter.hasGeometry() else None)
            self.leText.setText("spatialite:" + uri.uri())
Exemple #5
0
    def getDialog(
        self,
        parent=None,
        caption="",
        acceptMode=QFileDialog.AcceptOpen,
        fileMode=QFileDialog.ExistingFile,
        filter="",
        selectedFilter=None,
        useEncoding=False,
    ):
        if useEncoding:
            dialog = QgsEncodingFileDialog(parent, caption, getLastUsedDir(), filter, getLastUsedEncoding())
        else:
            dialog = QFileDialog(parent, caption, getLastUsedDir(), filter)
        dialog.setFileMode(fileMode)
        dialog.setAcceptMode(acceptMode)

        if selectedFilter is not None:
            dialog.selectNameFilter(selectedFilter[0])

        if not dialog.exec_():
            if useEncoding:
                return ("", None)
            return ""

        # change the selected filter value
        if selectedFilter is not None:
            selectedFilter[0] = dialog.selectedNameFilter()

        # save the last used dir and return the selected files
        files = dialog.selectedFiles()
        if files != "":
            setLastUsedDir(files[0])

            if fileMode != QFileDialog.ExistingFiles:
                files = files[0]
                # append the extension if not already present
                if fileMode == QFileDialog.AnyFile:
                    firstExt = None
                    for ext in FileFilter.getFilterExtensions(dialog.selectedNameFilter()):
                        if FileFilter.filenameMatchesFilterExt(files, ext):
                            firstExt = None
                            break

                        if firstExt is None:
                            firstExt = ext

                    if firstExt is not None:
                        if firstExt.startswith("*"):
                            files += firstExt[1:]

        if useEncoding:
            encoding = dialog.encoding()
            # encoding setted yet by QgsEncodingFileDialog
            # setLastUsedEncoding(encoding)
            return (files, encoding)

        return files
Exemple #6
0
def dirDialog(parent):
    settings = QSettings()
    dirName = settings.value("/UI/lastShapefileDir")
    encode = settings.value("/UI/encoding")
    fileDialog = QgsEncodingFileDialog(parent, QCoreApplication.translate("fTools", "Save output directory"), dirName, encode)
    fileDialog.setFileMode(QFileDialog.DirectoryOnly)
    fileDialog.setAcceptMode(QFileDialog.AcceptSave)
    fileDialog.setConfirmOverwrite(False)
    if not fileDialog.exec_() == QDialog.Accepted:
        return None, None
    folders = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir", QFileInfo(unicode(folders[0])).absolutePath())
    return (unicode(folders[0]), unicode(fileDialog.encoding()))
Exemple #7
0
def saveDialog(parent, filtering="Shapefiles (*.shp *.SHP)"):
    settings = QSettings()
    dirName = settings.value("/UI/lastShapefileDir")
    encode = settings.value("/UI/encoding")
    fileDialog = QgsEncodingFileDialog(parent, QCoreApplication.translate("fTools", "Save output shapefile"), dirName, filtering, encode)
    fileDialog.setDefaultSuffix("shp")
    fileDialog.setFileMode(QFileDialog.AnyFile)
    fileDialog.setAcceptMode(QFileDialog.AcceptSave)
    fileDialog.setConfirmOverwrite(True)
    if not fileDialog.exec_() == QDialog.Accepted:
        return None, None
    files = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir", QFileInfo(unicode(files[0])).absolutePath())
    return (unicode(files[0]), unicode(fileDialog.encoding()))
Exemple #8
0
    def getDialog(self, parent=None, caption='', acceptMode=QFileDialog.AcceptOpen, fileMode=QFileDialog.ExistingFile, filter='', selectedFilter=None, useEncoding=False):
        if useEncoding:
            dialog = QgsEncodingFileDialog(parent, caption, getLastUsedDir(), filter, getLastUsedEncoding())
        else:
            dialog = QFileDialog(parent, caption, getLastUsedDir(), filter)
        dialog.setFileMode(fileMode)
        dialog.setAcceptMode(acceptMode)

        if selectedFilter is not None:
            dialog.selectNameFilter(selectedFilter[0])

        if not dialog.exec_():
            if useEncoding:
                return ('', None)
            return ''

        # change the selected filter value
        if selectedFilter is not None:
            selectedFilter[0] = dialog.selectedNameFilter()

        # save the last used dir and return the selected files
        files = dialog.selectedFiles()
        if files != '':
            setLastUsedDir(files[0])

            if fileMode != QFileDialog.ExistingFiles:
                files = files[0]
                # append the extension if not already present
                if fileMode == QFileDialog.AnyFile:
                    firstExt = None
                    for ext in FileFilter.getFilterExtensions(dialog.selectedNameFilter()):
                        if FileFilter.filenameMatchesFilterExt(files, ext):
                            firstExt = None
                            break

                        if firstExt is None:
                            firstExt = ext

                    if firstExt is not None:
                        if firstExt.startswith('*'):
                            files += firstExt[1:]

        if useEncoding:
            encoding = dialog.encoding()
            # encoding setted yet by QgsEncodingFileDialog
            #setLastUsedEncoding(encoding)
            return (files, encoding)

        return files
Exemple #9
0
def dirDialog(parent):
    settings = QSettings()
    dirName = settings.value("/UI/lastShapefileDir")
    encode = settings.value("/UI/encoding")
    fileDialog = QgsEncodingFileDialog(parent, "Save output shapefile",
                                       dirName, encode)
    fileDialog.setFileMode(QFileDialog.DirectoryOnly)
    fileDialog.setAcceptMode(QFileDialog.AcceptSave)
    fileDialog.setConfirmOverwrite(False)
    if not fileDialog.exec_() == QDialog.Accepted:
        return None, None
    folders = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir",
                      QFileInfo(unicode(folders[0])).absolutePath())
    return (unicode(folders[0]), unicode(fileDialog.encoding()))
Exemple #10
0
def openDialog( parent, filtering="GPX (*.gpx)", dialogMode="SingleFile"):
    settings = QSettings()
    dirName = settings.value( "/UI/lastShapefileDir" )
    encode = settings.value( "/UI/encoding" )
    fileDialog = QgsEncodingFileDialog( parent, "Save output file", dirName, filtering, encode )
    fileDialog.setFileMode( QFileDialog.ExistingFiles )
    fileDialog.setAcceptMode( QFileDialog.AcceptOpen )
    if not fileDialog.exec_() == QDialog.Accepted:
            return None, None
    files = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir", QFileInfo( unicode( files[0] ) ).absolutePath() )
    if dialogMode == "SingleFile":
      return ( unicode( files[0] ), unicode( fileDialog.encoding() ) )
    else:
      return ( files, unicode( fileDialog.encoding() ) )
Exemple #11
0
def openDialog( parent, filtering="GPX (*.gpx)", dialogMode="SingleFile"):
    settings = QSettings()
    dirName = settings.value( "/UI/lastShapefileDir" )
    encode = settings.value( "/UI/encoding" )
    fileDialog = QgsEncodingFileDialog( parent, "Save output file", dirName, filtering, encode )
    fileDialog.setFileMode( QFileDialog.ExistingFiles )
    fileDialog.setAcceptMode( QFileDialog.AcceptOpen )
    if not fileDialog.exec_() == QDialog.Accepted:
            return None, None
    files = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir", QFileInfo( unicode( files[0] ) ).absolutePath() )
    if dialogMode == "SingleFile":
      return ( unicode( files[0] ), unicode( fileDialog.encoding() ) )
    else:
      return ( files, unicode( fileDialog.encoding() ) )
Exemple #12
0
 def browse(self):
     """ open save layer dialog """
     settings = QgsSettings()
     dirName = settings.value("/UI/lastShapefileDir")
     encode = settings.value("/UI/encoding")
     fileDialog = QgsEncodingFileDialog(self, "Output shape file", dirName,
                                        "Shape file (*.shp)", encode)
     fileDialog.setDefaultSuffix("shp")
     fileDialog.setFileMode(QtWidgets.QFileDialog.AnyFile)
     fileDialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)
     #fileDialog.setConfirmOverwrite(True)
     if not fileDialog.exec_() == QtWidgets.QDialog.Accepted:
         return
     files = fileDialog.selectedFiles()
     self.pointEdit.setText(files[0])
     self.encoding = fileDialog.encoding()
 def browse(self):
     """ open save layer dialog """
     settings = QgsSettings()
     dirName = settings.value("/UI/lastShapefileDir")
     encode = settings.value("/UI/encoding")
     fileDialog = QgsEncodingFileDialog(self, "Output shape file", dirName,
                                        "Shape file (*.shp)", encode)
     fileDialog.setDefaultSuffix("shp")
     fileDialog.setFileMode(QtWidgets.QFileDialog.AnyFile)
     fileDialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)
     #fileDialog.setConfirmOverwrite(True)
     if not fileDialog.exec_() == QtWidgets.QDialog.Accepted:
         return
     files = fileDialog.selectedFiles()
     self.pointEdit.setText(files[0])
     self.encoding = fileDialog.encoding()
Exemple #14
0
def saveDialog(parent, filtering="Shapefiles (*.shp *.SHP)"):
    settings = QSettings()
    dirName = settings.value("/UI/lastShapefileDir")
    encode = settings.value("/UI/encoding")
    fileDialog = QgsEncodingFileDialog(parent, "Save output shapefile",
                                       dirName, filtering, encode)
    fileDialog.setDefaultSuffix("shp")
    fileDialog.setFileMode(QFileDialog.AnyFile)
    fileDialog.setAcceptMode(QFileDialog.AcceptSave)
    fileDialog.setConfirmOverwrite(True)
    if not fileDialog.exec_() == QDialog.Accepted:
        return None, None
    files = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir",
                      QFileInfo(unicode(files[0])).absolutePath())
    return (unicode(files[0]), unicode(fileDialog.encoding()))
Exemple #15
0
def save_dialog(filtering="CSV (*.csv *.CSV)"):
    settings = QSettings()
    dirName = settings.value("/UI/lastShapefileDir")
    encode = settings.value("/UI/encoding")
    fileDialog = QgsEncodingFileDialog(None, "Save output csv", dirName,
                                       filtering, encode)
    fileDialog.setDefaultSuffix('csv')
    fileDialog.setFileMode(QFileDialog.AnyFile)
    fileDialog.setAcceptMode(QFileDialog.AcceptSave)
    # fileDialog.setConfirmOverwrite(True)
    if not fileDialog.exec_() == QDialog.Accepted:
        return None, None
    files = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir",
                      QFileInfo(files[0]).absolutePath())
    return (files[0], fileDialog.encoding())
Exemple #16
0
def save_dialog_geo(filtering="ESRI Shapefile (*.shp *.SHP)"):
    settings = QSettings()
    dirName = settings.value("/UI/lastShapefileDir")
    encode = settings.value("/UI/encoding")
    fileDialog = QgsEncodingFileDialog(
        None, "Save output ShapeFile", dirName, filtering, encode
        )
    fileDialog.setDefaultSuffix('shp')
    fileDialog.setFileMode(QFileDialog.AnyFile)
    fileDialog.setAcceptMode(QFileDialog.AcceptSave)
    fileDialog.setConfirmOverwrite(True)
    if not fileDialog.exec_() == QDialog.Accepted:
        return None, None
    files = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir",
                      QFileInfo(unicode(files[0])).absolutePath())
    return (unicode(files[0]), unicode(fileDialog.encoding()))
Exemple #17
0
def openDialog(parent, filtering="Shapefiles (*.shp *.SHP)", dialogMode="SingleFile"):
    settings = QSettings()
    dirName = settings.value("/UI/lastShapefileDir")
    encode = settings.value("/UI/encoding")
    fileDialog = QgsEncodingFileDialog(
        parent,
        QCoreApplication.translate("fTools", "Select input file")
        if dialogMode == "SingleFile" else
        QCoreApplication.translate("fTools", "Select input files"),
        dirName, filtering, encode)
    fileDialog.setFileMode(QFileDialog.ExistingFiles)
    fileDialog.setAcceptMode(QFileDialog.AcceptOpen)
    if not fileDialog.exec_() == QDialog.Accepted:
        return None, None
    files = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir", QFileInfo(unicode(files[0])).absolutePath())
    if dialogMode == "SingleFile":
        return (unicode(files[0]), unicode(fileDialog.encoding()))
    else:
        return (files, unicode(fileDialog.encoding()))
Exemple #18
0
def openDialog(parent, filtering="Shapefiles (*.shp *.SHP)", dialogMode="SingleFile"):
    settings = QSettings()
    dirName = settings.value("/UI/lastShapefileDir")
    encode = settings.value("/UI/encoding")
    fileDialog = QgsEncodingFileDialog(
        parent,
        QCoreApplication.translate("fTools", "Select input file")
        if dialogMode == "SingleFile" else
        QCoreApplication.translate("fTools", "Select input files"),
        dirName, filtering, encode)
    fileDialog.setFileMode(QFileDialog.ExistingFiles)
    fileDialog.setAcceptMode(QFileDialog.AcceptOpen)
    if not fileDialog.exec_() == QDialog.Accepted:
        return None, None
    files = fileDialog.selectedFiles()
    settings.setValue("/UI/lastShapefileDir", QFileInfo(unicode(files[0])).absolutePath())
    if dialogMode == "SingleFile":
        return (unicode(files[0]), unicode(fileDialog.encoding()))
    else:
        return (files, unicode(fileDialog.encoding()))
Exemple #19
0
    def selectFile(self):
        lastDir = self.settings.value('lastShapeDir', '.')
        shpFilter = self.tr('ESRI Shapefiles (*.shp *.SHP)')
        self.encoding = self.settings.value('encoding', 'System')

        fileDialog = QgsEncodingFileDialog(
            self, self.tr('Save file'), lastDir, shpFilter, self.encoding)

        fileDialog.setDefaultSuffix('shp')
        fileDialog.setFileMode(QFileDialog.AnyFile)
        fileDialog.setAcceptMode(QFileDialog.AcceptSave)
        fileDialog.setConfirmOverwrite(True)

        if fileDialog.exec_():
            fileName = fileDialog.selectedFiles()[0]
            self.encoding = fileDialog.encoding()

            self.leOutputShape.setText(fileName)
            self.settings.setValue('lastShapeDir',
                QFileInfo(fileName).absoluteDir().absolutePath())
            self.settings.setValue('encoding', self.encoding)
Exemple #20
0
    def saveToSpatialite(self):
        fileFilter = self.output.tr('SpatiaLite files (*.sqlite)',
                                    'OutputFile')

        settings = QgsSettings()
        if settings.contains('/Processing/LastOutputPath'):
            path = settings.value('/Processing/LastOutputPath')
        else:
            path = ProcessingConfig.getSetting(ProcessingConfig.OUTPUT_FOLDER)

        encoding = settings.value('/Processing/encoding', 'System')
        fileDialog = QgsEncodingFileDialog(self, self.tr('Save Spatialite'),
                                           path, fileFilter, encoding)
        fileDialog.setFileMode(QFileDialog.AnyFile)
        fileDialog.setAcceptMode(QFileDialog.AcceptSave)
        fileDialog.setOption(QFileDialog.DontConfirmOverwrite, True)

        if fileDialog.exec_() == QDialog.Accepted:
            files = fileDialog.selectedFiles()
            encoding = str(fileDialog.encoding())
            self.output.encoding = encoding
            fileName = str(files[0])
            selectedFileFilter = str(fileDialog.selectedNameFilter())
            if not fileName.lower().endswith(
                    tuple(re.findall("\\*(\\.[a-z]{1,10})", fileFilter))):
                ext = re.search("\\*(\\.[a-z]{1,10})", selectedFileFilter)
                if ext:
                    fileName += ext.group(1)
            settings.setValue('/Processing/LastOutputPath',
                              os.path.dirname(fileName))
            settings.setValue('/Processing/encoding', encoding)

            uri = QgsDataSourceUri()
            uri.setDatabase(fileName)
            uri.setDataSource(
                '', self.output.name.lower(),
                'the_geom' if self.output.hasGeometry() else None)
            self.leText.setText("spatialite:" + uri.uri())
    def browseOutputFC(self):
        filtering = "Shapefiles (*.shp *.SHP)"
        settings = QSettings()
        dirName = settings.value("/UI/lastShapefileDir")
        encode = settings.value("/UI/encoding")
        fileDialog = QgsEncodingFileDialog(
            None, QCoreApplication.translate("fTools",
                                             "Save output shapefile"), dirName,
            filtering, encode)
        fileDialog.setDefaultSuffix("shp")
        fileDialog.setFileMode(QFileDialog.AnyFile)
        fileDialog.setAcceptMode(QFileDialog.AcceptSave)
        fileDialog.setConfirmOverwrite(True)
        if not fileDialog.exec_() == QDialog.Accepted:
            return None, None
        files = fileDialog.selectedFiles()
        settings.setValue("/UI/lastShapefileDir",
                          QFileInfo(unicode(files[0])).absolutePath())

        #return (unicode(files[0]), unicode(fileDialog.encoding()))
        self.outFilePath = unicode(files[0])
        self.encoding = unicode(fileDialog.encoding())
        self.dlg.outputLineEdit.setText(self.outFilePath)
    def selectFile(self):
        lastShapeFile = self.settings.value("lastShapeFile", "")
        shpFilter = self.tr("ESRI Shapefiles (*.shp *.SHP)")
        self.encoding = self.settings.value("encoding", "System")

        fileDialog = QgsEncodingFileDialog(self, self.tr("Save file"), lastShapeFile, shpFilter, self.encoding)

        fileDialog.setDefaultSuffix("shp")
        fileDialog.setFileMode(QFileDialog.AnyFile)
        fileDialog.setAcceptMode(QFileDialog.AcceptSave)
        fileDialog.setConfirmOverwrite(False)

        if fileDialog.exec_():
            fileName = fileDialog.selectedFiles()[0]
            fileName = os.path.abspath(fileName)
            self.encoding = fileDialog.encoding()
            self.leOutputShape.setText(fileName)
            self.settings.setValue("lastShapeFile", fileName)
            self.settings.setValue("encoding", self.encoding)
            if os.path.isfile(fileName):
                self.chkAppend.setEnabled(True)
            else:
                self.chkAppend.setChecked(False)
                self.chkAppend.setEnabled(False)