mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Restrict available formats when running algorithms to those supported
by the provider
This commit is contained in:
parent
4ae9241e71
commit
4e3b082594
@ -63,12 +63,10 @@ def getFileFilter(param):
|
|||||||
for i in range(len(exts)):
|
for i in range(len(exts)):
|
||||||
exts[i] = tr('{0} files (*.{1})', 'QgsProcessingParameterRasterDestination').format(exts[i].upper(), exts[i].lower())
|
exts[i] = tr('{0} files (*.{1})', 'QgsProcessingParameterRasterDestination').format(exts[i].upper(), exts[i].lower())
|
||||||
return ';;'.join(exts) + ';;' + tr('All files (*.*)')
|
return ';;'.join(exts) + ';;' + tr('All files (*.*)')
|
||||||
elif param.type() == 'table':
|
elif param.type() in ('sink', 'vectorDestination'):
|
||||||
exts = ['csv', 'dbf']
|
if param.provider() is not None:
|
||||||
for i in range(len(exts)):
|
exts = param.provider().supportedOutputVectorLayerExtensions()
|
||||||
exts[i] = tr('{0} files (*.{1})', 'ParameterTable').format(exts[i].upper(), exts[i].lower())
|
else:
|
||||||
return tr('All files (*.*)') + ';;' + ';;'.join(exts)
|
|
||||||
elif param.type() == 'sink':
|
|
||||||
exts = QgsVectorFileWriter.supportedFormatExtensions()
|
exts = QgsVectorFileWriter.supportedFormatExtensions()
|
||||||
for i in range(len(exts)):
|
for i in range(len(exts)):
|
||||||
exts[i] = tr('{0} files (*.{1})', 'ParameterVector').format(exts[i].upper(), exts[i].lower())
|
exts[i] = tr('{0} files (*.{1})', 'ParameterVector').format(exts[i].upper(), exts[i].lower())
|
||||||
|
@ -45,6 +45,11 @@ QString QgsProcessingProvider::longName() const
|
|||||||
return name();
|
return name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList QgsProcessingProvider::supportedOutputRasterLayerExtensions() const
|
||||||
|
{
|
||||||
|
return QStringList() << QStringLiteral( "tif" );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsProcessingProvider::refreshAlgorithms()
|
void QgsProcessingProvider::refreshAlgorithms()
|
||||||
{
|
{
|
||||||
qDeleteAll( mAlgorithms );
|
qDeleteAll( mAlgorithms );
|
||||||
|
@ -106,7 +106,7 @@ class CORE_EXPORT QgsProcessingProvider : public QObject
|
|||||||
* \see supportedOutputVectorLayerExtensions()
|
* \see supportedOutputVectorLayerExtensions()
|
||||||
* \see supportedOutputTableExtensions()
|
* \see supportedOutputTableExtensions()
|
||||||
*/
|
*/
|
||||||
virtual QStringList supportedOutputRasterLayerExtensions() const { return QStringList() << QStringLiteral( "tif" ); }
|
virtual QStringList supportedOutputRasterLayerExtensions() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of the vector format file extensions supported by this provider.
|
* Returns a list of the vector format file extensions supported by this provider.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user