|
17 | 17 | *************************************************************************** |
18 | 18 | """ |
19 | 19 |
|
| 20 | + |
20 | 21 | __author__ = 'Victor Olaya' |
21 | 22 | __date__ = 'August 2012' |
22 | 23 | __copyright__ = '(C) 2012, Victor Olaya' |
|
25 | 26 |
|
26 | 27 | __revision__ = '$Format:%H$' |
27 | 28 |
|
| 29 | +import math |
| 30 | + |
28 | 31 | from PyQt4.QtCore import * |
29 | 32 | from PyQt4.QtGui import * |
30 | 33 |
|
@@ -203,14 +206,20 @@ def setupUi(self): |
203 | 206 | self.horizontalLayout2.addWidget(QLabel(self.tr('Min/Max values'))) |
204 | 207 | self.minTextBox = QLineEdit() |
205 | 208 | self.maxTextBox = QLineEdit() |
| 209 | + if self.param is not None: |
| 210 | + self.minTextBox.setText(str(self.param.min)) |
| 211 | + self.maxTextBox.setText(str(self.param.max)) |
206 | 212 | self.horizontalLayout2.addWidget(self.minTextBox) |
207 | 213 | self.horizontalLayout2.addWidget(self.maxTextBox) |
208 | 214 | self.verticalLayout.addLayout(self.horizontalLayout2) |
209 | 215 | self.horizontalLayout3.addWidget(QLabel(self.tr('Default value'))) |
210 | 216 | self.defaultTextBox = QLineEdit() |
211 | 217 | self.defaultTextBox.setText(self.tr('0')) |
212 | 218 | if self.param is not None: |
213 | | - self.defaultTextBox.setText(str(self.param.default)) |
| 219 | + default = self.param.default |
| 220 | + if self.param.isInteger: |
| 221 | + default = int(math.floor(default)) |
| 222 | + self.defaultTextBox.setText(str(default)) |
214 | 223 | self.horizontalLayout3.addWidget(self.defaultTextBox) |
215 | 224 | self.verticalLayout.addLayout(self.horizontalLayout3) |
216 | 225 | elif self.paramType \ |
@@ -312,7 +321,7 @@ def okPressed(self): |
312 | 321 | else: |
313 | 322 | vmax = float(vmax) |
314 | 323 | self.param = ParameterNumber(name, description, vmin, vmax, |
315 | | - float(str(self.defaultTextBox.text()))) |
| 324 | + str(self.defaultTextBox.text())) |
316 | 325 | except: |
317 | 326 | QMessageBox.warning(self, self.tr('Unable to define parameter'), |
318 | 327 | self.tr('Wrong or missing parameter values')) |
|
0 commit comments