Index: src/sas/qtgui/Perspectives/Fitting/ComplexConstraint.py
===================================================================
--- src/sas/qtgui/Perspectives/Fitting/ComplexConstraint.py (revision aed053275d5f293f1f6495be4c78e4b18fc52b41)
+++ src/sas/qtgui/Perspectives/Fitting/ComplexConstraint.py (revision 305114c33963ce5b43f94d3b16fc71e316f72e3a)
@@ -13,4 +13,5 @@
import webbrowser
+from sas.qtgui.Perspectives.Fitting import FittingUtilities
import sas.qtgui.Utilities.GuiUtils as GuiUtils
ALLOWED_OPERATORS = ['=','<','>','>=','<=']
@@ -32,10 +33,9 @@
self.operator = '='
+ self.warning = self.lblWarning.text()
self.setupData()
+ self.setupSignals()
self.setupWidgets()
- self.setupSignals()
self.setupTooltip()
-
- self.setFixedSize(self.minimumSizeHint())
# Default focus is on OK
@@ -101,8 +101,21 @@
# Find out the signal source
source = self.sender().objectName()
+ param1 = self.cbParam1.currentText()
+ param2 = self.cbParam2.currentText()
if source == "cbParam1":
- self.txtParam.setText(self.tab_names[0] + ":" + self.cbParam1.currentText())
+ self.txtParam.setText(self.tab_names[0] + ":" + param1)
else:
- self.txtConstraint.setText(self.tab_names[1] + "." + self.cbParam2.currentText())
+ self.txtConstraint.setText(self.tab_names[1] + "." + param2)
+ # Check if any of the parameters are polydisperse
+ params_list = [param1, param2]
+ all_pars = [tab.model_parameters for tab in self.tabs]
+ is2Ds = [tab.is2D for tab in self.tabs]
+ txt = ""
+ for pars, is2D in zip(all_pars, is2Ds):
+ if any([FittingUtilities.isParamPolydisperse(p, pars, is2D) for p in params_list]):
+ # no parameters are pd - reset the text to not show the warning
+ txt = self.warning
+ self.lblWarning.setText(txt)
+
def onOperatorChange(self, index):
Index: src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
===================================================================
--- src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py (revision 1a15adaa1bbde7cbb9a5f5ff55d61f53d3b88ca7)
+++ src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py (revision 305114c33963ce5b43f94d3b16fc71e316f72e3a)
@@ -781,2 +781,17 @@
return output_string
+
+def isParamPolydisperse(param_name, kernel_params, is2D=False):
+ """
+ Simple lookup for polydispersity for the given param name
+ """
+ parameters = kernel_params.form_volume_parameters
+ if is2D:
+ parameters += kernel_params.orientation_parameters
+ has_poly = False
+ for param in parameters:
+ if param.name==param_name and param.polydisperse:
+ has_poly = True
+ break
+ return has_poly
+
Index: src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
===================================================================
--- src/sas/qtgui/Perspectives/Fitting/FittingWidget.py (revision 86d320752de5002a8cde6933f80b5cf10ae34dc9)
+++ src/sas/qtgui/Perspectives/Fitting/FittingWidget.py (revision 305114c33963ce5b43f94d3b16fc71e316f72e3a)
@@ -649,4 +649,8 @@
# Create and display the widget for param1 and param2
mc_widget = MultiConstraint(self, params=params_list)
+ # Check if any of the parameters are polydisperse
+ if not np.any([FittingUtilities.isParamPolydisperse(p, self.model_parameters, is2D=self.is2D) for p in params_list]):
+ # no parameters are pd - reset the text to not show the warning
+ mc_widget.lblWarning.setText("")
if mc_widget.exec_() != QtWidgets.QDialog.Accepted:
return
Index: src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py
===================================================================
--- src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py (revision aed053275d5f293f1f6495be4c78e4b18fc52b41)
+++ src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py (revision 305114c33963ce5b43f94d3b16fc71e316f72e3a)
@@ -28,5 +28,4 @@
self.setupUi(self)
- self.setFixedSize(self.minimumSizeHint())
self.setModal(True)
self.params = params
Index: src/sas/qtgui/Perspectives/Fitting/UI/ComplexConstraintUI.ui
===================================================================
--- src/sas/qtgui/Perspectives/Fitting/UI/ComplexConstraintUI.ui (revision a90c9c517cd3dc80bd31d2952fa50c9b89997fbb)
+++ src/sas/qtgui/Perspectives/Fitting/UI/ComplexConstraintUI.ui (revision 305114c33963ce5b43f94d3b16fc71e316f72e3a)
@@ -7,6 +7,6 @@
0
0
- 406
- 167
+ 463
+ 234
@@ -21,4 +21,35 @@
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ param1
+
+
+
+ -
+
+
+ =
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -98,52 +129,28 @@
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 25
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- param1
-
-
-
- -
-
-
- =
-
-
-
- -
-
-
-
-
-
-
-
-
-
+
+
+ <html><head/><body><p><span style=" color:#ff0000;">Warning! Polydisperse parameter selected.<br/></span>Constraints involving polydisperse parameters only apply to<br/>starting values and are nor re-applied during size or angle polydispersity<br/>integrations. To do which requires creating a custom model.</p></body></html>
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 9
+
+
+
+
+ -
-
Index: src/sas/qtgui/Perspectives/Fitting/UI/MultiConstraintUI.ui
===================================================================
--- src/sas/qtgui/Perspectives/Fitting/UI/MultiConstraintUI.ui (revision a90c9c517cd3dc80bd31d2952fa50c9b89997fbb)
+++ src/sas/qtgui/Perspectives/Fitting/UI/MultiConstraintUI.ui (revision 305114c33963ce5b43f94d3b16fc71e316f72e3a)
@@ -11,9 +11,9 @@
0
426
- 162
+ 185
-
+
0
0
@@ -119,4 +119,11 @@
-
+
+
+ <html><head/><body><p><span style=" color:#ff0000;">Warning! </span>Constraints involving polydisperse parameters only apply to<br/>starting values and are nor re-applied during size or angle polydispersity<br/>integrations. To do which requires creating a custom model.</p></body></html>
+
+
+
+ -
@@ -131,5 +138,5 @@
- -
+
-
-