[processing] List 'All files (*.*)' option last in save as dialogs

See https://ux.stackexchange.com/questions/111689/file-dialog-formats-list-should-all-files-be-listed-first-or-last for discussion:

- for 'file open' dialogs, wildcard options should be listed first
- for 'file save' dialogs, wildcard options should be listed last
This commit is contained in:
Nyall Dawson 2017-09-12 10:20:52 +10:00
parent 3d3b6d1a25
commit 8fcad6aed9

View File

@ -62,7 +62,7 @@ def getFileFilter(param):
exts = dataobjects.getSupportedOutputRasterLayerExtensions()
for i in range(len(exts)):
exts[i] = tr('{0} files (*.{1})', 'QgsProcessingParameterRasterDestination').format(exts[i].upper(), exts[i].lower())
return tr('All files (*.*)') + ';;' + ';;'.join(exts)
return ';;'.join(exts) + ';;' + tr('All files (*.*)')
elif param.type() == 'table':
exts = ['csv', 'dbf']
for i in range(len(exts)):
@ -72,12 +72,12 @@ def getFileFilter(param):
exts = QgsVectorFileWriter.supportedFormatExtensions()
for i in range(len(exts)):
exts[i] = tr('{0} files (*.{1})', 'ParameterVector').format(exts[i].upper(), exts[i].lower())
return tr('All files (*.*)') + ';;' + ';;'.join(exts)
return ';;'.join(exts) + ';;' + tr('All files (*.*)')
elif param.type() == 'source':
return QgsProviderRegistry.instance().fileVectorFilters()
elif param.type() == 'vector':
return QgsProviderRegistry.instance().fileVectorFilters()
elif param.type() == 'fileDestination':
return tr('All files (*.*)') + ';;' + param.fileFilter()
return param.fileFilter() + ';;' + tr('All files (*.*)')
return ''