Skip to content

Conversation

adriazalvarez
Copy link
Contributor

@adriazalvarez adriazalvarez commented Aug 7, 2024

Description of work

This PR creates a new widget that can be embedded in inelastic interfaces to add a label to the name of the output workspace. The label is typically added before the default workspace prefix( for example, _red or _sqw), unless there is not prefix on the interface, in which case is added at the end of the default output name (although the algorithm could add another prefix on the final workspace generation). When the label is changed, the widget will generate what would be the final workspace name after running the interface algorithm and check if this name is already in use in the ADS. Then updating a colored label with an appropriate warning message so that the user can know whether data will be overridden, but it does not prevent the data to be overridden if the user still runs the interface algorithm.

Fixes #37201

Further detail of work

Initially, I added the widget as a single class containing all the functionality. On a second revision, I have changed it to contain a presenter and a view to make it more organized and also to add tests.

To test:

  • Open Elwin interface.
  • Make sure the restrict workspace by extension... option is checked on settings.
  • Add a sample file to the interface: irs26176_graphite002_red
  • The label widget sits just below the Run widget. You will see that next to the Current Output Name text, a label will update with the full expected output name for the current data file. The warning label just before this label is turned on green color with a text indicating that with the current output name, there won't be any overriding workspaces on the ads.
  • There is an edit with the placeholder text NoLabel. Click on the edit and write label
  • The current output name should update to: irs26176_graphite002_label_red_elwin_eq, still the warning label on green as this workspace name is not used on the ADS.
  • Click on Run.
  • The warning label will immediately turn to red, indicating that the current label is in used on the ADS.
  • Change the label to label2, the warning label will be green indicating the output name is not overridden.
  • On settings, untick the restrict by suffix option.
  • When changing the label, you should see that the label appears after the workspace suffix: irs26176_graphite002_red_label...

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.

@adriazalvarez adriazalvarez force-pushed the label_output_workspaces branch from 8c23f3a to 351792a Compare August 7, 2024 11:19
@github-actions github-actions bot added the Has Conflicts Used by the bot to label pull requests that have conflicts label Aug 21, 2024
Copy link

👋 Hi, @adriazalvarez,

Conflicts have been detected against the base branch. Please rebase your branch against the base branch.

@adriazalvarez adriazalvarez added the Awaiting User Response Waiting on input or testing from a third party label Aug 21, 2024
@sf1919 sf1919 added this to the Release 6.12 milestone Sep 10, 2024
@adriazalvarez adriazalvarez force-pushed the label_output_workspaces branch from c88164b to a601281 Compare October 22, 2024 15:08
@github-actions github-actions bot removed the Has Conflicts Used by the bot to label pull requests that have conflicts label Oct 22, 2024
Copy link

👋 Hi, @adriazalvarez,

Conflicts have been detected against the base branch. Please rebase your branch against the base branch.

@github-actions github-actions bot added the Has Conflicts Used by the bot to label pull requests that have conflicts label Oct 24, 2024
@adriazalvarez adriazalvarez force-pushed the label_output_workspaces branch from 16da6d1 to b012691 Compare October 24, 2024 11:49
@github-actions github-actions bot added Has Conflicts Used by the bot to label pull requests that have conflicts and removed Has Conflicts Used by the bot to label pull requests that have conflicts labels Oct 24, 2024
Copy link

👋 Hi, @adriazalvarez,

Conflicts have been detected against the base branch. Please rebase your branch against the base branch.

…to workspace output names in inelastic interfaces
…ent function call and not on the final call to setup elwin algo
…is held by ElwinView widget, and update tab specific suffixes on the output name widget
…ing output name widget, also create mock class for output name widget
…suffices restrictions are changed from settings
@adriazalvarez adriazalvarez force-pushed the label_output_workspaces branch from 198be53 to 418eaa4 Compare October 28, 2024 15:47
@github-actions github-actions bot removed the Has Conflicts Used by the bot to label pull requests that have conflicts label Oct 28, 2024
@adriazalvarez adriazalvarez added Indirect/Inelastic Issues and pull requests related to indirect or inelastic ISIS: Spectroscopy Issue and pull requests relating to Muons, Indirect and Inelastic at ISIS GUI Issues and pull requests specific to the Mantid Workbench GUI. and removed Awaiting User Response Waiting on input or testing from a third party labels Oct 29, 2024
@adriazalvarez adriazalvarez marked this pull request as ready for review October 29, 2024 14:09
@robertapplin robertapplin self-assigned this Oct 29, 2024
Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

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

I've tested this and its working really well - it is clear and easy to use, and produced the expected output workspace. Thanks for your hard work with this project!

I have a couple of non-code suggestions:

  • I think we should add a tooltip to the "Label" line edit to explain how the provided text will be used
  • The Current Output Name is sometimes cut off in the vertical direction:
    image

@adriazalvarez adriazalvarez marked this pull request as draft November 1, 2024 10:56
… for the label TextEdit to indicate how the widget operates
@adriazalvarez adriazalvarez marked this pull request as ready for review November 1, 2024 15:09
@adriazalvarez
Copy link
Contributor Author

