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

Last change on this file since 7b536da 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.5 KB
RevLine 
[3bdbfcc]1"""
2Allows users to modify the box slicer parameters.
3"""
4from PyQt4 import QtGui
5from PyQt4 import QtCore
6
7# Local UI
[cd2cc745]8from sas.qtgui.UI import main_resources_rc
[83eb5208]9from sas.qtgui.Plotting.UI.BoxSumUI import Ui_BoxSumUI
[3bdbfcc]10
11class BoxSum(QtGui.QDialog, Ui_BoxSumUI):
12    apply_signal = QtCore.pyqtSignal(tuple, str)
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 = QtGui.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, "text")
34        self.mapper.addMapping(self.lblAvgErr, 5, "text")
35        self.mapper.addMapping(self.lblSum, 6, "text")
36        self.mapper.addMapping(self.lblSumErr, 7, "text")
37        self.mapper.addMapping(self.lblNumPoints, 8, "text")
38
39        # Populate the widgets with data from the first column
40        self.mapper.toFirst()
41
42        self.setFixedSize(self.minimumSizeHint())
43
Note: See TracBrowser for help on using the repository browser.