ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change
on this file since 0274aea was
d3ca363,
checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago
|
Setting graph range - SASVIEW-381
|
-
Property mode set to
100755
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d3ca363] | 1 | """ |
---|
| 2 | Allows users to change the range of the current graph |
---|
| 3 | """ |
---|
| 4 | from PyQt4 import QtGui |
---|
| 5 | |
---|
| 6 | # Local UI |
---|
| 7 | from sas.qtgui.UI.SetGraphRangeUI import Ui_setGraphRangeUI |
---|
| 8 | |
---|
| 9 | class SetGraphRange(QtGui.QDialog, Ui_setGraphRangeUI): |
---|
| 10 | def __init__(self, parent=None, x_range=(0.0, 0.0), y_range=(0.0, 0.0)): |
---|
| 11 | super(SetGraphRange, self).__init__() |
---|
| 12 | |
---|
| 13 | self.setupUi(self) |
---|
| 14 | assert(isinstance(x_range, tuple)) |
---|
| 15 | assert(isinstance(y_range, tuple)) |
---|
| 16 | |
---|
| 17 | self.txtXmin.setValidator(QtGui.QDoubleValidator()) |
---|
| 18 | self.txtXmax.setValidator(QtGui.QDoubleValidator()) |
---|
| 19 | self.txtYmin.setValidator(QtGui.QDoubleValidator()) |
---|
| 20 | self.txtYmax.setValidator(QtGui.QDoubleValidator()) |
---|
| 21 | |
---|
| 22 | self.txtXmin.setText(str(x_range[0])) |
---|
| 23 | self.txtXmax.setText(str(x_range[1])) |
---|
| 24 | self.txtYmin.setText(str(y_range[0])) |
---|
| 25 | self.txtYmax.setText(str(y_range[1])) |
---|
| 26 | |
---|
| 27 | def xrange(self): |
---|
| 28 | """ |
---|
| 29 | Return a tuple with line edit content of (xmin, xmax) |
---|
| 30 | """ |
---|
| 31 | return (float(self.txtXmin.text()), |
---|
| 32 | float(self.txtXmax.text())) |
---|
| 33 | |
---|
| 34 | def yrange(self): |
---|
| 35 | """ |
---|
| 36 | Return a tuple with line edit content of (ymin, ymax) |
---|
| 37 | """ |
---|
| 38 | return (float(self.txtYmin.text()), |
---|
| 39 | float(self.txtYmax.text())) |
---|
Note: See
TracBrowser
for help on using the repository browser.