Thanks for the review Rob.
It's a bit annoying as I was putting together the widget on MacOs, but as we are using default system font size for widgets in Mantid, the default tends to look small in Mac while quite large in Windows.
I have tried to change the layout to make a more homogeneous look between OSs, that doesn't cut the label in windows.

Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

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

Just one small typo to fix, then I'll happily approve!

Copy link
Contributor

@robertapplin robertapplin 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 the changes, this is a useful new feature which should address the need to produce output workspaces from the Elwin interface with different names so that previously processed workspaces are not overridden

Approving because the test failure is unrelated

@SilkeSchomann SilkeSchomann self-assigned this Nov 12, 2024
@SilkeSchomann SilkeSchomann merged commit bf3f2f2 into main Nov 12, 2024
10 checks passed
@SilkeSchomann SilkeSchomann deleted the label_output_workspaces branch November 12, 2024 08:04
mpatrou pushed a commit that referenced this pull request Nov 21, 2024
This is a squashed version of #37762

Add new output name widget class and gui to add custom output labels to workspace output names in inelastic interfaces

Refactor elwin model to update the output workspace names in a different function call and not on the final call to setup elwin algo

Use label widget to manage output name workspaces from presenter class

Create function to retrieve raw pointer to output name widget, which is held by ElwinView widget, and update tab specific suffixes on the output name widget

Add custom output name widget to GUI

Refactor elwin model and presenter test to work with changes after using output name widget, also create mock class for output name widget

Change layout of the output widget

Update allowed suffices on output widget when suffix settings are changed from indirect settings

Fix clang format

Fix problems in tests after rebase with main

Remove reference to ADS in warning label

Replace function to update label name after last sprint elwin class modifications

Change label abbreviation and use new signal/slot syntax

Rename function for adding underscore to hopefully clearer name

Reimplemenet overriden suffix function to update the label if output suffices restrictions are changed from settings

Split outputname widget class into view and presenter

Modify Data processor class and elwin to construct a outputname

Add tests for OutputNamePresenter

remove empty anonymous namespace

Simplify function to find index where to insert the label

explicit cast size_t to int to avoid test warning

Reformat files after rebase

Add model for the output name widget

Initialize outputname widget with model and move it to the parent inelastic tab class

Add tests for OutputNameModel

refactor presenter tests and add mocks for the output name model

Improve layout visual aspects and consistency accross OS. Add tooltip for the label TextEdit to indicate how the widget operates

fix typo in ui
mpatrou pushed a commit that referenced this pull request Nov 22, 2024
This is a squashed version of #37762

Add new output name widget class and gui to add custom output labels to workspace output names in inelastic interfaces

Refactor elwin model to update the output workspace names in a different function call and not on the final call to setup elwin algo

Use label widget to manage output name workspaces from presenter class

Create function to retrieve raw pointer to output name widget, which is held by ElwinView widget, and update tab specific suffixes on the output name widget

Add custom output name widget to GUI

Refactor elwin model and presenter test to work with changes after using output name widget, also create mock class for output name widget

Change layout of the output widget

Update allowed suffices on output widget when suffix settings are changed from indirect settings

Fix clang format

Fix problems in tests after rebase with main

Remove reference to ADS in warning label

Replace function to update label name after last sprint elwin class modifications

Change label abbreviation and use new signal/slot syntax

Rename function for adding underscore to hopefully clearer name

Reimplemenet overriden suffix function to update the label if output suffices restrictions are changed from settings

Split outputname widget class into view and presenter

Modify Data processor class and elwin to construct a outputname

Add tests for OutputNamePresenter

remove empty anonymous namespace

Simplify function to find index where to insert the label, rename

explicit cast size_t to int to avoid test warning

Reformat files after rebase

Add model for the output name widget

Initialize outputname widget with model and move it to the parent inelastic tab class

Add tests for OutputNameModel

refactor presenter tests and add mocks for the output name model

Improve layout visual aspects and consistency accross OS. Add tooltip for the label TextEdit to indicate how the widget operates

fix typo in ui
mpatrou added a commit that referenced this pull request Nov 25, 2024
Add tests for IqtPresenter tab #37901
Elwin allow processing ILL data #38033
Update Qt connection syntax in Inelastic Interfaces #38119
Update Moments tab instructions and add more tests #38274
Construct the model of OutputPlotOptions widget outside the Presenter class.  #38289
Add identifier for output workspaces in Elwin Interface #37762
MVP for the ResNorm tab of the Inelastic Bayes Fitting interface #38357
Remove deprecated Calculate Paalman Pings tab from Inelastic Corrections #38391
Use std::pair instead of QPair in utility files #38396
Elwin Elastic line integration issue #38392
---------

Co-authored-by: adriazalvarez <adrian.diaz-alvarez@stfc.ac.uk>
Co-authored-by: Applin <robert.applin@stfc.ac.uk>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI Issues and pull requests specific to the Mantid Workbench GUI. Indirect/Inelastic Issues and pull requests related to indirect or inelastic ISIS: Spectroscopy Issue and pull requests relating to Muons, Indirect and Inelastic at ISIS
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

Add an identifier for output workspaces in Elwin Interface
4 participants