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

Delete intermediate theory plots by tab id not model id. #3160

Merged
merged 4 commits into from
Jan 9, 2025

Conversation

jamescrake-merani
Copy link
Contributor

@jamescrake-merani jamescrake-merani commented Dec 17, 2024

Description

I've tried to fix #3159 by changing the deleteIntermediateTheoryPlotsByModelID method so that it deletes by tab id, and not model id. This was causing the bug as we had 2 tabs with the same model, and it was trying to delete theory items from the other tab.

While this fixes the problem, I'm not entirely sure how suitable this fix is as I'm not aware of why this method was needed in the first place, and thus it could potentially break some other functionality. It would probably be useful to discuss this fix at the call.

How Has This Been Tested?

Followed the reproduction instructions Paul provided in #3159. I am no longer able to reproduce the bug in this pull request.

Review Checklist:

Documentation (check at least one)

  • There is nothing that needs documenting
  • Documentation changes are in this PR
  • There is an issue open for the documentation (link?)

Installers

  • There is a chance this will affect the installers, if so
    • Windows installer (GH artifact) has been tested (installed and worked)
    • MacOSX installer (GH artifact) has been tested (installed and worked)

Licencing (untick if necessary)

  • The introduced changes comply with SasView license (BSD 3-Clause)

Sorry, something went wrong.

@jamescrake-merani jamescrake-merani linked an issue Dec 17, 2024 that may be closed by this pull request
@jamescrake-merani jamescrake-merani added Discuss At The Call Issues to be discussed at the fortnightly call SasView 6.0.1 labels Dec 17, 2024
@rozyczko
Copy link
Member

I think that this looks sensible. DataItem is connected to a fitting tab, with a unique ID, so all dependent plots should be checked against that unique ID.

@@ -2077,8 +2077,8 @@ def deleteIntermediateTheoryPlotsByModelID(self, model_id):
return
match = GuiUtils.theory_plot_ID_pattern.match(data.id)
if match:
item_model_id = match.groups()[-1]
if item_model_id == model_id:
item_tab_id = match.groups()[0]
Copy link
Member

Choose a reason for hiding this comment

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

why do you compare the first, not last match?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In an example I just ran, match.groups() returns:

('1', None, None, 'sphere')

And the first item seems to be the tab ID.

While confirming this, I just spotted a mistake since the signal is still set to emit a string when its actually now given an integer. I'm going to fix this now but I will probably convert the tab ID to a string before passing it to the event instead of converting the first match into an integer because if, for whatever reason, the first match is not a parsable number then it could error.

@jamescrake-merani jamescrake-merani removed the Discuss At The Call Issues to be discussed at the fortnightly call label Dec 17, 2024
@butlerpd
Copy link
Member

I think this should be against release_6.0.1 rather than main. Interestingly, checking 5.0.6 hitting return at the appropriate juncture immediately throws the traceback error but the parameter panel never goes blank?

@jamescrake-merani
Copy link
Contributor Author

I think this should be against release_6.0.1

Yes I think you're right. I had it on main as that was the default when Github creates a PR from an issue. I'll try to change it.

Interestingly, checking 5.0.6 hitting return at the appropriate juncture immediately throws the traceback error but the parameter panel never goes blank?

Hmm interesting. I was going to try this for myself on IDAaaS but there seems to be some downtime at the moment but I'll have a look when thats back.

@jamescrake-merani jamescrake-merani force-pushed the 3159-error-when-plotting-models branch from 881b037 to 3e888fd Compare December 18, 2024 09:08
@jamescrake-merani jamescrake-merani changed the base branch from main to release_6.0.1 December 18, 2024 09:08
@jamescrake-merani
Copy link
Contributor Author

Looks like the Mac build failed but by the looks of it, it is just a CI issue. The error is:

hdiutil: create failed - Resource busy

@jamescrake-merani
Copy link
Contributor Author

Interestingly, checking 5.0.6 hitting return at the appropriate juncture immediately throws the traceback error but the parameter panel never goes blank?

This is actually the behaviour I get on Linux, and I just tested 5.0.6, and got the same result (albeit on Linux again). My guess is that it depends when the parameters are redrawn, and at one point the theory item is accessed.

@lucas-wilkins lucas-wilkins merged commit 1982302 into release_6.0.1 Jan 9, 2025
18 of 19 checks passed
@lucas-wilkins lucas-wilkins deleted the 3159-error-when-plotting-models branch January 9, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when plotting models
4 participants