Skip to content

Commit

Permalink
Add option to UI Refs #11750
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed May 13, 2015
1 parent c477cf6 commit 9e993be
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 3 deletions.
Expand Up @@ -47,6 +47,7 @@ public slots:
void loadSettings();
void saveSettings();

bool validateParFile();
bool validateRebin();
bool validateVanCal();

Expand Down
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>495</width>
<width>450</width>
<height>500</height>
</rect>
</property>
Expand Down Expand Up @@ -290,6 +290,36 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="loPARFile">
<item>
<widget class="QCheckBox" name="ckPARFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Load PAR file:</string>
</property>
</widget>
</item>
<item>
<widget class="MantidQt::MantidWidgets::MWRunFiles" name="rfPARFile" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="label" stdset="0">
<string/>
</property>
<property name="fileExtensions" stdset="0">
<stringlist>
<string>.par</string>
<string>.dat</string>
</stringlist>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -443,6 +473,41 @@
<header>MantidQtMantidWidgets/IndirectInstrumentConfig.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>iicInstrumentConfiguration</tabstop>
<tabstop>dem_ckSumFiles</tabstop>
<tabstop>set_leSpecMin</tabstop>
<tabstop>set_leSpecMax</tabstop>
<tabstop>ckIndividualGrouping</tabstop>
<tabstop>ckPARFile</tabstop>
<tabstop>cbPlotType</tabstop>
<tabstop>ckGSS</tabstop>
<tabstop>ckNexus</tabstop>
<tabstop>ckAscii</tabstop>
<tabstop>pbHelp</tabstop>
<tabstop>pbRun</tabstop>
<tabstop>pbManageDirs</tabstop>
<tabstop>leRebinStart</tabstop>
<tabstop>leRebinEnd</tabstop>
<tabstop>leRebinWidth</tabstop>
</tabstops>
<resources/>
<connections/>
<connections>
<connection>
<sender>ckPARFile</sender>
<signal>toggled(bool)</signal>
<receiver>rfPARFile</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>103</x>
<y>328</y>
</hint>
<hint type="destinationlabel">
<x>276</x>
<y>327</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Expand Up @@ -120,7 +120,7 @@ void IndirectDiffractionReduction::demonRun()
}
else
{
if(!m_uiForm.dem_rawFiles->isValid() || !validateRebin())
if(!m_uiForm.dem_rawFiles->isValid() || !validateRebin() || !validateParFile())
{
showInformationBox("Invalid input.\nIncorrect entries marked with red star.");
return;
Expand Down Expand Up @@ -196,6 +196,7 @@ void IndirectDiffractionReduction::runGenericReduction(QString instName, QString
rebin = rebinStart + "," + rebinWidth + "," + rebinEnd;

bool individualGrouping = m_uiForm.ckIndividualGrouping->isChecked();
bool useParFile = m_uiForm.ckPARFile->isChecked();

// Get detector range
std::vector<long> detRange;
Expand Down Expand Up @@ -223,6 +224,9 @@ void IndirectDiffractionReduction::runGenericReduction(QString instName, QString
msgDiffReduction->setProperty("SaveFormats", saveFormats);
msgDiffReduction->setProperty("OutputWorkspace", "IndirectDiffraction_Workspaces");

if(useParFile)
msgDiffReduction->setProperty("InstrumentParFile", m_uiForm.rfPARFile->getFirstFilename().toStdString());

m_batchAlgoRunner->addAlgorithm(msgDiffReduction);

m_batchAlgoRunner->executeBatchAsync();
Expand Down Expand Up @@ -404,6 +408,12 @@ void IndirectDiffractionReduction::instrumentSelected(const QString & instrument
m_uiForm.ckIndividualGrouping->setToolTip("");
m_uiForm.ckIndividualGrouping->setEnabled(true);
}

// Update the VESUVIO PAR file option
bool isVesuvio = instrumentName == "VESUVIO";
if(!isVesuvio)
m_uiForm.ckPARFile->setChecked(false);
m_uiForm.ckPARFile->setEnabled(isVesuvio);
}

/**
Expand Down Expand Up @@ -452,6 +462,19 @@ void IndirectDiffractionReduction::saveSettings()
settings.endGroup();
}

/**
* Validates the instrument PAR file option.
*
* @returns Result of validation
*/
bool IndirectDiffractionReduction::validateParFile()
{
bool useParFile = m_uiForm.ckPARFile->isChecked();
if(useParFile)
return m_uiForm.rfPARFile->isValid();
return true;
}

/**
* Validates the rebinning fields and updates invalid markers.
*
Expand Down

0 comments on commit 9e993be

Please sign in to comment.