Skip to content

Commit feb66d2

Browse files
committedNov 10, 2017
Fix saving/load batch processing models
1 parent 8526a2d commit feb66d2

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed
 

‎python/plugins/processing/gui/BatchPanel.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,19 @@ def load(self):
167167
for param in self.alg.parameterDefinitions():
168168
if param.flags() & QgsProcessingParameterDefinition.FlagHidden:
169169
continue
170+
if param.isDestination():
171+
continue
170172
if param.name() in params:
171-
value = params[param.name()].strip('"')
173+
value = params[param.name()].strip("'")
172174
wrapper = self.wrappers[row][column]
173175
wrapper.setValue(value)
174176
column += 1
175177

176-
for out in self.alg.outputs:
178+
for out in self.alg.destinationParameterDefinitions():
177179
if out.flags() & QgsProcessingParameterDefinition.FlagHidden:
178180
continue
179181
if out.name() in outputs:
180-
value = outputs[out.name()].strip('"')
182+
value = outputs[out.name()].strip("'")
181183
widget = self.tblParameters.cellWidget(row, column)
182184
widget.setValue(value)
183185
column += 1
@@ -198,26 +200,28 @@ def save(self):
198200
for param in alg.parameterDefinitions():
199201
if param.flags() & QgsProcessingParameterDefinition.FlagHidden:
200202
continue
203+
if param.isDestination():
204+
continue
201205
wrapper = self.wrappers[row][col]
202-
if not param.checkValueIsAcceptable(wrapper.value, context):
206+
if not param.checkValueIsAcceptable(wrapper.value(), context):
203207
self.parent.bar.pushMessage("", self.tr('Wrong or missing parameter value: {0} (row {1})').format(
204-
param.description(), row + 1),
205-
level=QgsMessageBar.WARNING, duration=5)
208+
param.description(), row + 1),
209+
level=QgsMessageBar.WARNING, duration=5)
206210
return
207-
algParams[param.name()] = param.getValueAsCommandLineParameter()
211+
algParams[param.name()] = param.valueAsPythonString(wrapper.value(), context)
208212
col += 1
209-
for out in alg.outputs:
213+
for out in alg.destinationParameterDefinitions():
210214
if out.flags() & QgsProcessingParameterDefinition.FlagHidden:
211215
continue
212216
widget = self.tblParameters.cellWidget(row, col)
213217
text = widget.getValue()
214218
if text.strip() != '':
215-
algOutputs[out.name] = text.strip()
219+
algOutputs[out.name()] = text.strip()
216220
col += 1
217221
else:
218222
self.parent.bar.pushMessage("", self.tr('Wrong or missing output value: {0} (row {1})').format(
219-
out.description(), row + 1),
220-
level=QgsMessageBar.WARNING, duration=5)
223+
out.description(), row + 1),
224+
level=QgsMessageBar.WARNING, duration=5)
221225
return
222226
toSave.append({self.PARAMETERS: algParams, self.OUTPUTS: algOutputs})
223227

0 commit comments

Comments
 (0)
Please sign in to comment.