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 7fd20fc was
7fd20fc,
checked in by Piotr Rozyczko <rozyczko@…>, 6 years ago
|
Initial commit for constrained & simultaneous fitting functionality SASVIEW-277
|
-
Property mode set to
100755
|
File size:
1.4 KB
|
Rev | Line | |
---|
[7fd20fc] | 1 | """ |
---|
| 2 | Widget for parameter constraints. |
---|
| 3 | """ |
---|
| 4 | from PyQt5 import QtCore |
---|
| 5 | from PyQt5 import QtGui |
---|
| 6 | from PyQt5 import QtWidgets |
---|
| 7 | |
---|
| 8 | import sas.qtgui.Utilities.GuiUtils as GuiUtils |
---|
| 9 | |
---|
| 10 | # Local UI |
---|
| 11 | from sas.qtgui.Perspectives.Fitting.UI.MultiConstraintUI import Ui_MultiConstraintUI |
---|
| 12 | |
---|
| 13 | class MultiConstraint(QtWidgets.QDialog, Ui_MultiConstraintUI): |
---|
| 14 | def __init__(self, parent=None, params=None): |
---|
| 15 | super(MultiConstraint, self).__init__() |
---|
| 16 | |
---|
| 17 | self.setupUi(self) |
---|
| 18 | self.setFixedSize(self.minimumSizeHint()) |
---|
| 19 | self.setModal(True) |
---|
| 20 | self.params = params |
---|
| 21 | |
---|
| 22 | self.setupLabels() |
---|
| 23 | self.setupTooltip() |
---|
| 24 | |
---|
| 25 | self.cmdOK.clicked.connect(self.accept) |
---|
| 26 | self.cmdRevert.clicked.connect(self.revert) |
---|
| 27 | |
---|
| 28 | def revert(self): |
---|
| 29 | """ |
---|
| 30 | switch M1 <-> M2 |
---|
| 31 | """ |
---|
| 32 | self.params[1], self.params[0] = self.params[0], self.params[1] |
---|
| 33 | self.setupLabels() |
---|
| 34 | self.setupTooltip() |
---|
| 35 | |
---|
| 36 | def setupLabels(self): |
---|
| 37 | """ |
---|
| 38 | Setup labels based on current parameters |
---|
| 39 | """ |
---|
| 40 | l1 = self.params[0] |
---|
| 41 | l2 = self.params[1] |
---|
| 42 | self.txtParam1.setText(l1) |
---|
| 43 | self.txtParam1_2.setText(l1) |
---|
| 44 | self.txtParam2.setText(l2) |
---|
| 45 | |
---|
| 46 | def setupTooltip(self): |
---|
| 47 | """ |
---|
| 48 | Tooltip for txtConstraint |
---|
| 49 | """ |
---|
| 50 | tooltip = "E.g.\n%s = 2.0 * (%s)\n" %(self.params[0], self.params[1]) |
---|
| 51 | tooltip += "%s = sqrt(%s) + 5"%(self.params[0], self.params[1]) |
---|
| 52 | self.txtConstraint.setToolTip(tooltip) |
---|
| 53 | |
---|
| 54 | pass |
---|
| 55 | |
---|
Note: See
TracBrowser
for help on using the repository browser.