Skip to content

Commit

Permalink
[processing] add proper support for range parameters (fix #29269)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy authored and nyalldawson committed Jan 6, 2020
1 parent 6005bf6 commit 268bfe2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -25,6 +25,7 @@
import os
import re
import uuid
import math
import importlib

from qgis.PyQt.QtCore import QCoreApplication, QUrl
Expand All @@ -48,6 +49,7 @@
QgsProcessingParameterField,
QgsProcessingParameterPoint,
QgsProcessingParameterBoolean,
QgsProcessingParameterRange,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterVectorLayer,
QgsProcessingParameterRasterLayer,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 268bfe2

Please sign in to comment.