Skip to content
Snippets Groups Projects
Commit bf7709da authored by Nick Draper's avatar Nick Draper
Browse files

limit progress bar updates to 1000Hz maximum

parent 88847b2e
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ Improvements
- The context menu for WorkspaceGroups now contains plotting options so you can plot all of the workspaces in the group.
- Most changes in the settings dialog now take place immediately, no longer needing a restart, such as hiding algorithm categories, interfaces or choosing wether to see invisible workspaces.
- A warning now appears if you attempt to plot more than ten spectra.
- We have limited the maximum rate of algorithm progress updates to the progress bar to 1000/second. This has resulted in a workbench completing certain intensive python scripts 4 times faster.
- The Save menu action in the workspaces toolbox to save using version 1 of the SaveAscii algorithm has been removed as no one was using it and it only added confusion. The option to save using the most recent version of SaveASCII is still available.
Bugfixes
......
......@@ -11,6 +11,7 @@
#include "MantidQtWidgets/Common/AlgorithmProgress/AlgorithmProgressPresenterBase.h"
#include "MantidQtWidgets/Common/AlgorithmProgress/IAlgorithmProgressWidget.h"
#include "MantidQtWidgets/Common/DllOption.h"
#include "MantidKernel/Timer.h"
#include <QWidget>
......@@ -55,6 +56,8 @@ private:
/// The view that contains the progress widget.
/// The creator of the view also owns the view (Python), not this presenter.
IAlgorithmProgressWidget *m_view;
/// Atimer to meaure how long since the last progress report
Mantid::Kernel::Timer m_timer;
};
} // namespace MantidWidgets
} // namespace MantidQt
......
......@@ -13,7 +13,7 @@ AlgorithmProgressPresenter::AlgorithmProgressPresenter(
QWidget *parent, IAlgorithmProgressWidget *view)
: AlgorithmProgressPresenterBase(parent), m_model{AlgorithmProgressModel(
this)},
m_algorithm(nullptr), m_view(view) {}
m_algorithm(nullptr), m_view(view), m_timer() {}
void AlgorithmProgressPresenter::algorithmStartedSlot(
Mantid::API::AlgorithmID alg) {
......@@ -49,7 +49,12 @@ void AlgorithmProgressPresenter::updateProgressBarSlot(
if (algorithm == this->m_algorithm) {
// this needs to be a call to the view
// so that it can be mocked out for testing
m_view->updateProgress(progress, message);
constexpr float maxRefreshInterval{0.1f};
float timeInterval = m_timer.elapsed_no_reset();
if (timeInterval > maxRefreshInterval) {
m_timer.reset();
m_view->updateProgress(progress, message);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment