18
18
"""
19
19
from builtins import str
20
20
21
-
22
21
__author__ = 'Victor Olaya'
23
22
__date__ = 'August 2012'
24
23
__copyright__ = '(C) 2012, Victor Olaya'
55
54
56
55
57
56
class ModelerParametersDialog (QDialog ):
58
-
59
57
ENTER_NAME = '[Enter name if this is a final result]'
60
58
NOT_SELECTED = '[Not selected]'
61
59
USE_MIN_COVERING_EXTENT = '[Use min covering extent]'
@@ -151,7 +149,7 @@ def setupUi(self):
151
149
self .verticalLayout .addWidget (label )
152
150
self .verticalLayout .addWidget (widget )
153
151
154
- #for output in self._alg.outputs:
152
+ # for output in self._alg.outputs:
155
153
# if output.flags() & QgsProcessingParameterDefinition.FlagHidden:
156
154
# continue
157
155
# if isinstance(output, (OutputRaster, OutputVector, OutputTable,
@@ -241,7 +239,8 @@ def getAvailableValuesOfType(self, paramType, outTypes=[], dataType=None):
241
239
if isinstance (param , t ):
242
240
if dataType is not None :
243
241
if param .datatype in dataType :
244
- values .append (QgsProcessingModelAlgorithm .ChildParameterSource .fromModelParameter (param .name ()))
242
+ values .append (
243
+ QgsProcessingModelAlgorithm .ChildParameterSource .fromModelParameter (param .name ()))
245
244
else :
246
245
values .append (QgsProcessingModelAlgorithm .ChildParameterSource .fromModelParameter (param .name ()))
247
246
break
@@ -258,9 +257,13 @@ def getAvailableValuesOfType(self, paramType, outTypes=[], dataType=None):
258
257
for t in outTypes :
259
258
if isinstance (out , t ):
260
259
if dataType is not None and out .datatype in dataType :
261
- values .append (QgsProcessingModelAlgorithm .ChildParameterSource .fromChildOutput (alg .childId (), out .name ()))
260
+ values .append (
261
+ QgsProcessingModelAlgorithm .ChildParameterSource .fromChildOutput (alg .childId (),
262
+ out .name ()))
262
263
else :
263
- values .append (QgsProcessingModelAlgorithm .ChildParameterSource .fromChildOutput (alg .childId (), out .name ()))
264
+ values .append (
265
+ QgsProcessingModelAlgorithm .ChildParameterSource .fromChildOutput (alg .childId (),
266
+ out .name ()))
264
267
265
268
return values
266
269
@@ -272,7 +275,8 @@ def resolveValueDescription(self, value):
272
275
return self .model .parameterDefinition (value .parameterName ()).description ()
273
276
elif value .source () == QgsProcessingModelAlgorithm .ChildParameterSource .ChildOutput :
274
277
alg = self .model .childAlgorithm (value .outputChildId ())
275
- return self .tr ("'{0}' from algorithm '{1}'" ).format (alg .algorithm ().outputDefinition (value .outputName ()).description (), alg .description ())
278
+ return self .tr ("'{0}' from algorithm '{1}'" ).format (
279
+ alg .algorithm ().outputDefinition (value .outputName ()).description (), alg .description ())
276
280
277
281
return value
278
282
@@ -307,19 +311,23 @@ def createAlgorithm(self):
307
311
if param .isDestination () or param .flags () & QgsProcessingParameterDefinition .FlagHidden :
308
312
continue
309
313
val = self .wrappers [param .name ()].value ()
310
- if ( isinstance (val , QgsProcessingModelAlgorithm .ChildParameterSource ) and val .source () == QgsProcessingModelAlgorithm .ChildParameterSource .StaticValue and not param .checkValueIsAcceptable (val .staticValue ())) \
311
- or (not isinstance (val , QgsProcessingModelAlgorithm .ChildParameterSource ) and not param .checkValueIsAcceptable (val )):
314
+ if (isinstance (val ,
315
+ QgsProcessingModelAlgorithm .ChildParameterSource ) and val .source () == QgsProcessingModelAlgorithm .ChildParameterSource .StaticValue and not param .checkValueIsAcceptable (
316
+ val .staticValue ())) \
317
+ or (not isinstance (val ,
318
+ QgsProcessingModelAlgorithm .ChildParameterSource ) and not param .checkValueIsAcceptable (
319
+ val )):
312
320
self .bar .pushMessage ("Error" , "Wrong or missing value for parameter '%s'" % param .description (),
313
321
level = QgsMessageBar .WARNING )
314
322
return None
315
323
alg .addParameterSource (param .name (), val )
316
324
317
- # outputs = self._alg.outputDefinitions()
318
- # for output in outputs:
319
- # if not output.flags() & QgsProcessingParameterDefinition.FlagHidden:
320
- # name = str(self.valueItems[output.name()].text())
321
- # if name.strip() != '' and name != ModelerParametersDialog.ENTER_NAME:
322
- # alg.outputs[output.name()] = QgsProcessingModelAlgorithm.ModelOutput(name)
325
+ # outputs = self._alg.outputDefinitions()
326
+ # for output in outputs:
327
+ # if not output.flags() & QgsProcessingParameterDefinition.FlagHidden:
328
+ # name = str(self.valueItems[output.name()].text())
329
+ # if name.strip() != '' and name != ModelerParametersDialog.ENTER_NAME:
330
+ # alg.outputs[output.name()] = QgsProcessingModelAlgorithm.ModelOutput(name)
323
331
324
332
selectedOptions = self .dependenciesPanel .selectedoptions
325
333
availableDependencies = self .getAvailableDependencies () # spellok
0 commit comments