diff --git a/src/sas/qtgui/Calculators/SldPanel.py b/src/sas/qtgui/Calculators/SldPanel.py
index 54fc5c0917..5ddf6ad931 100644
--- a/src/sas/qtgui/Calculators/SldPanel.py
+++ b/src/sas/qtgui/Calculators/SldPanel.py
@@ -116,11 +116,8 @@ def setupUi(self):
self.ui.setupUi(self)
# set validators
- # TODO: GuiUtils.FormulaValidator() crashes with Qt5 - fix
- #self.ui.editMolecularFormula.setValidator(GuiUtils.FormulaValidator(self.ui.editMolecularFormula))
-
- # No need for recalculate
- self.ui.recalculateButton.setVisible(False)
+ # Chemical formula is checked via periodictable.formula module.
+ self.ui.editMolecularFormula.setValidator(GuiUtils.FormulaValidator(self.ui.editMolecularFormula))
rx = QtCore.QRegularExpression("[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?")
self.ui.editMassDensity.setValidator(QtGui.QRegularExpressionValidator(rx, self.ui.editMassDensity))
@@ -130,7 +127,7 @@ def setupUi(self):
# signals
self.ui.helpButton.clicked.connect(self.displayHelp)
self.ui.closeButton.clicked.connect(self.closePanel)
- self.ui.recalculateButton.clicked.connect(self.calculateSLD)
+ self.ui.calculateButton.clicked.connect(self.calculateSLD)
def calculateSLD(self):
self.recalculateSLD()
@@ -147,11 +144,6 @@ def setupModel(self):
#self.model.dataChanged.connect(self.dataChanged)
- self.ui.editMassDensity.textChanged.connect(self.recalculateSLD)
- self.ui.editMolecularFormula.textChanged.connect(self.recalculateSLD)
- self.ui.editNeutronWavelength.textChanged.connect(self.recalculateSLD)
- self.ui.editXrayWavelength.textChanged.connect(self.recalculateSLD)
-
self.modelReset()
def setupMapper(self):
diff --git a/src/sas/qtgui/Calculators/UI/SldPanel.ui b/src/sas/qtgui/Calculators/UI/SldPanel.ui
index 82838a9617..df0197accc 100644
--- a/src/sas/qtgui/Calculators/UI/SldPanel.ui
+++ b/src/sas/qtgui/Calculators/UI/SldPanel.ui
@@ -322,7 +322,7 @@
-
-
+
true
@@ -336,7 +336,10 @@
Qt::NoFocus
- Recalculate
+ Calculate
+
+
+ true
@@ -364,6 +367,9 @@
Close
+
+ false
+
-
@@ -377,6 +383,9 @@
Help
+
+ false
+
@@ -398,7 +407,7 @@
editNeutronLength
closeButton
helpButton
- recalculateButton
+ calculateButton
diff --git a/src/sas/qtgui/Utilities/GuiUtils.py b/src/sas/qtgui/Utilities/GuiUtils.py
index b04db50d16..6898c11a0a 100644
--- a/src/sas/qtgui/Utilities/GuiUtils.py
+++ b/src/sas/qtgui/Utilities/GuiUtils.py
@@ -741,16 +741,15 @@ def __init__(self, parent=None):
def validate(self, input, pos):
self._setStyleSheet("")
- return QtGui.QValidator.Acceptable, pos
- #try:
- # Formula(str(input))
- # self._setStyleSheet("")
- # return QtGui.QValidator.Acceptable, pos
+ try:
+ Formula(str(input))
+ self._setStyleSheet("")
+ return QtGui.QValidator.Acceptable
- #except Exception as e:
- # self._setStyleSheet("background-color:pink;")
- # return QtGui.QValidator.Intermediate, pos
+ except Exception as e:
+ self._setStyleSheet("background-color:pink;")
+ return QtGui.QValidator.Intermediate
def _setStyleSheet(self, value):
try: