Commit 8b174de4 authored by Anton Piccardo-Selg's avatar Anton Piccardo-Selg
Browse files

Refs #10677 Add more button logic

parent 9de58fb2
......@@ -316,6 +316,7 @@ private slots:
/// Handle a change of the aperture geometry for QResolution
void handleQResolutionApertureChange(int aperture);
private:
/// used to specify the range of validation to do
enum ValCheck {
......@@ -497,6 +498,10 @@ private:
bool hasUserFileValidFileExtension();
/// Check if the user file is valid
bool isValidUserFile();
/// Disable controls when user file is being loaded
void userFileLoadingBegin();
/// Enable controls when user file has finished loading
void userFileLoadingEnd();
UserSubWindow *slicingWindow;
};
......
......@@ -211,13 +211,9 @@ void SANSRunWindow::initLayout() {
connectButtonSignals();
m_uiForm.tabWidget->setCurrentWidget(m_uiForm.runNumbers);
// Disable most things so that load is the only thing that can be done
m_uiForm.oneDBtn->setEnabled(false);
m_uiForm.twoDBtn->setEnabled(false);
m_uiForm.saveDefault_btn->setEnabled(false);
for (int i = 1; i < 4; ++i) {
m_uiForm.tabWidget->setTabEnabled(i, false);
}
userFileLoadingBegin();
// Mode switches
connect(m_uiForm.single_mode_btn, SIGNAL(clicked()), this,
......@@ -783,6 +779,11 @@ bool SANSRunWindow::loadUserFile() {
m_uiForm.mask_table->removeRow(i);
}
// Disable some settings on the GUI such that the user cannot press
// a Reduce button while the user file is loading
userFileLoadingBegin();
QString pyCode = "i.Clean()";
pyCode += "\ni." + getInstrumentClass();
pyCode += "\ni.ReductionSingleton().user_settings =";
......@@ -812,6 +813,7 @@ bool SANSRunWindow::loadUserFile() {
return false;
}
const auto settings = getReductionSettings();
const double unit_conv(1000.);
......@@ -1059,9 +1061,9 @@ bool SANSRunWindow::loadUserFile() {
m_cfg_loaded = true;
emit userfileLoaded();
m_uiForm.tabWidget->setTabEnabled(1, true);
m_uiForm.tabWidget->setTabEnabled(2, true);
m_uiForm.tabWidget->setTabEnabled(3, true);
// Enable buttons and tabs
userFileLoadingEnd();
return true;
}
......@@ -4920,6 +4922,32 @@ bool SANSRunWindow::isValidUserFile() {
return true;
}
/**
* Disable controls when the user file beings to load
*/
void SANSRunWindow::userFileLoadingBegin() {
// Disable the reduction and save buttons on the first tab
m_uiForm.oneDBtn->setEnabled(false);
m_uiForm.twoDBtn->setEnabled(false);
m_uiForm.saveDefault_btn->setEnabled(false);
for (int i = 1; i < 4; ++i) {
m_uiForm.tabWidget->setTabEnabled(i, false);
}
}
/**
* Enable controls when the user file has loaded
*/
void SANSRunWindow::userFileLoadingEnd() {
// Enable the reduction and save buttons on the first tab
m_uiForm.oneDBtn->setEnabled(true);
m_uiForm.twoDBtn->setEnabled(true);
m_uiForm.saveDefault_btn->setEnabled(true);
for (int i = 1; i < 4; ++i) {
m_uiForm.tabWidget->setTabEnabled(i, true);
}
}
} // namespace CustomInterfaces
} // namespace MantidQt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment