Skip to content
Permalink
Browse files

[processing] handle ints and floats in range parameter panel

  • Loading branch information
alexbruy committed Nov 15, 2014
1 parent 42f16ef commit 05830c2c1ddaf5b8ad1d570c3b161ea68e05f725
Showing with 23 additions and 2 deletions.
  1. +8 −0 python/plugins/processing/core/parameters.py
  2. +15 −2 python/plugins/processing/gui/RangePanel.py
@@ -415,6 +415,14 @@ def __init__(self, name='', description='', default='0,1'):
self.default = default
self.value = None

values = default.split(',')
try:
minVal = int(values[0])
maxVal = int(values[1])
self.isInteger = True
except:
self.isInteger = False

def setValue(self, text):
if text is None:
self.value = self.default
@@ -36,9 +36,22 @@ def __init__(self, param):
QWidget.__init__(self)
self.setupUi(self)

self.isInteger = param.isInteger
if self.isInteger:
self.spnMin.setDecimals(0)
self.spnMax.setDecimals(0)

values = param.default.split(',')
self.spnMin.setValue(float(values[0]))
self.spnMax.setValue(float(values[1]))
minVal = float(values[0])
maxVal = float(values[1])
self.spnMin.setValue(minVal)
self.spnMax.setValue(maxVal)

self.spnMin.setMaximum(maxVal)
self.spnMin.setMinimum(minVal)

self.spnMax.setMaximum(maxVal)
self.spnMax.setMinimum(minVal)

def getValue(self):
return '{},{}'.format(self.spnMin.value(), self.spnMax.value())

0 comments on commit 05830c2

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