source: sasview/src/sas/qtgui/Plotting/BoxSum.py @ fbfc488

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

More Qt5 related fixes.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1"""
2Allows users to modify the box slicer parameters.
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.BoxSumUI import Ui_BoxSumUI
11
12class BoxSum(QtWidgets.QDialog, Ui_BoxSumUI):
13    def __init__(self, parent=None, model=None):
14        super(BoxSum, self).__init__()
15
16        self.setupUi(self)
17        assert isinstance(model, QtGui.QStandardItemModel)
18
19        self.txtBoxHeight.setValidator(QtGui.QDoubleValidator())
20        self.txtBoxWidth.setValidator(QtGui.QDoubleValidator())
21        self.txtCenterX.setValidator(QtGui.QDoubleValidator())
22        self.txtCenterY.setValidator(QtGui.QDoubleValidator())
23
24        self.model = model
25        self.mapper = QtWidgets.QDataWidgetMapper()
26        self.mapper.setModel(self.model)
27
28        # Map model items onto widget controls
29        self.mapper.addMapping(self.txtBoxHeight, 0)
30        self.mapper.addMapping(self.txtBoxWidth, 1)
31        self.mapper.addMapping(self.txtCenterX, 2)
32        self.mapper.addMapping(self.txtCenterY, 3)
33        self.mapper.addMapping(self.lblAvg, 4, b"text")
34        self.mapper.addMapping(self.lblAvgErr, 5, b"text")
35        self.mapper.addMapping(self.lblSum, 6, b"text")
36        self.mapper.addMapping(self.lblSumErr, 7, b"text")
37        self.mapper.addMapping(self.lblNumPoints, 8, b"text")
38
39        # Populate the widgets with data from the first column
40        self.mapper.toFirst()
41
42        self.setFixedSize(self.minimumSizeHint())
43
44        # Handle the Apply button click
45        self.buttonBox.button(QtWidgets.QDialogButtonBox.Close).clicked.connect(self.onClose)
46
47    def onClose(self):
48        """
49        close the window containing this panel
50        """
51        self.close()
52
Note: See TracBrowser for help on using the repository browser.