Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] remember min/max value in number params in modeler
  • Loading branch information
volaya committed Oct 19, 2014
1 parent da5766c commit 18e9fba
Showing 1 changed file with 11 additions and 2 deletions.
Expand Up @@ -17,6 +17,7 @@
***************************************************************************
"""


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

__revision__ = '$Format:%H$'

import math

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

Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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'))
Expand Down

0 comments on commit 18e9fba

Please sign in to comment.