Skip to content
Permalink
Browse files

[processing] remember min/max value in number params in modeler

  • Loading branch information
volaya committed Oct 19, 2014
1 parent da5766c commit 18e9fba08b4def90aabed33ad240cbbd3cb4c12a
Showing with 11 additions and 2 deletions.
  1. +11 −2 python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py
@@ -17,6 +17,7 @@
***************************************************************************
"""


__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
@@ -25,6 +26,8 @@

__revision__ = '$Format:%H$'

import math

from PyQt4.QtCore import *
from PyQt4.QtGui import *

@@ -203,14 +206,20 @@ def setupUi(self):
self.horizontalLayout2.addWidget(QLabel(self.tr('Min/Max values')))
self.minTextBox = QLineEdit()
self.maxTextBox = QLineEdit()
if self.param is not None:
self.minTextBox.setText(str(self.param.min))
self.maxTextBox.setText(str(self.param.max))
self.horizontalLayout2.addWidget(self.minTextBox)
self.horizontalLayout2.addWidget(self.maxTextBox)
self.verticalLayout.addLayout(self.horizontalLayout2)
self.horizontalLayout3.addWidget(QLabel(self.tr('Default value')))
self.defaultTextBox = QLineEdit()
self.defaultTextBox.setText(self.tr('0'))
if self.param is not None:
self.defaultTextBox.setText(str(self.param.default))
default = self.param.default
if self.param.isInteger:
default = int(math.floor(default))
self.defaultTextBox.setText(str(default))
self.horizontalLayout3.addWidget(self.defaultTextBox)
self.verticalLayout.addLayout(self.horizontalLayout3)
elif self.paramType \
@@ -312,7 +321,7 @@ def okPressed(self):
else:
vmax = float(vmax)
self.param = ParameterNumber(name, description, vmin, vmax,
float(str(self.defaultTextBox.text())))
str(self.defaultTextBox.text()))
except:
QMessageBox.warning(self, self.tr('Unable to define parameter'),
self.tr('Wrong or missing parameter values'))

0 comments on commit 18e9fba

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