Skip to content

Commit

Permalink
Refs #9051. Functionality for retrieving selected policy
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Mar 6, 2014
1 parent 0eb5aef commit 4b41215
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
Expand Up @@ -237,15 +237,18 @@ private slots:

private:

// Types of entities we are dealing with
/// Types of entities we are dealing with
enum ItemType { Pair, Group };

// Possible plot types users might request
/// Possible plot types users might request
enum PlotType { Asymmetry, Counts, Logorithm };

// Types of periods
/// Types of periods
enum PeriodType { First, Second };

/// Types of new plot policies
enum NewPlotPolicy { NewWindow, PreviousWindow };

/// Initialize local Python environment
void initLocalPython();

Expand Down Expand Up @@ -505,6 +508,9 @@ private slots:
/// When data loaded set various buttons etc to active
void nowDataAvailable();

/// Return currently selected new plot policy
NewPlotPolicy newPlotPolicy();

/// handles option tab work
MantidQt::CustomInterfaces::Muon::MuonAnalysisOptionTab* m_optionTab;
/// handles fit data work
Expand Down
23 changes: 22 additions & 1 deletion Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysis.cpp
Expand Up @@ -399,8 +399,9 @@ void MuonAnalysis::plotItem(ItemType itemType, int tableRow, PlotType plotType)

setCurrentDataName( wsNameQ );
}
catch(...)
catch(std::exception& e)
{
g_log.error(e.what());
QMessageBox::critical( this, "MuonAnalysis - Error", "Unable to plot the item. Check log for details." );
}

Expand Down Expand Up @@ -3546,6 +3547,26 @@ void MuonAnalysis::nowDataAvailable()
m_uiForm.guessAlphaButton->setEnabled(true);
}

/**
* @return Currently selected new plot policy
*/
MuonAnalysis::NewPlotPolicy MuonAnalysis::newPlotPolicy()
{
QMap<QString, NewPlotPolicy> policyMap;
policyMap["Create new window"] = NewWindow;
policyMap["Use previous window"] = PreviousWindow;

QString selectedPolicy = m_uiForm.newPlotPolicy->currentText();
if ( !policyMap.contains(selectedPolicy) )
{
throw std::runtime_error("Unknown new plot policy selection");
}
else
{
return policyMap[selectedPolicy];
}
}


void MuonAnalysis::openDirectoryDialog()
{
Expand Down

0 comments on commit 4b41215

Please sign in to comment.