Skip to content

Commit e3db3b9

Browse files
authored
Merge pull request #38247 from mantidproject/38063_sample_trans_calc
38063 sample transmission calculators DoubleSpinBoxes avoid commas
2 parents fa7a4cf + 1dab00c commit e3db3b9

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Framework/DataHandling/src/RotateSampleShape.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ void RotateSampleShape::exec() {
7676
g_log.warning() << "Empty goniometer created; will always return an "
7777
"identity rotation matrix.\n";
7878

79-
const auto sampleShapeRotation = gon.getR();
79+
const auto &sampleShapeRotation = gon.getR();
8080
if (sampleShapeRotation == Kernel::Matrix<double>(3, 3, true)) {
8181
// If the resulting rotationMatrix is Identity, ignore the calculatrion
8282
g_log.warning("Rotation matrix set via RotateSampleShape is an Identity matrix. Ignored rotating sample shape");
8383
return;
8484
}
8585

86-
const auto oldRotation = ei->run().getGoniometer().getR();
86+
const auto &oldRotation = ei->run().getGoniometer().getR();
8787
auto newSampleShapeRot = sampleShapeRotation * oldRotation;
8888
if (isMeshShape) {
8989
auto meshShape = std::dynamic_pointer_cast<MeshObject>(ei->sample().getShapePtr());
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed a bug in :ref:`sample_transmission_calculator` (Interfaces > General > Sample Transmission Calculator) interface to restrict entering commas mixed with decimal point in the double spin boxes for Low, Width and High fields

qt/python/mantidqtinterfaces/mantidqtinterfaces/SampleTransmissionCalculator/stc_view.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ def __init__(self, parent=None):
3636
"Or 0,100,10000,200,20000: from 0 rebin in steps of 100 to 10,000 then steps of 200 to 20,000."
3737
)
3838

39+
self.single_high_spin_box.textChanged.connect(self._double_spinbox_textChanged)
40+
self.single_low_spin_box.textChanged.connect(self._double_spinbox_textChanged)
41+
self.single_width_spin_box.textChanged.connect(self._double_spinbox_textChanged)
42+
43+
def _double_spinbox_textChanged(self, text):
44+
if "," in text:
45+
text = text.replace(",", ".")
46+
oldState = self.sender().blockSignals(True)
47+
self.isEditing = True
48+
self.sender().setValue(float(text))
49+
self.sender().lineEdit().setText(f"{self.sender().value():.1f}")
50+
self.sender().blockSignals(oldState)
51+
3952
def get_input_dict(self):
4053
input_dict = {
4154
"binning_type": self.binning_type_combo_box.currentIndex(),

0 commit comments

Comments
 (0)