source: sasview/src/sas/qtgui/Plotting/SetGraphRange.py @ 4a9786d8

Last change on this file since 4a9786d8 was cd2cc745, checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago

Workaround for the resource file requirement in each UI directory

  • 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.UI import main_resources_rc
8from sas.qtgui.Plotting.UI.SetGraphRangeUI import Ui_setGraphRangeUI
9
10class SetGraphRange(QtGui.QDialog, Ui_setGraphRangeUI):
11    def __init__(self, parent=None, x_range=(0.0, 0.0), y_range=(0.0, 0.0)):
12        super(SetGraphRange, self).__init__()
13
14        self.setupUi(self)
15        assert(isinstance(x_range, tuple))
16        assert(isinstance(y_range, tuple))
17
18        self.txtXmin.setValidator(QtGui.QDoubleValidator())
19        self.txtXmax.setValidator(QtGui.QDoubleValidator())
20        self.txtYmin.setValidator(QtGui.QDoubleValidator())
21        self.txtYmax.setValidator(QtGui.QDoubleValidator())
22
23        self.txtXmin.setText(str(x_range[0]))
24        self.txtXmax.setText(str(x_range[1]))
25        self.txtYmin.setText(str(y_range[0]))
26        self.txtYmax.setText(str(y_range[1]))
27
28    def xrange(self):
29        """
30        Return a tuple with line edit content of (xmin, xmax)
31        """
32        return (float(self.txtXmin.text()),
33                float(self.txtXmax.text()))
34
35    def yrange(self):
36        """
37        Return a tuple with line edit content of (ymin, ymax)
38        """
39        return (float(self.txtYmin.text()),
40                float(self.txtYmax.text()))
Note: See TracBrowser for help on using the repository browser.