Skip to content
Snippets Groups Projects
Commit cfb74619 authored by Robert Whitley's avatar Robert Whitley
Browse files

Refs #3463. No need to manually add workspace to FitPropertyBrowser.

Remove temp "_Raw" workspaces which are now added in MuonAnalysis.
parent 5589871e
No related branches found
No related tags found
No related merge requests found
......@@ -2082,7 +2082,6 @@ void MuonAnalysis::plotGroup(const std::string& plotType)
changePlotType(plotDetails);
m_currentDataName = titleLabel;
m_uiForm.fitBrowser->manualAddWorkspace(m_currentDataName);
}
m_updating = false;
}
......@@ -2224,7 +2223,6 @@ void MuonAnalysis::plotPair(const std::string& plotType)
changePlotType(plotDetails);
m_currentDataName = titleLabel;
m_uiForm.fitBrowser->manualAddWorkspace(m_currentDataName);
}
m_updating = false;
}
......
......@@ -194,9 +194,6 @@ public:
void postDeleteHandle(const std::string& wsName);
void addHandle(const std::string& wsName,const boost::shared_ptr<Mantid::API::Workspace> ws);
/// Add a workspace property
void manualAddWorkspace(const QString& wsName);
/// Update the PeakPickerTool with the current workspace to be displayed and which to associate itself with
void updatePPTool(const QString& name);
......@@ -388,7 +385,7 @@ private:
/// Get the registered function names
virtual void populateFunctionNames();
/// Check if the workspace can be used in the fit
bool isWorkspaceValid(Mantid::API::Workspace_sptr)const;
virtual bool isWorkspaceValid(Mantid::API::Workspace_sptr)const;
/// Called when the fit is finished
void finishHandle(const Mantid::API::IAlgorithm* alg);
/// Find QtBrowserItem for a property prop among the chidren of
......
......@@ -37,11 +37,12 @@ class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS MuonFitPropertyBrowser: public MantidQt:
public:
/// Constructor.
MuonFitPropertyBrowser(QWidget *parent = NULL, QObject* mantidui = NULL);
/// Set the input workspace name
virtual void setWorkspaceName(const QString& wsName);
MuonFitPropertyBrowser(QWidget *parent = NULL, QObject* mantidui = NULL);
/// Initialise the layout.
virtual void init();
/// Set the input workspace name
virtual void setWorkspaceName(const QString& wsName);
public slots:
/// Perform the fit algorithm
......@@ -63,6 +64,8 @@ private:
virtual void setFitEnabled(bool yes);
/// Sets the new workspace to the current one
virtual void workspaceChange(const QString& wsName);
/// Check if the workspace can be used in the fit
virtual bool isWorkspaceValid(Mantid::API::Workspace_sptr)const;
};
......
......@@ -1442,7 +1442,10 @@ void FitPropertyBrowser::populateWorkspaceNames()
QStringList tmp;
std::set<std::string> sv = Mantid::API::AnalysisDataService::Instance().getObjectNames();
for (std::set<std::string>::const_iterator it = sv.begin(); it != sv.end(); ++it)
{
std::cout << "\n\n" << (*it) << "\n";
tmp<<QString::fromStdString(*it);
}
for(int i=0;i<tmp.size();i++)
{
......@@ -2487,33 +2490,6 @@ void FitPropertyBrowser::setTextPlotGuess(const QString text)
m_displayActionPlotGuess->setText(text);
}
/**
* Currently only called by the custom interface for the muon analysis fit browser.
* It adds the name of a loaded workspace to a drop down property box .
*
* @param wsName :: The workspace name to be added.
*/
void FitPropertyBrowser::manualAddWorkspace(const QString& wsName)
{
QString oldName = QString::fromStdString(workspaceName());
int i = m_workspaceNames.indexOf(wsName);
// if new workspace append this workspace name
if (i < 0)
{
m_workspaceNames.append(wsName);
m_workspaceNames.sort();
m_enumManager->setEnumNames(m_workspace, m_workspaceNames);
}
// get hold of index of oldName
i = m_workspaceNames.indexOf(oldName);
if (i >= 0)
{
m_enumManager->setValue(m_workspace,i);
}
//Set the workspace to the most recent one.
workspaceChange(wsName);
}
/**
* Sets a new workspace
......
......@@ -386,5 +386,23 @@ void MuonFitPropertyBrowser::workspaceChange(const QString& wsName)
updatePPTool(wsName);
}
/** Check if the workspace can be used in the fit. The accepted types are
* MatrixWorkspaces same size and that it isn't the generated raw file.
* @param ws :: The workspace
*/
bool MuonFitPropertyBrowser::isWorkspaceValid(Mantid::API::Workspace_sptr ws)const
{
QString workspaceName(QString::fromStdString(ws->name() ) );
if (workspaceName.contains("_Raw") )
return false;
if (dynamic_cast<Mantid::API::MatrixWorkspace*>(ws.get()) != 0)
return true;
else
return false;
}
} // MantidQt
} // API
\ No newline at end of file
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