[processing] Add option whether to load batch output layers on completion

By always trying to load all layers, we severely limit the usefulness
of batch processing. E.g. try clipping 200 layers - and then
get ready to punch something as you wait for all the results to load.
This commit is contained in:
Nyall Dawson 2017-11-10 14:42:29 +10:00
parent 3fc90301a9
commit 2ed2248827
2 changed files with 11 additions and 1 deletions

View File

@ -81,6 +81,9 @@ class BatchAlgorithmDialog(AlgorithmDialogBase):
feedback = self.createFeedback()
load_layers = self.mainWidget.checkLoadLayersOnCompletion.isChecked()
project = QgsProject.instance() if load_layers else None
for row in range(self.mainWidget.tblParameters.rowCount()):
col = 0
parameters = {}
@ -107,7 +110,7 @@ class BatchAlgorithmDialog(AlgorithmDialogBase):
if isinstance(out, (QgsProcessingParameterRasterDestination,
QgsProcessingParameterFeatureSink)):
# load rasters and sinks on completion
parameters[out.name()] = QgsProcessingOutputLayerDefinition(text, QgsProject.instance())
parameters[out.name()] = QgsProcessingOutputLayerDefinition(text, project)
else:
parameters[out.name()] = text
col += 1

View File

@ -120,6 +120,13 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="6">
<widget class="QCheckBox" name="checkLoadLayersOnCompletion">
<property name="text">
<string>Load layers on completion</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>