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: ...@@ -316,6 +316,7 @@ private slots:
/// Handle a change of the aperture geometry for QResolution /// Handle a change of the aperture geometry for QResolution
void handleQResolutionApertureChange(int aperture); void handleQResolutionApertureChange(int aperture);
private: private:
/// used to specify the range of validation to do /// used to specify the range of validation to do
enum ValCheck { enum ValCheck {
...@@ -497,6 +498,10 @@ private: ...@@ -497,6 +498,10 @@ private:
bool hasUserFileValidFileExtension(); bool hasUserFileValidFileExtension();
/// Check if the user file is valid /// Check if the user file is valid
bool isValidUserFile(); bool isValidUserFile();
/// Disable controls when user file is being loaded
void userFileLoadingBegin();
/// Enable controls when user file has finished loading
void userFileLoadingEnd();
UserSubWindow *slicingWindow; UserSubWindow *slicingWindow;
}; };
......
...@@ -211,13 +211,9 @@ void SANSRunWindow::initLayout() { ...@@ -211,13 +211,9 @@ void SANSRunWindow::initLayout() {
connectButtonSignals(); connectButtonSignals();
m_uiForm.tabWidget->setCurrentWidget(m_uiForm.runNumbers); m_uiForm.tabWidget->setCurrentWidget(m_uiForm.runNumbers);
// Disable most things so that load is the only thing that can be done // Disable most things so that load is the only thing that can be done
m_uiForm.oneDBtn->setEnabled(false); userFileLoadingBegin();
m_uiForm.twoDBtn->setEnabled(false);
m_uiForm.saveDefault_btn->setEnabled(false);
for (int i = 1; i < 4; ++i) {
m_uiForm.tabWidget->setTabEnabled(i, false);
}
// Mode switches // Mode switches
connect(m_uiForm.single_mode_btn, SIGNAL(clicked()), this, connect(m_uiForm.single_mode_btn, SIGNAL(clicked()), this,
...@@ -783,6 +779,11 @@ bool SANSRunWindow::loadUserFile() { ...@@ -783,6 +779,11 @@ bool SANSRunWindow::loadUserFile() {
m_uiForm.mask_table->removeRow(i); 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()"; QString pyCode = "i.Clean()";
pyCode += "\ni." + getInstrumentClass(); pyCode += "\ni." + getInstrumentClass();
pyCode += "\ni.ReductionSingleton().user_settings ="; pyCode += "\ni.ReductionSingleton().user_settings =";
...@@ -812,6 +813,7 @@ bool SANSRunWindow::loadUserFile() { ...@@ -812,6 +813,7 @@ bool SANSRunWindow::loadUserFile() {
return false; return false;
} }
const auto settings = getReductionSettings(); const auto settings = getReductionSettings();
const double unit_conv(1000.); const double unit_conv(1000.);
...@@ -1059,9 +1061,9 @@ bool SANSRunWindow::loadUserFile() { ...@@ -1059,9 +1061,9 @@ bool SANSRunWindow::loadUserFile() {
m_cfg_loaded = true; m_cfg_loaded = true;
emit userfileLoaded(); emit userfileLoaded();
m_uiForm.tabWidget->setTabEnabled(1, true);
m_uiForm.tabWidget->setTabEnabled(2, true); // Enable buttons and tabs
m_uiForm.tabWidget->setTabEnabled(3, true); userFileLoadingEnd();
return true; return true;
} }
...@@ -4920,6 +4922,32 @@ bool SANSRunWindow::isValidUserFile() { ...@@ -4920,6 +4922,32 @@ bool SANSRunWindow::isValidUserFile() {
return true; 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 CustomInterfaces
} // namespace MantidQt } // 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