[3bdbfcc] | 1 | """ |
---|
| 2 | Allows users to modify the box slicer parameters. |
---|
| 3 | """ |
---|
| 4 | from PyQt4 import QtGui |
---|
| 5 | from PyQt4 import QtCore |
---|
| 6 | |
---|
| 7 | # Local UI |
---|
[cd2cc745] | 8 | from sas.qtgui.UI import main_resources_rc |
---|
[83eb5208] | 9 | from sas.qtgui.Plotting.UI.BoxSumUI import Ui_BoxSumUI |
---|
[3bdbfcc] | 10 | |
---|
| 11 | class 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 | |
---|