Skip to content

Commit

Permalink
Merge pull request #738 from radosuav/sextante_file_extensions
Browse files Browse the repository at this point in the history
[sextante] Append output file extension if missing
  • Loading branch information
volaya committed Jul 16, 2013
2 parents 13c71d4 + df627b1 commit f86b7af
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/plugins/sextante/gui/OutputSelectionPanel.py
Expand Up @@ -23,6 +23,7 @@
__revision__ = '$Format:%H$'

import os.path
import re
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.gui import *
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f86b7af

Please sign in to comment.