Skip to content
Permalink
Browse files

Merge pull request #738 from radosuav/sextante_file_extensions

[sextante] Append output file extension if missing
  • Loading branch information
volaya committed Jul 16, 2013
2 parents 13c71d4 + df627b1 commit f86b7af22e1e9fac9f0e988c317cec1ab291d477
Showing with 6 additions and 0 deletions.
  1. +6 −0 python/plugins/sextante/gui/OutputSelectionPanel.py
@@ -23,6 +23,7 @@
__revision__ = '$Format:%H$'

import os.path
import re
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.gui import *
@@ -90,6 +91,11 @@ def saveToFile(self):
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,5})", filefilter))):
ext = re.search("\*(\.[a-z]{1,5})", selectedFilefilter)
if ext:
filename = filename + ext.group(1)
self.text.setText(filename)
settings.setValue("/SextanteQGIS/LastOutputPath", os.path.dirname(filename))
settings.setValue("/SextanteQGIS/encoding", encoding)

0 comments on commit f86b7af

Please sign in to comment.
You can’t perform that action at this time.