Skip to content

Commit

Permalink
Added new IndirectTab class
Browse files Browse the repository at this point in the history
Refs #10277
  • Loading branch information
DanNixon committed Oct 7, 2014
1 parent 011e474 commit 905f6a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 334 deletions.
3 changes: 3 additions & 0 deletions Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt
Expand Up @@ -28,6 +28,7 @@ set ( SRC_FILES
src/IndirectSimulation.cpp
src/IndirectSimulationTab.cpp
src/IndirectSqw.cpp
src/IndirectTab.cpp
src/IndirectTransmission.cpp
src/JumpFit.cpp
src/MSDFit.cpp
Expand Down Expand Up @@ -108,6 +109,7 @@ set ( INC_FILES
inc/MantidQtCustomInterfaces/IndirectSimulationTab.h
inc/MantidQtCustomInterfaces/IndirectSqw.h
inc/MantidQtCustomInterfaces/IndirectTransmission.h
inc/MantidQtCustomInterfaces/IndirectTab.h
inc/MantidQtCustomInterfaces/IReflPresenter.h
inc/MantidQtCustomInterfaces/JumpFit.h
inc/MantidQtCustomInterfaces/MSDFit.h
Expand Down Expand Up @@ -191,6 +193,7 @@ set ( MOC_FILES inc/MantidQtCustomInterfaces/Background.h
inc/MantidQtCustomInterfaces/IndirectSimulationTab.h
inc/MantidQtCustomInterfaces/IndirectSqw.h
inc/MantidQtCustomInterfaces/IndirectTransmission.h
inc/MantidQtCustomInterfaces/IndirectTab.h
inc/MantidQtCustomInterfaces/JumpFit.h
inc/MantidQtCustomInterfaces/MSDFit.h
inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingPresenter.h
Expand Down
Expand Up @@ -9,6 +9,7 @@
#include "MantidQtAPI/PythonRunner.h"
#include "MantidQtAPI/QwtWorkspaceSpectrumData.h"
#include "MantidQtCustomInterfaces/IndirectDataReduction.h"
#include "MantidQtCustomInterfaces/IndirectTab.h"
#include "MantidQtMantidWidgets/RangeSelector.h"

#include <QDoubleValidator>
Expand Down Expand Up @@ -66,107 +67,21 @@ namespace CustomInterfaces
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport IndirectDataReductionTab : public QObject
class DLLExport IndirectDataReductionTab : public IndirectTab
{
Q_OBJECT

public:
IndirectDataReductionTab(Ui::IndirectDataReduction& uiForm, QObject * parent = 0);
virtual ~IndirectDataReductionTab();

public slots:
void runTab();
void setupTab();
void validateTab();

protected slots:
/// Slot to handle when an algorithm finishes running
virtual void algorithmFinished(bool error);

protected:
/// Run the load algorithm with the given file name, output name and spectrum range
bool loadFile(const QString& filename, const QString& outputName, const int specMin = -1, const int specMax = -1);

Mantid::API::MatrixWorkspace_sptr loadInstrumentIfNotExist(std::string instrumentName, std::string analyser="", std::string reflection="");
/// Get information about the operation modes of an indirect instrument
std::vector<std::pair<std::string, std::vector<std::string> > > getInstrumentModes(std::string instrumentName);
/// Function to get details about the instrument configuration defined on C2E tab
std::map<QString, QString> getInstrumentDetails();

/// Function to plot a workspace to the miniplot using a workspace name
void plotMiniPlot(const QString& workspace, size_t index, const QString& plotID, const QString& curveID = "");
/// Function to plot a workspace to the miniplot using a workspace pointer
void plotMiniPlot(const Mantid::API::MatrixWorkspace_const_sptr & workspace, size_t wsIndex, const QString& plotID, const QString& curveID = "");
/// Function to replot a miniplot
void replot(const QString& plotID);

/// Function to get the range of the curve displayed on the mini plot
std::pair<double, double> getCurveRange(const QString& plotID);
/// Function to set the range of an axis on a plot
void setAxisRange(const QString& plotID, QwtPlot::Axis axis, std::pair<double, double> range);
/// Function to autoscale a given axis based on the data in a curve
void setXAxisToCurve(const QString& plotID, const QString& curveID);

/// Function to set the range limits of the plot
void setPlotRange(const QString& rsID, QtProperty* min, QtProperty* max, const std::pair<double, double>& bounds);
/// Function to set the range selector on the mini plot
void setMiniPlotGuides(const QString& rsID, QtProperty* lower, QtProperty* upper, const std::pair<double, double>& bounds);

/// Function to run an algorithm on a seperate thread
void runAlgorithm(const Mantid::API::IAlgorithm_sptr algorithm);

/// Parent QWidget (if applicable)
QWidget *m_parentWidget;

/// Plot of the input
std::map<QString, QwtPlot *> m_plots;
/// Curve on the plot
std::map<QString, QwtPlotCurve *> m_curves;
/// Range selector widget for mini plot
std::map<QString, MantidQt::MantidWidgets::RangeSelector *> m_rangeSelectors;
/// Tree of the properties
std::map<QString, QtTreePropertyBrowser *> m_propTrees;

/// Internal list of the properties
QMap<QString, QtProperty*> m_properties;

/// Double manager to create properties
QtDoublePropertyManager* m_dblManager;
/// Boolean manager to create properties
QtBoolPropertyManager* m_blnManager;
/// Group manager to create properties
QtGroupPropertyManager* m_grpManager;

/// Double editor facotry for the properties browser
DoubleEditorFactory* m_dblEdFac;

/// Algorithm runner object to execute chains algorithms on a seperate thread from the GUI
MantidQt::API::BatchAlgorithmRunner *m_batchAlgoRunner;

/// Use a Python runner for when we need the output of a script
MantidQt::API::PythonRunner m_pythonRunner;

/// Validator for int inputs
QIntValidator *m_valInt;
/// Validator for double inputs
QDoubleValidator *m_valDbl;
/// Validator for positive double inputs
QDoubleValidator *m_valPosDbl;

signals:
/// Send signal to parent window to show a message box to user
void showMessageBox(const QString& message);
/// Run a python script
void runAsPythonScript(const QString & code, bool no_output);

private:
/// Overidden by child class.
virtual void setup() = 0;
/// Overidden by child class.
virtual void run() = 0;
/// Overidden by child class.
virtual bool validate() = 0;

protected:
Ui::IndirectDataReduction m_uiForm;

Expand Down

0 comments on commit 905f6a2

Please sign in to comment.