Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick for 6.9.1 patch release #37055

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,16 @@ def _alternative_theta_name(self):
return "Theta"

def _s1vg_name(self):
return "s1vgap" if self._instrument == "OFFSPEC" else "S1VG"
return "S1VG"

def _alternative_s1vg_name(self):
return "S1VG" if self._instrument == "OFFSPEC" else "s1vg"
return "s1vg"

def _s2vg_name(self):
return "s2vgap" if self._instrument == "OFFSPEC" else "S2VG"
return "S2VG"

def _alternative_s2vg_name(self):
return "S2VG" if self._instrument == "OFFSPEC" else "s2vg"
return "s2vg"

def _get_double_or_none(self, propertyName):
value = self.getProperty(propertyName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,51 +407,25 @@ void InelasticDataManipulationElwinTabView::notifyCheckboxValueChanged(QtPropert
}

void InelasticDataManipulationElwinTabView::notifyMinChanged(double val) {
auto integrationRangeSelector = m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange");
auto backgroundRangeSelector = m_uiForm.ppPlot->getRangeSelector("ElwinBackgroundRange");

MantidWidgets::RangeSelector *from = qobject_cast<MantidWidgets::RangeSelector *>(sender());

disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(notifyDoubleValueChanged(QtProperty *, double)));
if (from == integrationRangeSelector) {
m_dblManager->setValue(m_properties["IntegrationStart"], val);
} else if (from == backgroundRangeSelector) {
m_dblManager->setValue(m_properties["BackgroundStart"], val);
}

connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(notifyDoubleValueChanged(QtProperty *, double)));
auto prop = (from == m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange")) ? m_properties["IntegrationStart"]
: m_properties["BackgroundStart"];
m_dblManager->setValue(prop, val);
}

void InelasticDataManipulationElwinTabView::notifyMaxChanged(double val) {
auto integrationRangeSelector = m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange");
auto backgroundRangeSelector = m_uiForm.ppPlot->getRangeSelector("ElwinBackgroundRange");

MantidWidgets::RangeSelector *from = qobject_cast<MantidWidgets::RangeSelector *>(sender());

disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(notifyDoubleValueChanged(QtProperty *, double)));

if (from == integrationRangeSelector) {
m_dblManager->setValue(m_properties["IntegrationEnd"], val);
} else if (from == backgroundRangeSelector) {
m_dblManager->setValue(m_properties["BackgroundEnd"], val);
}

connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(notifyDoubleValueChanged(QtProperty *, double)));
auto prop = (from == m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange")) ? m_properties["IntegrationEnd"]
: m_properties["BackgroundEnd"];
m_dblManager->setValue(prop, val);
}

void InelasticDataManipulationElwinTabView::notifyDoubleValueChanged(QtProperty *prop, double val) {
auto integrationRangeSelector = m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange");
auto backgroundRangeSelector = m_uiForm.ppPlot->getRangeSelector("ElwinBackgroundRange");

m_presenter->handleValueChanged(prop->propertyName().toStdString(), val);

disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(notifyDoubleValueChanged(QtProperty *, double)));

disconnectSignals();
if (prop == m_properties["IntegrationStart"])
setRangeSelectorMin(m_properties["IntegrationStart"], m_properties["IntegrationEnd"], integrationRangeSelector,
val);
Expand All @@ -462,9 +436,33 @@ void InelasticDataManipulationElwinTabView::notifyDoubleValueChanged(QtProperty
setRangeSelectorMin(m_properties["BackgroundStart"], m_properties["BackgroundEnd"], backgroundRangeSelector, val);
else if (prop == m_properties["BackgroundEnd"])
setRangeSelectorMax(m_properties["BackgroundStart"], m_properties["BackgroundEnd"], backgroundRangeSelector, val);
connectSignals();
}

void InelasticDataManipulationElwinTabView::disconnectSignals() {
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(notifyDoubleValueChanged(QtProperty *, double)));
disconnect(m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange"), SIGNAL(maxValueChanged(double)), this,
SLOT(notifyMaxChanged(double)));
disconnect(m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange"), SIGNAL(minValueChanged(double)), this,
SLOT(notifyMinChanged(double)));
disconnect(m_uiForm.ppPlot->getRangeSelector("ElwinBackgroundRange"), SIGNAL(maxValueChanged(double)), this,
SLOT(notifyMaxChanged(double)));
disconnect(m_uiForm.ppPlot->getRangeSelector("ElwinBackgroundRange"), SIGNAL(minValueChanged(double)), this,
SLOT(notifyMinChanged(double)));
}

void InelasticDataManipulationElwinTabView::connectSignals() {
connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(notifyDoubleValueChanged(QtProperty *, double)));
connect(m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange"), SIGNAL(maxValueChanged(double)), this,
SLOT(notifyMaxChanged(double)));
connect(m_uiForm.ppPlot->getRangeSelector("ElwinIntegrationRange"), SIGNAL(minValueChanged(double)), this,
SLOT(notifyMinChanged(double)));
connect(m_uiForm.ppPlot->getRangeSelector("ElwinBackgroundRange"), SIGNAL(maxValueChanged(double)), this,
SLOT(notifyMaxChanged(double)));
connect(m_uiForm.ppPlot->getRangeSelector("ElwinBackgroundRange"), SIGNAL(minValueChanged(double)), this,
SLOT(notifyMinChanged(double)));
}

void InelasticDataManipulationElwinTabView::setIntegrationStart(double value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ private slots:
void setHorizontalHeaders();
void setDefaultSampleLog(const Mantid::API::MatrixWorkspace_const_sptr &ws);

void disconnectSignals();
void connectSignals();

/// Function to set the range selector on the mini plot
void setRangeSelector(MantidWidgets::RangeSelector *rs, QtProperty *lower, QtProperty *upper,
const QPair<double, double> &range,
Expand Down
Loading