diff --git a/qt/scientific_interfaces/ISISReflectometry/IReflMainWindowPresenter.h b/qt/scientific_interfaces/ISISReflectometry/IReflMainWindowPresenter.h index 2ced88b289ab503cef1becb809cc972b008f9d9d..8512a94fb5000450ca79d1eee61913babe556905 100644 --- a/qt/scientific_interfaces/ISISReflectometry/IReflMainWindowPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/IReflMainWindowPresenter.h @@ -2,6 +2,7 @@ #define MANTID_ISISREFLECTOMETRY_IREFLMAINWINDOWPRESENTER_H #include "MantidQtWidgets/Common/DataProcessorUI/OptionsQMap.h" +#include "MantidQtWidgets/Common/DataProcessorUI/TreeData.h" #include <string> @@ -43,6 +44,9 @@ public: enum class Flag { ConfirmReductionPausedFlag, ConfirmReductionResumedFlag }; virtual void notify(Flag flag) = 0; + virtual void completedReductionSuccessfully( + MantidWidgets::DataProcessor::GroupData const &group) = 0; + /// Pre-processing virtual std::string getTransmissionRuns(int group) const = 0; virtual MantidWidgets::DataProcessor::OptionsQMap diff --git a/qt/scientific_interfaces/ISISReflectometry/IReflSaveTabPresenter.h b/qt/scientific_interfaces/ISISReflectometry/IReflSaveTabPresenter.h index 81c387769151f0bf3d58a4e57539e07714e5c9ae..c382482eddf814b76396a43ba93ebc0c3e078a99 100644 --- a/qt/scientific_interfaces/ISISReflectometry/IReflSaveTabPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/IReflSaveTabPresenter.h @@ -1,5 +1,6 @@ #ifndef MANTID_ISISREFLECTOMETRY_IREFLSAVETABPRESENTER_H #define MANTID_ISISREFLECTOMETRY_IREFLSAVETABPRESENTER_H +#include "MantidQtWidgets/Common/DataProcessorUI/TreeData.h" namespace MantidQt { namespace CustomInterfaces { @@ -46,6 +47,9 @@ public: suggestSaveDirFlag }; + virtual void completedReductionSuccessfully( + MantidWidgets::DataProcessor::GroupData const &group) = 0; + /// Tell the presenter something happened virtual void notify(IReflSaveTabPresenter::Flag flag) = 0; }; diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.cpp index 4987864f3b1ba5db4c80040522a39d1a3a3b6690..e12efa68bfd49becb3a229bd6f1a78a7f2994b5e 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.cpp @@ -266,6 +266,11 @@ bool ReflDataProcessorPresenter::processGroupAsEventWS( return errors; } +void ReflDataProcessorPresenter::completedReductionSuccessfully( + MantidWidgets::DataProcessor::GroupData const &groupData) { + m_mainPresenter->completedReductionSuccessfully(groupData); +} + /** Processes a group of non-event workspaces * * @param groupID :: An integer number indicating the id of this group diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.h index 739a6ad34f2aab12d6dc6457d95bb2cae7c71421..13e1fd0ec54c9e562889a43330a32df7439126c0 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflDataProcessorPresenter.h @@ -59,6 +59,7 @@ public: // Add entry for the number of slices for all rows in a group void addNumGroupSlicesEntry(int groupID, size_t numSlices); + void completedReductionSuccessfully(GroupData const& groupData) override; private: // Process selected rows void process() override; diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp index 95742d9cc1535dda55ed35b6e862356d20572054..dbdeb975c52efbaa72372ce079d40d076f132eb2 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp @@ -41,6 +41,10 @@ ReflMainWindowPresenter::ReflMainWindowPresenter( */ ReflMainWindowPresenter::~ReflMainWindowPresenter() {} +void ReflMainWindowPresenter::completedReductionSuccessfully(GroupData const &group) { + m_savePresenter->completedReductionSuccessfully(group); +} + /** Used by the view to tell the presenter something has changed */ diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h index b6c75d20c6c7013fbd5db05b7042171fef06a2b1..9026220f9725591d1beb68e0125a32a22e42818b 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h @@ -85,6 +85,8 @@ public: void settingsChanged(int group) override; + void completedReductionSuccessfully(MantidWidgets::DataProcessor::GroupData const &group) override; + private: /// Check for Settings Tab null pointer void checkSettingsPtrValid(IReflSettingsTabPresenter *pointer) const; diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflRunsTabPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflRunsTabPresenter.cpp index d5f620949205c4426760b548a0088fbb04861bf0..20f9bd5ad4c391401553b4db103cc76857238280 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflRunsTabPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflRunsTabPresenter.cpp @@ -159,6 +159,11 @@ void ReflRunsTabPresenter::notify(IReflRunsTabPresenter::Flag flag) { // a flag we aren't handling. } +void ReflRunsTabPresenter::completedReductionSuccessfully( + GroupData const &group) { + m_mainPresenter->completedReductionSuccessfully(group); +} + /** Pushes the list of commands (actions) */ void ReflRunsTabPresenter::pushCommands() { diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflRunsTabPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflRunsTabPresenter.h index 15c095cebcb5210994cb8d1ce7e18215a4827ddd..30434cb8711ea5c4d5c51a48a9ff39ebe2cd9ed0 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflRunsTabPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflRunsTabPresenter.h @@ -5,6 +5,7 @@ #include "DllConfig.h" #include "IReflRunsTabPresenter.h" #include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorMainPresenter.h" +#include "MantidQtWidgets/Common/DataProcessorUI/TreeData.h" #include <boost/shared_ptr.hpp> namespace MantidQt { @@ -86,6 +87,7 @@ public: void confirmReductionPaused() const override; void confirmReductionResumed() const override; void settingsChanged(int group) override; + void completedReductionSuccessfully(MantidWidgets::DataProcessor::GroupData const& group) override; private: /// The search model diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.cpp index 316fa0dd725496b88c6156ebb94becf12b1546ef..c4cb505ad0dd8d047348f27f989074f536c2a436 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.cpp @@ -61,6 +61,11 @@ void ReflSaveTabPresenter::notify(IReflSaveTabPresenter::Flag flag) { } } +void ReflSaveTabPresenter::completedReductionSuccessfully( + MantidWidgets::DataProcessor::GroupData const &group) { + std::cout << "Reduced group with size " << group.size() << std::endl; +} + /** Fills the 'List of Workspaces' widget with the names of all available * workspaces */ @@ -212,4 +217,4 @@ std::vector<std::string> ReflSaveTabPresenter::getAvailableWorkspaceNames() { return validNames; } } -} \ No newline at end of file +} diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.h index 640f616a13ad4baa3a50c731e44ee58f21e2fd3a..c46c9e0df97905873e9ea75057b1f84e05a45837 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.h @@ -49,6 +49,7 @@ public: /// Accept a main presenter void acceptMainPresenter(IReflMainWindowPresenter *mainPresenter) override; void notify(IReflSaveTabPresenter::Flag flag) override; + void completedReductionSuccessfully(MantidWidgets::DataProcessor::GroupData const& group) override; private: /// Adds all workspace names to the list of workspaces diff --git a/qt/widgets/common/CMakeLists.txt b/qt/widgets/common/CMakeLists.txt index d69a7d1c144fecc0434a54494ed4b4ae456c16d6..a785b59e1ebef5a91890dae1e91749c8ebed39a5 100644 --- a/qt/widgets/common/CMakeLists.txt +++ b/qt/widgets/common/CMakeLists.txt @@ -54,6 +54,7 @@ set ( SRC_FILES src/CatalogSelector.cpp src/CheckboxHeader.cpp src/DataProcessorUI/AbstractTreeModel.cpp + src/DataProcessorUI/TreeData.cpp src/DataProcessorUI/GenerateNotebook.cpp src/DataProcessorUI/OneLevelTreeManager.cpp src/DataProcessorUI/OptionsMap.cpp diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorMainPresenter.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorMainPresenter.h index 2042a0e79e1fa44ef7aa9f455de10072dff532a2..46fb7c774c43dc96dac8477ae0eda3345954a6a6 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorMainPresenter.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/DataProcessorMainPresenter.h @@ -3,6 +3,7 @@ #include "MantidKernel/System.h" #include "MantidQtWidgets/Common/DataProcessorUI/OptionsQMap.h" +#include "MantidQtWidgets/Common/DataProcessorUI/TreeData.h" #include <QSet> #include <QString> @@ -74,6 +75,7 @@ public: /// Handle data reduction paused/resumed confirmation virtual void confirmReductionPaused() const {} virtual void confirmReductionResumed() const {} + virtual void completedReductionSuccessfully(GroupData const&) {}; }; } } diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h index 966b9b3fb866d0ed50ce07cb4c64bd11ad03b0e0..25dd31fe3c2078531cf681c922919d13b0ab80bb 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h @@ -213,6 +213,7 @@ protected: // Plotting virtual void plotRow(); virtual void plotGroup(); + virtual void completedReductionSuccessfully(GroupData const& groupData); void plotWorkspaces(const QOrderedSet<QString> &workspaces); // Get the name of a post-processed workspace QString getPostprocessedWorkspaceName(const GroupData &groupData); @@ -223,6 +224,7 @@ protected slots: void issueNotFoundWarning(QString const &granule, QSet<QString> const &missingWorkspaces); + private: void applyDefaultOptions(std::map<QString, QVariant> &options); void setPropertiesFromKeyValueString(Mantid::API::IAlgorithm_sptr alg, diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeData.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeData.h index e1da443d781194bdb4a4bcf6dc84a7ec572367ef..50cec19cbc9ee62e42c672c80349aea4cf89b510 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeData.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeData.h @@ -38,6 +38,7 @@ namespace DataProcessor { using RowData = QStringList; using GroupData = std::map<int, RowData>; using TreeData = std::map<int, GroupData>; +bool canPostprocess(GroupData const& group); } } } diff --git a/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp b/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp index 34ea7dc13e2f4a4da34aac30b3e696e5850fbbec..44c27d46c4a34ba9aadea7d430fb233c24ef2246 100644 --- a/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp +++ b/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp @@ -417,6 +417,7 @@ void GenericDataProcessorPresenter::nextRow() { // single row if (!isProcessed(groupIndex) && m_groupData.size() > 1) { startAsyncGroupReduceThread(m_groupData, groupIndex); + completedReductionSuccessfully(m_groupData); return; } } @@ -425,6 +426,9 @@ void GenericDataProcessorPresenter::nextRow() { doNextAction(); } +void GenericDataProcessorPresenter::completedReductionSuccessfully( + GroupData const &) {} + /** Process a new group */ @@ -437,9 +441,6 @@ void GenericDataProcessorPresenter::nextGroup() { return; } - // Clear group data from any previously processed groups - m_groupData.clear(); - if (!m_group_queue.empty()) { // Set next action flag m_nextActionFlag = ReductionFlag::ReduceRowFlag; @@ -458,6 +459,8 @@ void GenericDataProcessorPresenter::nextGroup() { saveNotebook(m_selectedData); endReduction(); } + // Clear group data from any previously processed groups + m_groupData.clear(); } /* diff --git a/qt/widgets/common/src/DataProcessorUI/TreeData.cpp b/qt/widgets/common/src/DataProcessorUI/TreeData.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d45054c892cbdc7758a288fa366b21f8b97cfe88 --- /dev/null +++ b/qt/widgets/common/src/DataProcessorUI/TreeData.cpp @@ -0,0 +1,9 @@ +#include "MantidQtWidgets/Common/DataProcessorUI/TreeData.h" + +namespace MantidQt { +namespace MantidWidgets { +namespace DataProcessor { +bool canPostprocess(GroupData const &group) { return group.size() > 1; } +} +} +}