Skip to content
Permalink
Browse files

[processing] add proper support for range parameters (fix #29269)

  • Loading branch information
alexbruy authored and nyalldawson committed Jan 6, 2020
1 parent 6005bf6 commit 268bfe264bbe84bf28055a5286420d431c563546
Showing with 8 additions and 0 deletions.
  1. +8 −0 python/plugins/processing/algs/grass7/Grass7Algorithm.py
@@ -25,6 +25,7 @@
import os
import re
import uuid
import math
import importlib

from qgis.PyQt.QtCore import QCoreApplication, QUrl
@@ -48,6 +49,7 @@
QgsProcessingParameterField,
QgsProcessingParameterPoint,
QgsProcessingParameterBoolean,
QgsProcessingParameterRange,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterVectorLayer,
QgsProcessingParameterRasterLayer,
@@ -617,6 +619,12 @@ def processCommand(self, parameters, context, feedback, delOutputs=False):
elif isinstance(param, (QgsProcessingParameterNumber,
QgsProcessingParameterPoint)):
value = self.parameterAsString(parameters, paramName, context)
elif isinstance(param, QgsProcessingParameterRange):
v = self.parameterAsRange(parameters, paramName, context)
if (param.flags() & QgsProcessingParameterDefinition.FlagOptional) and (math.isnan(v[0]) or math.isnan(v[1])):
continue
else:
value = '{},{}'.format(v[0], v[1])
# For everything else, we assume that it is a string
else:
value = '"{}"'.format(

0 comments on commit 268bfe2

Please sign in to comment.
You can’t perform that action at this time.