diff --git a/qt/scientific_interfaces/Indirect/ConvFit.cpp b/qt/scientific_interfaces/Indirect/ConvFit.cpp index 99a60d931ed4ad3b1924379e939e10686e3b36a4..13a50a127060fd484248722c89fbb5f52dae7b4e 100644 --- a/qt/scientific_interfaces/Indirect/ConvFit.cpp +++ b/qt/scientific_interfaces/Indirect/ConvFit.cpp @@ -139,7 +139,9 @@ void ConvFit::saveClicked() { IndirectFitAnalysisTab::saveResult(); } * Handles plotting the workspace when plot is clicked */ void ConvFit::plotClicked() { + setPlotResultIsPlotting(true); IndirectFitAnalysisTab::plotResult(m_uiForm->cbPlotType->currentText()); + setPlotResultIsPlotting(false); } void ConvFit::updatePlotOptions() { @@ -170,19 +172,32 @@ std::string ConvFit::fitTypeString() const { return fitType; } +void ConvFit::setRunEnabled(bool enabled) { + m_uiForm->pbRun->setEnabled(enabled); +} + void ConvFit::setPlotResultEnabled(bool enabled) { m_uiForm->pbPlot->setEnabled(enabled); m_uiForm->cbPlotType->setEnabled(enabled); } +void ConvFit::setFitSingleSpectrumEnabled(bool enabled) { + m_uiForm->pvFitPlotView->enableFitSingleSpectrum(enabled); +} + void ConvFit::setSaveResultEnabled(bool enabled) { m_uiForm->pbSave->setEnabled(enabled); } -void ConvFit::setRunEnabled(bool enabled) { - m_uiForm->pvFitPlotView->enableFitSingleSpectrum(enabled); - m_uiForm->pbRun->setEnabled(enabled); - m_uiForm->pbRun->setText(!enabled ? "Running..." : "Run"); +void ConvFit::setRunIsRunning(bool running) { + m_uiForm->pbRun->setText(running ? "Running..." : "Run"); + setRunEnabled(!running); + setFitSingleSpectrumEnabled(!running); +} + +void ConvFit::setPlotResultIsPlotting(bool plotting) { + m_uiForm->pbPlot->setText(plotting ? "Plotting..." : "Plot Result"); + setPlotResultEnabled(!plotting); } void ConvFit::runClicked() { runTab(); } diff --git a/qt/scientific_interfaces/Indirect/ConvFit.h b/qt/scientific_interfaces/Indirect/ConvFit.h index ac58d9da5433f865f3c21f89ace1211c361a5880..fec248df1a69b688c75863a3de0de5e21b1797f9 100644 --- a/qt/scientific_interfaces/Indirect/ConvFit.h +++ b/qt/scientific_interfaces/Indirect/ConvFit.h @@ -18,26 +18,31 @@ class DLLExport ConvFit : public IndirectFitAnalysisTab { public: ConvFit(QWidget *parent = nullptr); +protected slots: + void setModelResolution(const QString &resolutionName); + void runClicked(); + void saveClicked(); + void plotClicked(); + void updatePlotOptions() override; + void fitFunctionChanged(); + protected: bool shouldEnablePlotResult() override { return true; }; - void setRunEnabled(bool enabled) override; void setPlotResultEnabled(bool enabled) override; void setSaveResultEnabled(bool enabled) override; + void setRunIsRunning(bool running) override; + private: void setupFitTab() override; void setupFit(Mantid::API::IAlgorithm_sptr fitAlgorithm) override; -protected slots: - void setModelResolution(const QString &resolutionName); - void runClicked(); - void saveClicked(); - void plotClicked(); - void updatePlotOptions() override; - void fitFunctionChanged(); + void setRunEnabled(bool enabled); + void setFitSingleSpectrumEnabled(bool enabled); + + void setPlotResultIsPlotting(bool plotting); -private: std::string fitTypeString() const; std::unique_ptr<Ui::ConvFit> m_uiForm; diff --git a/qt/scientific_interfaces/Indirect/ConvFit.ui b/qt/scientific_interfaces/Indirect/ConvFit.ui index 80aa491a2c0c77abd61e5477f5d073a4c061e25c..1b352ff7cbc79787cf93eec292a70dbaf9b60fba 100644 --- a/qt/scientific_interfaces/Indirect/ConvFit.ui +++ b/qt/scientific_interfaces/Indirect/ConvFit.ui @@ -165,10 +165,16 @@ </property> <property name="minimumSize"> <size> - <width>120</width> + <width>100</width> <height>0</height> </size> </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> <item> <property name="text"> <string>All</string> @@ -192,7 +198,7 @@ <bool>false</bool> </property> <property name="text"> - <string>Plot</string> + <string>Plot Result</string> </property> </widget> </item> diff --git a/qt/scientific_interfaces/Indirect/Elwin.cpp b/qt/scientific_interfaces/Indirect/Elwin.cpp index bdd80033d61df534c7446f6c757ded76df903b28..f0cf8374b4129ba8970b49d32666465e0905f693 100644 --- a/qt/scientific_interfaces/Indirect/Elwin.cpp +++ b/qt/scientific_interfaces/Indirect/Elwin.cpp @@ -117,7 +117,7 @@ void Elwin::setup() { } void Elwin::run() { - setRunEnabled(false); + setRunIsRunning(true); QStringList inputFilenames = m_uiForm.dsInputFiles->getFilenames(); inputFilenames.sort(); @@ -240,20 +240,19 @@ void Elwin::run() { void Elwin::unGroupInput(bool error) { disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(unGroupInput(bool))); - if (error) - return; - if (!m_uiForm.ckGroupInput->isChecked()) { - IAlgorithm_sptr ungroupAlg = - AlgorithmManager::Instance().create("UnGroupWorkspace"); - ungroupAlg->initialize(); - ungroupAlg->setProperty("InputWorkspace", "IDA_Elwin_Input"); - ungroupAlg->execute(); + setRunIsRunning(false); + + if (!error) { + if (!m_uiForm.ckGroupInput->isChecked()) { + IAlgorithm_sptr ungroupAlg = + AlgorithmManager::Instance().create("UnGroupWorkspace"); + ungroupAlg->initialize(); + ungroupAlg->setProperty("InputWorkspace", "IDA_Elwin_Input"); + ungroupAlg->execute(); + } + setPlotResultEnabled(true); + setSaveResultEnabled(true); } - - // Enable run, plot and save - setRunEnabled(true); - m_uiForm.pbPlot->setEnabled(true); - m_uiForm.pbSave->setEnabled(true); } bool Elwin::validate() { @@ -464,6 +463,7 @@ void Elwin::updateRS(QtProperty *prop, double val) { * Handles mantid plotting */ void Elwin::plotClicked() { + setPlotResultIsPlotting(true); auto workspaceBaseName = getWorkspaceBasename(QString::fromStdString(m_pythonExportWsName)); @@ -483,13 +483,14 @@ void Elwin::plotClicked() { if (checkADSForPlotSaveWorkspace((workspaceBaseName + "_elt").toStdString(), true, false)) plotSpectrum(workspaceBaseName + "_elt"); + + setPlotResultIsPlotting(false); } /** * Handles saving of workspaces */ void Elwin::saveClicked() { - auto workspaceBaseName = getWorkspaceBasename(QString::fromStdString(m_pythonExportWsName)); @@ -512,9 +513,24 @@ void Elwin::saveClicked() { m_batchAlgoRunner->executeBatchAsync(); } -void Elwin::setRunEnabled(bool enabled) { - m_uiForm.pbRun->setEnabled(enabled); - m_uiForm.pbRun->setText(!enabled ? "Running..." : "Run"); +void Elwin::setRunEnabled(bool enabled) { m_uiForm.pbRun->setEnabled(enabled); } + +void Elwin::setPlotResultEnabled(bool enabled) { + m_uiForm.pbPlot->setEnabled(enabled); +} + +void Elwin::setSaveResultEnabled(bool enabled) { + m_uiForm.pbSave->setEnabled(enabled); +} + +void Elwin::setRunIsRunning(bool running) { + m_uiForm.pbRun->setText(running ? "Running..." : "Run"); + setRunEnabled(!running); +} + +void Elwin::setPlotResultIsPlotting(bool plotting) { + m_uiForm.pbPlot->setText(plotting ? "Plotting..." : "Plot Result"); + setPlotResultEnabled(!plotting); } void Elwin::runClicked() { runTab(); } diff --git a/qt/scientific_interfaces/Indirect/Elwin.h b/qt/scientific_interfaces/Indirect/Elwin.h index e50c4f0f17fdfb39e890785c146eaadcd14b272f..c9eb91556d2ce4ea61e95283b7f984ea719b455c 100644 --- a/qt/scientific_interfaces/Indirect/Elwin.h +++ b/qt/scientific_interfaces/Indirect/Elwin.h @@ -14,9 +14,6 @@ class DLLExport Elwin : public IndirectDataAnalysisTab { public: Elwin(QWidget *parent = nullptr); -protected: - void setRunEnabled(bool enabled) override; - private: void run() override; void setup() override; @@ -26,6 +23,13 @@ private: const QPair<double, double> &range); void setDefaultSampleLog(Mantid::API::MatrixWorkspace_const_sptr ws); + void setRunEnabled(bool enabled); + void setPlotResultEnabled(bool enabled); + void setSaveResultEnabled(bool enabled); + + void setRunIsRunning(bool running); + void setPlotResultIsPlotting(bool plotting); + private slots: void newInputFiles(); void newPreviewFileSelected(int index); diff --git a/qt/scientific_interfaces/Indirect/IndirectDataAnalysisTab.h b/qt/scientific_interfaces/Indirect/IndirectDataAnalysisTab.h index b68ba4a18933b8c6568b632e7f4f967c8b2791c4..9203a95d60f253a6e010f91ad1cf206367089f5d 100644 --- a/qt/scientific_interfaces/Indirect/IndirectDataAnalysisTab.h +++ b/qt/scientific_interfaces/Indirect/IndirectDataAnalysisTab.h @@ -111,8 +111,6 @@ protected: const QString &startRangePropName = "", const QString &endRangePropName = ""); - virtual void setRunEnabled(bool enabled) = 0; - /// DoubleEditorFactory DoubleEditorFactory *m_dblEdFac; /// QtCheckBoxFactory diff --git a/qt/scientific_interfaces/Indirect/IndirectFitAnalysisTab.cpp b/qt/scientific_interfaces/Indirect/IndirectFitAnalysisTab.cpp index 84640f24f08f1f19dd3a33259634b7bb845aab30..2f2319bc2e9fff729ddcdd03c7383b984873e34d 100644 --- a/qt/scientific_interfaces/Indirect/IndirectFitAnalysisTab.cpp +++ b/qt/scientific_interfaces/Indirect/IndirectFitAnalysisTab.cpp @@ -664,9 +664,9 @@ void IndirectFitAnalysisTab::updateSingleFitOutput(bool error) { * and completed within this interface. */ void IndirectFitAnalysisTab::fitAlgorithmComplete(bool error) { - setSaveResultEnabled(!error); - setRunEnabled(true); + setRunIsRunning(false); enablePlotResult(error); + setSaveResultEnabled(!error); updateParameterValues(); m_spectrumPresenter->enableView(); m_plotPresenter->updatePlots(); @@ -839,7 +839,7 @@ bool IndirectFitAnalysisTab::validate() { * Called when the 'Run' button is called in the IndirectTab. */ void IndirectFitAnalysisTab::run() { - setRunEnabled(false); + setRunIsRunning(true); runFitAlgorithm(m_fittingModel->getFittingAlgorithm()); } diff --git a/qt/scientific_interfaces/Indirect/IndirectFitAnalysisTab.h b/qt/scientific_interfaces/Indirect/IndirectFitAnalysisTab.h index 6b9b675b1f3967f0431d0f16b1d189f8bd7d629d..9c573f51d8800dcb8ba91e765abfaa09141bd917 100644 --- a/qt/scientific_interfaces/Indirect/IndirectFitAnalysisTab.h +++ b/qt/scientific_interfaces/Indirect/IndirectFitAnalysisTab.h @@ -141,9 +141,12 @@ protected: const QSet<QString> &options) const; virtual bool shouldEnablePlotResult() = 0; + virtual void setPlotResultEnabled(bool enabled) = 0; virtual void setSaveResultEnabled(bool enabled) = 0; + virtual void setRunIsRunning(bool running) = 0; + signals: void functionChanged(); void parameterChanged(const Mantid::API::IFunction *); diff --git a/qt/scientific_interfaces/Indirect/Iqt.cpp b/qt/scientific_interfaces/Indirect/Iqt.cpp index aa87e853681901daf730664dc706a4c3c0232484..e63ce3d784d2b39f786221fe836a096d79fe93c3 100644 --- a/qt/scientific_interfaces/Indirect/Iqt.cpp +++ b/qt/scientific_interfaces/Indirect/Iqt.cpp @@ -136,7 +136,7 @@ void Iqt::setup() { void Iqt::run() { using namespace Mantid::API; - setRunEnabled(false); + setRunIsRunning(true); updateDisplayedBinParameters(); @@ -180,12 +180,12 @@ void Iqt::run() { * @param error If the algorithm failed */ void Iqt::algorithmComplete(bool error) { - if (error) - return; - setRunEnabled(true); - m_uiForm.pbPlot->setEnabled(true); - m_uiForm.pbSave->setEnabled(true); - m_uiForm.pbTile->setEnabled(true); + setRunIsRunning(false); + if (!error) { + setPlotResultEnabled(true); + setTiledPlotEnabled(true); + setSaveResultEnabled(true); + } } /** * Handle saving of workspace @@ -201,7 +201,9 @@ void Iqt::saveClicked() { */ void Iqt::plotClicked() { checkADSForPlotSaveWorkspace(m_pythonExportWsName, false); + setPlotResultIsPlotting(true); plotSpectrum(QString::fromStdString(m_pythonExportWsName)); + setPlotResultIsPlotting(false); } void Iqt::errorsClicked() { @@ -211,6 +213,8 @@ void Iqt::errorsClicked() { bool Iqt::isErrorsEnabled() { return m_uiForm.cbCalculateErrors->isChecked(); } void Iqt::plotTiled() { + setTiledPlotIsPlotting(true); + MatrixWorkspace_const_sptr outWs = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>( m_pythonExportWsName); @@ -262,6 +266,8 @@ void Iqt::plotTiled() { } pyInput += "])\n"; runPythonCode(pyInput); + + setTiledPlotIsPlotting(false); } /** @@ -452,9 +458,33 @@ void Iqt::updateRS(QtProperty *prop, double val) { xRangeSelector->setMaximum(val); } -void Iqt::setRunEnabled(bool enabled) { - m_uiForm.pbRun->setEnabled(enabled); - m_uiForm.pbRun->setText(!enabled ? "Running..." : "Run"); +void Iqt::setRunEnabled(bool enabled) { m_uiForm.pbRun->setEnabled(enabled); } + +void Iqt::setPlotResultEnabled(bool enabled) { + m_uiForm.pbPlot->setEnabled(enabled); +} + +void Iqt::setTiledPlotEnabled(bool enabled) { + m_uiForm.pbTile->setEnabled(enabled); +} + +void Iqt::setSaveResultEnabled(bool enabled) { + m_uiForm.pbSave->setEnabled(enabled); +} + +void Iqt::setRunIsRunning(bool running) { + m_uiForm.pbRun->setText(running ? "Running..." : "Run"); + setRunEnabled(!running); +} + +void Iqt::setPlotResultIsPlotting(bool plotting) { + m_uiForm.pbPlot->setText(plotting ? "Plotting..." : "Plot Result"); + setPlotResultEnabled(!plotting); +} + +void Iqt::setTiledPlotIsPlotting(bool plotting) { + m_uiForm.pbTile->setText(plotting ? "Plotting..." : "Tiled Plot"); + setTiledPlotEnabled(!plotting); } void Iqt::runClicked() { runTab(); } diff --git a/qt/scientific_interfaces/Indirect/Iqt.h b/qt/scientific_interfaces/Indirect/Iqt.h index 5b551480a3b7f5ee5aaff129dd0580721b521416..847b65f0e6e4991b1b6716f4f84cd697c6022476 100644 --- a/qt/scientific_interfaces/Indirect/Iqt.h +++ b/qt/scientific_interfaces/Indirect/Iqt.h @@ -13,9 +13,6 @@ class DLLExport Iqt : public IndirectDataAnalysisTab { public: Iqt(QWidget *parent = nullptr); -protected: - void setRunEnabled(bool enabled) override; - private: void run() override; void setup() override; @@ -24,6 +21,15 @@ private: bool isErrorsEnabled(); + void setRunEnabled(bool enabled); + void setPlotResultEnabled(bool enabled); + void setTiledPlotEnabled(bool enabled); + void setSaveResultEnabled(bool enabled); + + void setRunIsRunning(bool running); + void setPlotResultIsPlotting(bool plotting); + void setTiledPlotIsPlotting(bool plotting); + private slots: void algorithmComplete(bool error); void plotInput(const QString &wsname); diff --git a/qt/scientific_interfaces/Indirect/Iqt.ui b/qt/scientific_interfaces/Indirect/Iqt.ui index 522884e0fa57e856757fa00368a83edcf6cc3ed5..994211782a71fba5f972028349c7dbc26a972497 100644 --- a/qt/scientific_interfaces/Indirect/Iqt.ui +++ b/qt/scientific_interfaces/Indirect/Iqt.ui @@ -235,6 +235,32 @@ <property name="bottomMargin"> <number>7</number> </property> + <item> + <widget class="QCheckBox" name="cbCalculateErrors"> + <property name="text"> + <string>Calculate Errors</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </item> <item> <widget class="QLabel" name="label"> <property name="maximumSize"> @@ -280,16 +306,6 @@ </property> </spacer> </item> - <item> - <widget class="QCheckBox" name="cbCalculateErrors"> - <property name="text"> - <string>Calculate Errors</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> </layout> </widget> </item> diff --git a/qt/scientific_interfaces/Indirect/IqtFit.cpp b/qt/scientific_interfaces/Indirect/IqtFit.cpp index 2601a345e14cb078972bce21e860fcd0fb53d84f..f05cf22497a41d52912e989843dceebb5bdc8244 100644 --- a/qt/scientific_interfaces/Indirect/IqtFit.cpp +++ b/qt/scientific_interfaces/Indirect/IqtFit.cpp @@ -117,15 +117,6 @@ void IqtFit::updatePlotOptions() { IndirectFitAnalysisTab::updatePlotOptions(m_uiForm->cbPlotType); } -void IqtFit::setPlotResultEnabled(bool enabled) { - m_uiForm->pbPlot->setEnabled(enabled); - m_uiForm->cbPlotType->setEnabled(enabled); -} - -void IqtFit::setSaveResultEnabled(bool enabled) { - m_uiForm->pbSave->setEnabled(enabled); -} - void IqtFit::setupFit(Mantid::API::IAlgorithm_sptr fitAlgorithm) { fitAlgorithm->setProperty("ExtractMembers", boolSettingValue("ExtractMembers")); @@ -133,13 +124,37 @@ void IqtFit::setupFit(Mantid::API::IAlgorithm_sptr fitAlgorithm) { } void IqtFit::plotResult() { + setPlotResultIsPlotting(true); IndirectFitAnalysisTab::plotResult(m_uiForm->cbPlotType->currentText()); + setPlotResultIsPlotting(false); } void IqtFit::setRunEnabled(bool enabled) { - m_uiForm->pvFitPlotView->enableFitSingleSpectrum(enabled); m_uiForm->pbRun->setEnabled(enabled); - m_uiForm->pbRun->setText(!enabled ? "Running..." : "Run"); +} + +void IqtFit::setPlotResultEnabled(bool enabled) { + m_uiForm->pbPlot->setEnabled(enabled); + m_uiForm->cbPlotType->setEnabled(enabled); +} + +void IqtFit::setFitSingleSpectrumEnabled(bool enabled) { + m_uiForm->pvFitPlotView->enableFitSingleSpectrum(enabled); +} + +void IqtFit::setSaveResultEnabled(bool enabled) { + m_uiForm->pbSave->setEnabled(enabled); +} + +void IqtFit::setRunIsRunning(bool running) { + m_uiForm->pbRun->setText(running ? "Running..." : "Run"); + setRunEnabled(!running); + setFitSingleSpectrumEnabled(!running); +} + +void IqtFit::setPlotResultIsPlotting(bool plotting) { + m_uiForm->pbPlot->setText(plotting ? "Plotting..." : "Plot Result"); + setPlotResultEnabled(!plotting); } void IqtFit::runClicked() { runTab(); } diff --git a/qt/scientific_interfaces/Indirect/IqtFit.h b/qt/scientific_interfaces/Indirect/IqtFit.h index 69c1a9ee03fefa8e4ace5daea56d046e87ddabb3..341fab114a7096e87356ddd6b0f77ee86832dd35 100644 --- a/qt/scientific_interfaces/Indirect/IqtFit.h +++ b/qt/scientific_interfaces/Indirect/IqtFit.h @@ -27,16 +27,6 @@ class DLLExport IqtFit : public IndirectFitAnalysisTab { public: IqtFit(QWidget *parent = nullptr); -private: - void setupFitTab() override; - -protected: - bool shouldEnablePlotResult() override { return true; }; - - void setRunEnabled(bool enabled) override; - void setPlotResultEnabled(bool enabled) override; - void setSaveResultEnabled(bool enabled) override; - protected slots: void setupFit(Mantid::API::IAlgorithm_sptr fitAlgorithm) override; void updatePlotOptions() override; @@ -45,10 +35,25 @@ protected slots: void plotResult(); void runClicked(); +protected: + bool shouldEnablePlotResult() override { return true; }; + + void setPlotResultEnabled(bool enabled) override; + void setSaveResultEnabled(bool enabled) override; + + void setRunIsRunning(bool running) override; + private: void setConstrainIntensitiesEnabled(bool enabled); std::string fitTypeString() const; + void setupFitTab() override; + + void setRunEnabled(bool enabled); + void setFitSingleSpectrumEnabled(bool enabled); + + void setPlotResultIsPlotting(bool plotting); + IqtFitModel *m_iqtFittingModel; std::unique_ptr<Ui::IqtFit> m_uiForm; QString m_tiedParameter; diff --git a/qt/scientific_interfaces/Indirect/IqtFit.ui b/qt/scientific_interfaces/Indirect/IqtFit.ui index 00095efd654e82d3040301af3bfbdc42a2f8478d..02fb7185d5b5c89a3ff178709a047154924178c6 100644 --- a/qt/scientific_interfaces/Indirect/IqtFit.ui +++ b/qt/scientific_interfaces/Indirect/IqtFit.ui @@ -127,7 +127,7 @@ <item> <widget class="QLabel" name="lbPlotType"> <property name="text"> - <string>Plot Output: </string> + <string>Plot Output:</string> </property> </widget> </item> @@ -136,6 +136,18 @@ <property name="enabled"> <bool>false</bool> </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> <item> <property name="text"> <string>Background</string> diff --git a/qt/scientific_interfaces/Indirect/JumpFit.cpp b/qt/scientific_interfaces/Indirect/JumpFit.cpp index 9c9099b1319c4275cc5fa984102f9da611d763ce..4335d9a5317a13a184a84300439433682ea7fa1e 100644 --- a/qt/scientific_interfaces/Indirect/JumpFit.cpp +++ b/qt/scientific_interfaces/Indirect/JumpFit.cpp @@ -78,6 +78,12 @@ void JumpFit::updatePlotOptions() { IndirectFitAnalysisTab::updatePlotOptions(m_uiForm->cbPlotType); } +void JumpFit::plotClicked() { + setPlotResultIsPlotting(true); + IndirectFitAnalysisTab::plotResult(m_uiForm->cbPlotType->currentText()); + setPlotResultIsPlotting(false); +} + bool JumpFit::shouldEnablePlotResult() { for (auto i = 0u; i < m_jumpFittingModel->numberOfWorkspaces(); ++i) if (m_jumpFittingModel->getNumberOfSpectra(i) > 1) @@ -85,23 +91,32 @@ bool JumpFit::shouldEnablePlotResult() { return false; } +void JumpFit::setRunEnabled(bool enabled) { + m_uiForm->pbRun->setEnabled(enabled); +} + void JumpFit::setPlotResultEnabled(bool enabled) { m_uiForm->pbPlot->setEnabled(enabled); m_uiForm->cbPlotType->setEnabled(enabled); } +void JumpFit::setFitSingleSpectrumEnabled(bool enabled) { + m_uiForm->pvFitPlotView->enableFitSingleSpectrum(enabled); +} + void JumpFit::setSaveResultEnabled(bool enabled) { m_uiForm->pbSave->setEnabled(enabled); } -void JumpFit::plotClicked() { - IndirectFitAnalysisTab::plotResult(m_uiForm->cbPlotType->currentText()); +void JumpFit::setRunIsRunning(bool running) { + m_uiForm->pbRun->setText(running ? "Running..." : "Run"); + setRunEnabled(!running); + setFitSingleSpectrumEnabled(!running); } -void JumpFit::setRunEnabled(bool enabled) { - m_uiForm->pvFitPlotView->enableFitSingleSpectrum(enabled); - m_uiForm->pbRun->setEnabled(enabled); - m_uiForm->pbRun->setText(!enabled ? "Running..." : "Run"); +void JumpFit::setPlotResultIsPlotting(bool plotting) { + m_uiForm->pbPlot->setText(plotting ? "Plotting..." : "Plot Result"); + setPlotResultEnabled(!plotting); } void JumpFit::runClicked() { runTab(); } diff --git a/qt/scientific_interfaces/Indirect/JumpFit.h b/qt/scientific_interfaces/Indirect/JumpFit.h index f7dd8f9491499e8498175c6474893732f6b25d0b..ced31820b90600b037181f7d6d67f03df18d82f1 100644 --- a/qt/scientific_interfaces/Indirect/JumpFit.h +++ b/qt/scientific_interfaces/Indirect/JumpFit.h @@ -28,11 +28,17 @@ protected slots: protected: bool shouldEnablePlotResult() override; - void setRunEnabled(bool enabled) override; void setPlotResultEnabled(bool enabled) override; void setSaveResultEnabled(bool enabled) override; + void setRunIsRunning(bool running) override; + private: + void setRunEnabled(bool enabled); + void setFitSingleSpectrumEnabled(bool enabled); + + void setPlotResultIsPlotting(bool plotting); + JumpFitModel *m_jumpFittingModel; std::unique_ptr<Ui::JumpFit> m_uiForm; }; diff --git a/qt/scientific_interfaces/Indirect/JumpFit.ui b/qt/scientific_interfaces/Indirect/JumpFit.ui index d54d47eb25eff31007be9af5c97718e954d49213..6847e52e2bde04c74e2543d362f3c22537fe0419 100644 --- a/qt/scientific_interfaces/Indirect/JumpFit.ui +++ b/qt/scientific_interfaces/Indirect/JumpFit.ui @@ -223,6 +223,18 @@ </item> <item> <widget class="QComboBox" name="cbPlotType"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> <item> <property name="text"> <string>All</string> @@ -233,7 +245,7 @@ <item> <widget class="QPushButton" name="pbPlot"> <property name="text"> - <string>Plot</string> + <string>Plot Result</string> </property> </widget> </item> diff --git a/qt/scientific_interfaces/Indirect/MSDFit.cpp b/qt/scientific_interfaces/Indirect/MSDFit.cpp index fb2f36a0721dc39d75f4de6403018e138e76473c..74cea77e007797f6f8341e18fe5a645a1d0b235c 100644 --- a/qt/scientific_interfaces/Indirect/MSDFit.cpp +++ b/qt/scientific_interfaces/Indirect/MSDFit.cpp @@ -60,7 +60,11 @@ void MSDFit::updateModelFitTypeString() { void MSDFit::updatePlotOptions() {} -void MSDFit::plotClicked() { IndirectFitAnalysisTab::plotResult("All"); } +void MSDFit::plotClicked() { + setPlotResultIsPlotting(true); + IndirectFitAnalysisTab::plotResult("All"); + setPlotResultIsPlotting(false); +} bool MSDFit::shouldEnablePlotResult() { for (auto i = 0u; i < m_msdFittingModel->numberOfWorkspaces(); ++i) @@ -69,18 +73,31 @@ bool MSDFit::shouldEnablePlotResult() { return false; } +void MSDFit::setRunEnabled(bool enabled) { + m_uiForm->pbRun->setEnabled(enabled); +} + void MSDFit::setPlotResultEnabled(bool enabled) { m_uiForm->pbPlot->setEnabled(enabled); } +void MSDFit::setFitSingleSpectrumEnabled(bool enabled) { + m_uiForm->pvFitPlotView->enableFitSingleSpectrum(enabled); +} + void MSDFit::setSaveResultEnabled(bool enabled) { m_uiForm->pbSave->setEnabled(enabled); } -void MSDFit::setRunEnabled(bool enabled) { - m_uiForm->pvFitPlotView->enableFitSingleSpectrum(enabled); - m_uiForm->pbRun->setEnabled(enabled); - m_uiForm->pbRun->setText(!enabled ? "Running..." : "Run"); +void MSDFit::setRunIsRunning(bool running) { + m_uiForm->pbRun->setText(running ? "Running..." : "Run"); + setRunEnabled(!running); + setFitSingleSpectrumEnabled(!running); +} + +void MSDFit::setPlotResultIsPlotting(bool plotting) { + m_uiForm->pbPlot->setText(plotting ? "Plotting..." : "Plot Result"); + setPlotResultEnabled(!plotting); } void MSDFit::runClicked() { runTab(); } diff --git a/qt/scientific_interfaces/Indirect/MSDFit.h b/qt/scientific_interfaces/Indirect/MSDFit.h index 4937eaba377350a3c6c12265002efa5640f18077..491f4b328d31a6ce851b230c6ee661f588e64d87 100644 --- a/qt/scientific_interfaces/Indirect/MSDFit.h +++ b/qt/scientific_interfaces/Indirect/MSDFit.h @@ -16,9 +16,6 @@ class DLLExport MSDFit : public IndirectFitAnalysisTab { public: MSDFit(QWidget *parent = nullptr); -private: - void setupFitTab() override; - protected slots: void plotClicked(); void runClicked(); @@ -28,11 +25,19 @@ protected slots: protected: bool shouldEnablePlotResult() override; - void setRunEnabled(bool enabled) override; void setPlotResultEnabled(bool enabled) override; void setSaveResultEnabled(bool enabled) override; + void setRunIsRunning(bool running) override; + private: + void setupFitTab() override; + + void setRunEnabled(bool enabled); + void setFitSingleSpectrumEnabled(bool enabled); + + void setPlotResultIsPlotting(bool plotting); + MSDFitModel *m_msdFittingModel; std::unique_ptr<Ui::MSDFit> m_uiForm; };