[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 |
---|
| 8 | from sas.qtgui.UI.BoxSumUI import Ui_BoxSumUI |
---|
| 9 | |
---|
| 10 | class BoxSum(QtGui.QDialog, Ui_BoxSumUI): |
---|
| 11 | apply_signal = QtCore.pyqtSignal(tuple, str) |
---|
| 12 | def __init__(self, parent=None, model=None): |
---|
| 13 | super(BoxSum, self).__init__() |
---|
| 14 | |
---|
| 15 | self.setupUi(self) |
---|
| 16 | assert isinstance(model, QtGui.QStandardItemModel) |
---|
| 17 | |
---|
| 18 | self.txtBoxHeight.setValidator(QtGui.QDoubleValidator()) |
---|
| 19 | self.txtBoxWidth.setValidator(QtGui.QDoubleValidator()) |
---|
| 20 | self.txtCenterX.setValidator(QtGui.QDoubleValidator()) |
---|
| 21 | self.txtCenterY.setValidator(QtGui.QDoubleValidator()) |
---|
| 22 | |
---|
| 23 | self.model = model |
---|
| 24 | self.mapper = QtGui.QDataWidgetMapper() |
---|
| 25 | self.mapper.setModel(self.model) |
---|
| 26 | |
---|
| 27 | # Map model items onto widget controls |
---|
| 28 | self.mapper.addMapping(self.txtBoxHeight, 0) |
---|
| 29 | self.mapper.addMapping(self.txtBoxWidth, 1) |
---|
| 30 | self.mapper.addMapping(self.txtCenterX, 2) |
---|
| 31 | self.mapper.addMapping(self.txtCenterY, 3) |
---|
| 32 | self.mapper.addMapping(self.lblAvg, 4, "text") |
---|
| 33 | self.mapper.addMapping(self.lblAvgErr, 5, "text") |
---|
| 34 | self.mapper.addMapping(self.lblSum, 6, "text") |
---|
| 35 | self.mapper.addMapping(self.lblSumErr, 7, "text") |
---|
| 36 | self.mapper.addMapping(self.lblNumPoints, 8, "text") |
---|
| 37 | |
---|
| 38 | # Populate the widgets with data from the first column |
---|
| 39 | self.mapper.toFirst() |
---|
| 40 | |
---|
| 41 | self.setFixedSize(self.minimumSizeHint()) |
---|
| 42 | |
---|