Skip to content

Commit

Permalink
Refs #4591. Disable rebin button for MDHistoWorkspaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Jan 20, 2012
1 parent aec3e82 commit 7a42e35
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ protected slots:

private:
Q_DISABLE_COPY(StandardView)
/// Determine if dataset is a MDHistoWorkspace
bool isMDHistoWorkspace(pqPipelineSource *src);

QPointer<pqPipelineSource> rebinCut; ///< Holder for the RebinnerCutter
Ui::StandardView ui; ///< The standard view's UI form
Expand Down
21 changes: 21 additions & 0 deletions Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/StandardView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ void StandardView::render()
}
pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();

if (this->isMDHistoWorkspace(this->origSrc))
{
this->ui.rebinButton->setEnabled(false);
}

// Show the data
pqDataRepresentation *drep = builder->createDataRepresentation(\
this->origSrc->getOutputPort(0), this->view);
Expand Down Expand Up @@ -115,6 +120,22 @@ void StandardView::resetCamera()
this->view->resetCamera();
}

/**
* This function checks if a pqPipelineSource is a MDHistoWorkspace.
* @return true if the source is a MDHistoWorkspace
*/
bool StandardView::isMDHistoWorkspace(pqPipelineSource *src)
{
QString wsType(vtkSMPropertyHelper(src->getProxy(),
"WorkspaceTypeName", true).GetAsString());
// This must be a Mantid rebinner filter if the property is empty.
if (wsType.isEmpty())
{
wsType = src->getSMName();
}
return wsType.contains("MDHistoWorkspace");
}

}
}
}

0 comments on commit 7a42e35

Please sign in to comment.