Commit 38555320 authored by Federico Montesino Pouzols's avatar Federico Montesino Pouzols
Browse files

Merge pull request #15676 from mantidproject/peaksworkspace_dock

Only use drag-n-drop to load PeaksWorkspaces in the VSI.
parents e4025c2f 3edf7ca5
......@@ -638,10 +638,6 @@ void MantidDockWidget::addPeaksWorkspaceMenuItems(
QMenu *menu, const Mantid::API::IPeaksWorkspace_const_sptr &WS) const {
Q_UNUSED(WS);
menu->addAction(m_showData);
menu->addAction(m_showVatesGui); // Show the Vates simple interface
if (!MantidQt::API::InterfaceManager::hasVatesLibraries()) {
m_showVatesGui->setEnabled(false);
}
menu->addSeparator();
menu->addAction(m_showDetectors);
menu->addAction(m_showHist);
......
......@@ -1408,6 +1408,22 @@ void MdViewerWidget::dropEvent(QDropEvent *e) {
}
}
/* Verify that at least one source other than a "Peaks Source" has been loaded
* in the VSI.
* @return true if something other than a Peaks Source is found.
*/
bool otherWorkspacePresent() {
pqServer *server = pqActiveObjects::instance().activeServer();
pqServerManagerModel *smModel =
pqApplicationCore::instance()->getServerManagerModel();
auto sources = smModel->findItems<pqPipelineSource *>(server);
auto result = std::find_if(
sources.begin(), sources.end(), [](const pqPipelineSource *src) {
return strcmp(src->getProxy()->GetXMLName(), "Peaks Source") != 0;
});
return result != sources.end();
}
/**
* Handle the drag and drop events of peaks workspaces.
* @param e The event.
......@@ -1422,7 +1438,10 @@ void MdViewerWidget::handleDragAndDropPeaksWorkspaces(QEvent *e, QString text,
int startIndex = text.indexOf("[\"", endIndex) + 2;
endIndex = text.indexOf("\"]", startIndex);
QString candidate = text.mid(startIndex, endIndex - startIndex);
if (dynamic_cast<SplatterPlotView *>(this->currentView)) {
// Only append the candidate if SplattorPlotView is selected and an
// MDWorkspace is loaded.
if (dynamic_cast<SplatterPlotView *>(this->currentView) &&
otherWorkspacePresent()) {
if (boost::dynamic_pointer_cast<IPeaksWorkspace>(
AnalysisDataService::Instance().retrieve(
candidate.toStdString()))) {
......
......@@ -137,6 +137,9 @@ VSI Improvements
.. figure:: ../../images/VSIEllipses.png
:align: center
- Removed the error-prone right-click option to view peaks workspaces in the VSI. One should load a MDWorkspace,
then drag the corresponding peaks workspace into the VSI window.
|
Full list of
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment