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

Last change on this file since d32a594 was 33c0561, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 6 years ago

Replace Apply button menu driven functionality with additional button.
Removed Cancel.
Removed the window system context help button from all affected widgets.
SASVIEW-1239

  • Property mode set to 100644
File size: 1.5 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)
[33c0561]19        # disable the context help icon
20        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
21
[d3ca363]22        assert(isinstance(x_range, tuple))
23        assert(isinstance(y_range, tuple))
24
[d6b8a1d]25        self.txtXmin.setValidator(GuiUtils.DoubleValidator())
26        self.txtXmax.setValidator(GuiUtils.DoubleValidator())
27        self.txtYmin.setValidator(GuiUtils.DoubleValidator())
28        self.txtYmax.setValidator(GuiUtils.DoubleValidator())
[d3ca363]29
30        self.txtXmin.setText(str(x_range[0]))
31        self.txtXmax.setText(str(x_range[1]))
32        self.txtYmin.setText(str(y_range[0]))
33        self.txtYmax.setText(str(y_range[1]))
34
35    def xrange(self):
36        """
37        Return a tuple with line edit content of (xmin, xmax)
38        """
39        return (float(self.txtXmin.text()),
40                float(self.txtXmax.text()))
41
42    def yrange(self):
43        """
44        Return a tuple with line edit content of (ymin, ymax)
45        """
46        return (float(self.txtYmin.text()),
47                float(self.txtYmax.text()))
Note: See TracBrowser for help on using the repository browser.