I am programming a processing algorithm in PyQGIS that allows users to select certain natural protected areas from state-wide datasets that are stored in an internal data structure. The selection of objects for each layer is based on an intersection with an input polygon layer.
The user can define via an enum input whether the multiple output layers should be saved in Esri shapefile format or in a GeoPackage format. So far he/she can further only set the output file directory with QgsProcessingParameterFolderDestination.
Instead of the simply choosing the output folder directly, would it be possible to program a conditional input for either
- Esri shapefile: The output directory as currently used
QgsProcessingParameterFolderDestination(current default) - GeoPackage: Creation of a new GeoPackage or selection of an existing geopackage
This would give the user more control over the output GeoPackage (set a custom name or control overwriting)
QgsProcessingParameterFileDestination(name='OUTPUT', description=self.tr('TEST'), fileFilter='ESRI Shapefile (*.shp *.SHP);;GeoPackage (*.gpkg *.gpkg.zip *.GPKG *.GPKG.ZIP)')or it should only be theQgsProcessingParameterFolderDestination? The names infileFilterwere obtained from the list of filters after executing theQgsVectorFileWriter.fileFilterString(QgsVectorFileWriter.VectorFormatOptions())QgsProcessingParameterFileDestinationto define the folder where the multiple shapefiles are written into OR b.)QgsProcessingParameterFolderDestinationto define the Geopackage where the multiple layers should be written into. Is it feasible to conditionally change the output option?