Skip to content

Commit

Permalink
Refs #5421 Further refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Jackson committed Sep 17, 2013
1 parent 6354253 commit 8d00c24
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ namespace MantidQt
virtual void maxValueChanged(double max) = 0;
/// Slot to handle when a user edits a property
virtual void updateProperties(QtProperty* prop, double val) = 0;
/// Function to set the range selector on the mini plot
void setMiniPlotGuides(QtProperty* lower, QtProperty* upper, const std::pair<double, double>& bounds);

protected:
/// Function to plot a workspace to the miniplot using a workspace name
void plotMiniPlot(const QString& workspace, size_t index);
/// Function to plot a workspace to the miniplot using a workspace pointer
void plotMiniPlot(const Mantid::API::MatrixWorkspace_const_sptr & workspace, size_t wsIndex);
/// Function to set the range selector on the mini plot
void setMiniPlotGuides(QtProperty* lower, QtProperty* upper, const std::pair<double, double>& bounds);
/// Function to run a string as python code
void runPythonScript(const QString& pyInput);
/// Function to read an instrument's resolution from the IPF using a string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ namespace MantidQt
connect(m_rangeSelector, SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double)));
connect(m_rangeSelector, SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double)));
connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateProperties(QtProperty*, double)));

// initilise plot
m_plot->setCanvasBackground(Qt::white);
m_plot->setAxisFont(QwtPlot::xBottom, parent->font());
m_plot->setAxisFont(QwtPlot::yLeft, parent->font());
}

//----------------------------------------------------------------------------------------------
Expand Down
14 changes: 5 additions & 9 deletions Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace MantidQt
{
m_uiForm.setupUi(parent);

//add the plot to the ui form
m_uiForm.plotSpace->addWidget(m_plot);
//add the properties browser to the ui form
m_uiForm.treeSpace->addWidget(m_propTree);

Expand All @@ -20,12 +22,6 @@ namespace MantidQt

m_propTree->addProperty(m_properties["QMin"]);
m_propTree->addProperty(m_properties["QMax"]);

//add the plot to the ui form
m_uiForm.plotSpace->addWidget(m_plot);
m_plot->setCanvasBackground(Qt::white);
m_plot->setAxisFont(QwtPlot::xBottom, parent->font());
m_plot->setAxisFont(QwtPlot::yLeft, parent->font());
}

bool JumpFit::validate()
Expand All @@ -50,13 +46,13 @@ namespace MantidQt

void JumpFit::updateProperties(QtProperty* prop, double val)
{
if(prop == m_properties["QMin"])
if(prop == m_properties["QMax"])
{
m_rangeSelector->setMinimum(val);
updateLowerGuide(m_properties["QMin"], m_properties["QMax"], val)
}
else if (prop == m_properties["QMax"])
{
m_rangeSelector->setMaximum(val);
updateUpperGuide(m_properties["QMin"], m_properties["QMax"], val);
}
}
} // namespace CustomInterfaces
Expand Down
13 changes: 5 additions & 8 deletions Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace MantidQt
{
m_uiForm.setupUi(parent);

//add the plot to the ui form
m_uiForm.plotSpace->addWidget(m_plot);

//add the properties browser to the ui form
m_uiForm.treeSpace->addWidget(m_propTree);

Expand All @@ -30,12 +33,6 @@ namespace MantidQt
//Set default values
m_dblManager->setValue(m_properties["SampleBinning"], 1);
m_dblManager->setValue(m_properties["ResBinning"], 1);

//add the plot to the ui form
m_uiForm.plotSpace->addWidget(m_plot);
m_plot->setCanvasBackground(Qt::white);
m_plot->setAxisFont(QwtPlot::xBottom, parent->font());
m_plot->setAxisFont(QwtPlot::yLeft, parent->font());
}

bool Quasi::validate()
Expand All @@ -62,11 +59,11 @@ namespace MantidQt
{
if(prop == m_properties["EMin"])
{
m_rangeSelector->setMinimum(val);
updateLowerGuide(m_properties["EMin"], m_properties["EMax"], val)
}
else if (prop == m_properties["EMax"])
{
m_rangeSelector->setMaximum(val);
updateUpperGuide(m_properties["EMin"], m_properties["EMax"], val);
}
}
} // namespace CustomInterfaces
Expand Down
11 changes: 4 additions & 7 deletions Code/Mantid/MantidQt/CustomInterfaces/src/ResNorm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace MantidQt
{
m_uiForm.setupUi(parent);

connect(m_uiForm.dsVanadium, SIGNAL(dataReady(const QString&)), this, SLOT(handleVanadiumInputReady(const QString&)));

//add the plot to the ui form
m_uiForm.plotSpace->addWidget(m_plot);
//add the properties browser to the ui form
m_uiForm.treeSpace->addWidget(m_propTree);
m_properties["EMin"] = m_dblManager->addProperty("EMin");
Expand All @@ -29,11 +29,8 @@ namespace MantidQt
m_dblManager->setValue(m_properties["VanBinning"], 1);
m_dblManager->setMinimum(m_properties["VanBinning"], 1);

//add the plot to the ui form
m_uiForm.plotSpace->addWidget(m_plot);
m_plot->setCanvasBackground(Qt::white);
m_plot->setAxisFont(QwtPlot::xBottom, parent->font());
m_plot->setAxisFont(QwtPlot::yLeft, parent->font());
// Connect data selector to handler method
connect(m_uiForm.dsVanadium, SIGNAL(dataReady(const QString&)), this, SLOT(handleVanadiumInputReady(const QString&)));
}

/**
Expand Down
12 changes: 4 additions & 8 deletions Code/Mantid/MantidQt/CustomInterfaces/src/Stretch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace MantidQt
{
m_uiForm.setupUi(parent);

//add the plot to the ui form
m_uiForm.plotSpace->addWidget(m_plot);
//add the properties browser to the ui form
m_uiForm.treeSpace->addWidget(m_propTree);

Expand All @@ -34,12 +36,6 @@ namespace MantidQt
m_dblManager->setValue(m_properties["Sigma"], 50);
m_dblManager->setValue(m_properties["Beta"], 50);
m_dblManager->setValue(m_properties["SampleBinning"], 1);

//add the plot to the ui form
m_uiForm.plotSpace->addWidget(m_plot);
m_plot->setCanvasBackground(Qt::white);
m_plot->setAxisFont(QwtPlot::xBottom, parent->font());
m_plot->setAxisFont(QwtPlot::yLeft, parent->font());
}

bool Stretch::validate()
Expand All @@ -66,11 +62,11 @@ namespace MantidQt
{
if(prop == m_properties["EMin"])
{
m_rangeSelector->setMinimum(val);
updateLowerGuide(m_properties["EMin"], m_properties["EMax"], val)
}
else if (prop == m_properties["EMax"])
{
m_rangeSelector->setMaximum(val);
updateUpperGuide(m_properties["EMin"], m_properties["EMax"], val);
}
}

Expand Down

0 comments on commit 8d00c24

Please sign in to comment.