source: sasview/src/sas/qtgui/Plotting/SetGraphRange.py @ 83eb5208

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 83eb5208 was 83eb5208, checked in by Piotr Rozyczko <rozyczko@…>, 7 years ago

Putting files in more ordered fashion

  • Property mode set to 100644
File size: 1.3 KB
Line 
1"""
2Allows users to change the range of the current graph
3"""
4from PyQt4 import QtGui
5
6# Local UI
7from sas.qtgui.Plotting.UI.SetGraphRangeUI import Ui_setGraphRangeUI
8
9class 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.