source: sasview/src/sas/qtgui/Plotting/SetGraphRange.py @ 0849aec

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

Initial, in-progress version. Not really working atm. SASVIEW-787

  • Property mode set to 100644
File size: 1.3 KB
Line 
1"""
2Allows users to change the range of the current graph
3"""
4from PyQt5 import QtCore
5from PyQt5 import QtGui
6from PyQt5 import QtWidgets
7
8# Local UI
9from sas.qtgui.UI import main_resources_rc
10from sas.qtgui.Plotting.UI.SetGraphRangeUI import Ui_setGraphRangeUI
11
12class SetGraphRange(QtWidgets.QDialog, Ui_setGraphRangeUI):
13    def __init__(self, parent=None, x_range=(0.0, 0.0), y_range=(0.0, 0.0)):
14        super(SetGraphRange, self).__init__()
15
16        self.setupUi(self)
17        assert(isinstance(x_range, tuple))
18        assert(isinstance(y_range, tuple))
19
20        self.txtXmin.setValidator(QtGui.QDoubleValidator())
21        self.txtXmax.setValidator(QtGui.QDoubleValidator())
22        self.txtYmin.setValidator(QtGui.QDoubleValidator())
23        self.txtYmax.setValidator(QtGui.QDoubleValidator())
24
25        self.txtXmin.setText(str(x_range[0]))
26        self.txtXmax.setText(str(x_range[1]))
27        self.txtYmin.setText(str(y_range[0]))
28        self.txtYmax.setText(str(y_range[1]))
29
30    def xrange(self):
31        """
32        Return a tuple with line edit content of (xmin, xmax)
33        """
34        return (float(self.txtXmin.text()),
35                float(self.txtXmax.text()))
36
37    def yrange(self):
38        """
39        Return a tuple with line edit content of (ymin, ymax)
40        """
41        return (float(self.txtYmin.text()),
42                float(self.txtYmax.text()))
Note: See TracBrowser for help on using the repository browser.