-
Notifications
You must be signed in to change notification settings - Fork 128
Extracted Logic in Pairing Table View to Presenter #38213
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
Conversation
- Updated Failing Tests - Created Getters for Properties in PairingTableView so the properties are accesed through the getters in the PairingTablePresenter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the effort on moving the logic out of the view class. I know this view is not easy to refactor ! Generally the view seems more neat and decluttered, although I have found some moved functions that maybe belong in the view, and we could subscribe the presenter to the view to avoid connecting signals/slots on the presenter and use notifiers instead to call the relevant functions on the presenter.
Also, when testing I have found this error when i click on Load current run
:
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Show resolved
Hide resolved
...nterfaces/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_constants.py
Outdated
Show resolved
Hide resolved
dfab969
to
9974af2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for a typo that is creating a runtime error, I have followed the manual testing instructions without any functional issue on the pair table widget. Thanks for the good work on this refactoring.
I have added some additional comments on small things that I've noticed during review.
...nterfaces/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_constants.py
Outdated
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...erfaces/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_view.py
Outdated
Show resolved
Hide resolved
qt/python/mantidqtinterfaces/test/Muon/grouping_tab/pairing_table_group_selector_test.py
Outdated
Show resolved
Hide resolved
qt/python/mantidqtinterfaces/test/Muon/grouping_tab/pairing_table_group_selector_test.py
Outdated
Show resolved
Hide resolved
…nd Presenter - created a getter for model._context so the property can be accessed using the getter - remove pairing table constants
Code has been updated to fix an issue on the pairing table pointed out by @adriazalvarez, Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the latest changes Yusuf.
I have been testing the pairing table again, everything works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to approve before!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed a couple more improvements that could be made while we're editing these files.
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...es/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_presenter.py
Outdated
Show resolved
Hide resolved
...erfaces/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_view.py
Show resolved
Hide resolved
...erfaces/mantidqtinterfaces/Muon/GUI/Common/pairing_table_widget/pairing_table_widget_view.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the late review, I didn't see the notification that the changes had been made.
This implementation of the context manager won't work, unfortunately. Where the with
blocks are isn't where the updates need to be stopped. Instead, they should be used in places like add_pair_to_view
def add_pair_to_view(self, pair, to_analyse=False, color=row_colors[RowValid.valid_for_all_runs], tool_tip=row_tooltips[RowValid.valid_for_all_runs]):
with self.disable_updates_context():
self.update_group_selections()
assert isinstance(pair, MuonPair)
entry = [str(pair.name), to_analyse, str(pair.forward_group), str(pair.backward_group), str(pair.alpha)]
self.add_entry_to_table(entry, color, tool_tip)
Which would disable the updates to the view during the time the execution is inside the with
block. update_view_from_model
would be the other place you'd want to use the context manager. Let me know if you have any questions.
renamed enable updates method to disable updates method and vice versa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-checked functionality and seems to be working well, nice work.
Description of work
Fixes #38105
To test:
This does not require release notes because it involves code restructuring, no new functionality has been added