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

refactor self.selections per Qt's pattern #206

Merged
merged 5 commits into from
Feb 28, 2024

Conversation

prjemian
Copy link
Contributor

@prjemian prjemian added the task routine work label Feb 28, 2024
@prjemian prjemian added this to the v1.0 milestone Feb 28, 2024
@prjemian prjemian self-assigned this Feb 28, 2024
@rodolakis
Copy link
Collaborator

@MDecarabas left that one to me, @prjemian I'll get to it later today.

Copy link
Collaborator

@MDecarabas MDecarabas left a comment

Choose a reason for hiding this comment

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

Things to think about

Comment on lines 346 to 348
def selections(self, key):
"""Pick the key from the plot selections dictionary."""
return self._selections[key]
Copy link
Collaborator

Choose a reason for hiding this comment

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

As far as I can tell this function is not used anywhere in the code, except for line 222. Even when used it does not seem to be any shorter or cleaner than the previous implementation. Is there a specific problem you are trying to address?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tend to agree. It's a question of consistency (with Qt's pattern) or being concise. Not sure these changes help.

@rodolakis - What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am looking to see if I am using this at some other places in the code in mdaviz (stuff that would come up afterward as the development progresses)

Copy link
Collaborator

Choose a reason for hiding this comment

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

The def selections(self) method is still not consistent with Qt pattern: self._selections attribute is a dictionary, so self.selections() should also return a dictionary.


def setSelectionsItem(self, key, value):
"""Set the key in the plot selections dictionary."""
self.selections()[key] = value
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not modify the method (self.selections) but the attribute (self._selections)

@rodolakis rodolakis self-requested a review February 28, 2024 22:55
Copy link
Collaborator

@rodolakis rodolakis left a comment

Choose a reason for hiding this comment

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

All my comment were addressed, LGTM now!

@prjemian prjemian merged commit 8e2755b into main Feb 28, 2024
6 checks passed
@prjemian prjemian deleted the 201-refactor-self.selections-per-Qt-pattern branch February 28, 2024 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task routine work
Projects
Development

Successfully merging this pull request may close these issues.

self.selections should follow Qt's get/set pattern
3 participants