Skip to content
Permalink
Browse files

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

  • Loading branch information
alexbruy authored and nyalldawson committed Jan 5, 2020
1 parent 7c1b7fa commit 0b749558b9d47ecff38b3d323c7942956a084b4c
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 0b74955

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