source: sasview/src/sas/qtgui/Plotting/SetGraphRange.py @ 1431dab

ESS_GUIESS_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 1431dab was d6b8a1d, checked in by Piotr Rozyczko <rozyczko@…>, 7 years ago

More Qt5 related fixes

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