Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ADSObserver for PreviewPlot widget #37078

Conversation

robertapplin
Copy link
Contributor

@robertapplin robertapplin commented Mar 26, 2024

Description of work

This PR ensures the PreviewPlot widget uses the AnalysisDataServiceObserver to keep a track of events happening in the ADS. It is better to use this observer than re-implement the Poco observers. There was a bug, fixed by #37074 , which would not have happened if we had used AnalysisDataServiceObserver.

To test:

  1. Go to 'Inelastic'->Data Manipulations
  2. Load data into the Symmetrise Tab
  3. Click Preview, then click Run
  4. Close the interface
  5. Open the Data Analysis interface
  6. On MSD Fit load data
  7. Select Gaus function
  8. Click Run. There should be no crash

This does not require release notes because it is internal maintenance

Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@robertapplin robertapplin added Indirect/Inelastic Issues and pull requests related to indirect or inelastic Maintenance Unassigned issues to be addressed in the next maintenance period. ISIS Team: Spectroscopy Issue and pull requests managed by the Spectroscopy subteam at ISIS labels Mar 26, 2024
@robertapplin robertapplin added this to the Release 6.10 milestone Mar 26, 2024
@robertapplin robertapplin marked this pull request as ready for review March 26, 2024 09:43
@adriazalvarez adriazalvarez self-assigned this Mar 27, 2024
Copy link
Contributor

@adriazalvarez adriazalvarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this update to the previous fix. It looks more succinct and neat now, using the ADSobserver class, and the crash remains fixed.
Looks good to me, just added couple of comments.

*/
void PreviewPlot::onWorkspaceReplaced(Mantid::API::WorkspaceBeforeReplaceNotification_ptr nf) {
void PreviewPlot::replaceHandle(const std::string &wsName, const Workspace_sptr &ws) {
(void)wsName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess is up to your personal preference, in some other places of mantid this is written with UNUSED_ARG(..) macro. Would you prefer this rather than the macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good question. I guess UNUSED_ARG is more explicit as its clearer what its doing, but then (void)var; is probably easier to remember as it doesn't require a named macro. Either way I think it would just be down to preference, but I'm not sure I have a preference!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. No problem.

Copy link
Contributor

@adriazalvarez adriazalvarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further improves on stabilizing the use of interfaces across indirect/inelastic categories.
Happy to approve it.

@SilkeSchomann SilkeSchomann merged commit b9aa964 into mantidproject:main Mar 28, 2024
9 checks passed
@robertapplin robertapplin deleted the 0-use-ads-observer-class-for-preview-plot branch May 17, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indirect/Inelastic Issues and pull requests related to indirect or inelastic ISIS Team: Spectroscopy Issue and pull requests managed by the Spectroscopy subteam at ISIS Maintenance Unassigned issues to be addressed in the next maintenance period.
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants