Skip to content

Commit

Permalink
[sextante] If no extension is specified for an output file append the
Browse files Browse the repository at this point in the history
extension from the selected file filter.
  • Loading branch information
rmgu committed Jul 15, 2013
1 parent 33cbb6c commit df627b1
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 df627b1

Please sign in to comment.