Skip to content

Commit

Permalink
[processing] consider min and max values for int values
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Sep 22, 2013
1 parent f890449 commit 05a9481
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/NumberInputPanel.py
Expand Up @@ -28,16 +28,16 @@


class NumberInputPanel(QtGui.QWidget): class NumberInputPanel(QtGui.QWidget):


def __init__(self, number, isInteger): def __init__(self, number, minimum, maximum, isInteger):
super(NumberInputPanel, self).__init__(None) super(NumberInputPanel, self).__init__(None)
self.horizontalLayout = QtGui.QHBoxLayout(self) self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2) self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0) self.horizontalLayout.setMargin(0)
self.isInteger = isInteger self.isInteger = isInteger
if isInteger: if isInteger:
self.spin = QtGui.QSpinBox() self.spin = QtGui.QSpinBox()
self.spin.setMaximum(1000000000) self.spin.setMaximum(maximum)
self.spin.setMinimum(-1000000000) self.spin.setMinimum(minimum)
self.spin.setValue(number) self.spin.setValue(number)
self.horizontalLayout.addWidget(self.spin) self.horizontalLayout.addWidget(self.spin)
self.setLayout(self.horizontalLayout) self.setLayout(self.horizontalLayout)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/ParametersPanel.py
Expand Up @@ -264,7 +264,7 @@ def getWidgetFromParameter(self, param):
opts.append(self.getExtendedLayerName(opt)) opts.append(self.getExtendedLayerName(opt))
item = MultipleInputPanel(opts) item = MultipleInputPanel(opts)
elif isinstance(param, ParameterNumber): elif isinstance(param, ParameterNumber):
item = NumberInputPanel(param.default, param.isInteger) item = NumberInputPanel(param.default, param.min, param.max, param.isInteger)
elif isinstance(param, ParameterExtent): elif isinstance(param, ParameterExtent):
item = ExtentSelectionPanel(self.parent, self.alg, param.default) item = ExtentSelectionPanel(self.parent, self.alg, param.default)
elif isinstance(param, ParameterCrs): elif isinstance(param, ParameterCrs):
Expand Down

0 comments on commit 05a9481

Please sign in to comment.