Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/9988_allow_indirect_apply…
Browse files Browse the repository at this point in the history
…_corrections_to_use_sqw'
  • Loading branch information
Michael Reuter committed Aug 22, 2014
2 parents d91c041 + a34dded commit 9aa5fff
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace IDA

private slots:
void handleGeometryChange(int index);
void newData(const QString &dataName);

private:
virtual void setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2379,16 +2379,18 @@
</sizepolicy>
</property>
<property name="autoLoad" stdset="0">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="workspaceSuffixes" stdset="0">
<stringlist>
<string>_red</string>
<string>_sqw</string>
</stringlist>
</property>
<property name="fileBrowserSuffixes" stdset="0">
<stringlist>
<string>_red.nxs</string>
<string>_sqw.nxs</string>
</stringlist>
</property>
<property name="showLoad" stdset="0">
Expand Down
28 changes: 25 additions & 3 deletions Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

using namespace Mantid::API;

namespace
{
Mantid::Kernel::Logger g_log("ApplyCorr");
}

namespace MantidQt
{
namespace CustomInterfaces
Expand All @@ -14,7 +19,6 @@ namespace IDA
ApplyCorr::ApplyCorr(QWidget * parent) :
IDATab(parent)
{

}

void ApplyCorr::setup()
Expand All @@ -26,6 +30,7 @@ namespace IDA
connect(uiForm().abscor_ckScaleMultiplier, SIGNAL(toggled(bool)), this, SLOT(scaleMultiplierCheck(bool)));
connect(uiForm().abscor_cbGeometry, SIGNAL(currentIndexChanged(int)), this, SLOT(handleGeometryChange(int)));
connect(uiForm().abscor_ckUseCan, SIGNAL(toggled(bool)), uiForm().abscor_ckPlotContrib, SLOT(setEnabled(bool)));
connect(uiForm().abscor_dsSample, SIGNAL(dataReady(const QString&)), this, SLOT(newData(const QString&)));

// Create a validator for input box of the Scale option.
m_valPosDbl = new QDoubleValidator(this);
Expand All @@ -43,19 +48,36 @@ namespace IDA
*/
void ApplyCorr::scaleMultiplierCheck(bool state)
{
//scale input should be disabled if we're not using a can
// Scale input should be disabled if we're not using a can
if(!uiForm().abscor_ckUseCan->isChecked())
{
uiForm().abscor_leScaleMultiplier->setEnabled(false);
}
else
{
//else it should be whatever the scale checkbox is
// Else it should be whatever the scale checkbox is
state = uiForm().abscor_ckScaleMultiplier->isChecked();
uiForm().abscor_leScaleMultiplier->setEnabled(state);
}
}

/**
* Disables corrections when using S(Q, w) as input data.
*
* @param dataName Name of new data source
*/
void ApplyCorr::newData(const QString &dataName)
{
bool isSqw = dataName.endsWith("_sqw", Qt::CaseInsensitive);

if(isSqw)
{
g_log.information("Input data is in S(Q, w), correction file cannot be used");
uiForm().abscor_ckUseCorrections->setCheckState(Qt::Unchecked);
}

uiForm().abscor_ckUseCorrections->setEnabled(!isSqw);
}

bool ApplyCorr::validateScaleInput()
{
Expand Down

0 comments on commit 9aa5fff

Please sign in to comment.