[processing] fixed adding extension to output filenames in batch interface

fixes #10444
This commit is contained in:
volaya 2015-10-01 08:11:39 +02:00
parent a9dab06a6a
commit 7f061d2d75

View File

@ -16,6 +16,7 @@
* *
***************************************************************************
"""
import re
__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@ -77,10 +78,15 @@ class BatchOutputSelectionPanel(QWidget):
path = unicode(settings.value('/Processing/LastBatchOutputPath'))
else:
path = ''
filename = QFileDialog.getSaveFileName(self, self.tr('Save file'), path,
filefilter)
filename, selectedFileFilter = QFileDialog.getSaveFileNameAndFilter(self,
self.tr('Save file'), path, filefilter)
print filename, selectedFileFilter
if filename:
filename = unicode(filename)
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/LastBatchOutputPath', os.path.dirname(filename))
dlg = AutofillDialog(self.alg)
dlg.exec_()