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

data-menu: orientation #3271

Merged
merged 5 commits into from
Nov 14, 2024
Merged

data-menu: orientation #3271

merged 5 commits into from
Nov 14, 2024

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Nov 7, 2024

Description

This pull request implements orientation selection (when applicable) in the data menu.

Until enabled, the following is necessary for dev testing:

for viewer in imviz.viewers.values():
    viewer._obj.data_menu._obj.dev_data_menu = True

(Note: icons added to dropdown since screen recording)

Screen.Recording.2024-11-07.at.2.41.12.PM.mov

Change log entry

  • Is a change log needed? If yes, is it added to CHANGES.rst? If you want to avoid merge conflicts,
    list the proposed change log here for review and add to CHANGES.rst before merge. If no, maintainer
    should add a no-changelog-entry-needed label.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@github-actions github-actions bot added the plugin Label for plugins common to multiple configurations label Nov 7, 2024
@kecnry kecnry added this to the 4.1 milestone Nov 7, 2024
Comment on lines +981 to +992
valid = self.labels
if self.is_multiselect:
if not isinstance(event['new'], list):
self.selected = [event['new']]
return
if not np.all([item in self.labels + [''] for item in event['new']]):
if not np.all([item in valid + [''] for item in event['new']]):
self.selected = event['old']
raise ValueError(f"not all items in {event['new']} are one of {self.labels}, reverting selection to {event['old']}") # noqa
raise ValueError(f"not all items in {event['new']} are one of {valid}, reverting selection to {event['old']}") # noqa
else:
if event['new'] not in self.labels + ['']:
if event['new'] not in valid + ['']:
self.selected = event['old']
raise ValueError(f"{event['new']} not one of {self.labels}, reverting selection to {event['old']}") # noqa
raise ValueError(f"\'{event['new']}\' not one of {valid}, reverting selection to \'{event['old']}\'") # noqa
Copy link
Member Author

Choose a reason for hiding this comment

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

because of the callbacks in the orientation select in the data-menu, there were cases where self.labels was updating between the if-statement and the error message, resulting in very confusing error messages that 'something' not one of ['something']. This fixes that and also adds quotation marks (especially useful for empty strings), which results in the test changes.

Copy link
Contributor

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

Maybe I'm too picky, but I think the "Orientation" label over the dropdown takes up a lot of space, and it's redundant when the default label is "Default Orientation."

I referred back to Jenn's design and I see that the "Orientation" label is there, but it's smaller. Comparing the implementation in this PR:

Screenshot 2024-11-11 at 15 13 26

with Jenn's sketch:

Screenshot 2024-11-11 at 15 13 36

Is it easy to make that label smaller or unnecessary?

@kecnry
Copy link
Member Author

kecnry commented Nov 11, 2024

I'd vote that we handle that in the final UI review/tweaks with her... I agree that it feels a little cluttered, but also am hesitant to override default styles that are used everywhere throughout the app. Once we have API hints (#3274), we will also need some of that space to make the eligible and consistent with other labels.

@camipacifici
Copy link
Contributor

Looks very good to me! Intuitive and functional. I would not reduce the size of "orientation". I fear it will be too small to read.
I think there needs to be some spinning wheel for orientation. I think it was discussed somewhere else too so it might not be in scope for this PR, but lets not forget about this.

@haticekaratay
Copy link
Contributor

The new menu design is very intuitive and functions as described. However, I have one question: the menu doesn’t seem to stay fixed on the selected buttons. Was this part of the ticket? Other than that, it looks great. Thank you for your work!

image

@kecnry
Copy link
Member Author

kecnry commented Nov 13, 2024

@haticekaratay - it should adjust position on scroll to always be attached to the legend - can you try just opening a fresh imviz, opening the menu, and scrolling? Is there some other workflow you did here that breaks it (if so, can you list the steps or show a video)?

@haticekaratay
Copy link
Contributor

@haticekaratay - it should adjust position on scroll to always be attached to the legend - can you try just opening a fresh imviz, opening the menu, and scrolling? Is there some other workflow you did here that breaks it (if so, can you list the steps or show a video)?
Hey @kecnry, here is the video:

The menu is attached to the button but shifts when you scroll. It should always be positioned fixed to the button or below the toolbar as it's in the main.
Here is the behavior I observe on this branch:

Screen.Recording.2024-11-13.at.3.43.41.PM.mov

This is what I see in main:

Screen.Recording.2024-11-13.at.3.55.53.PM.mov

@kecnry
Copy link
Member Author

kecnry commented Nov 13, 2024

now rebased on top of #3272

@kecnry
Copy link
Member Author

kecnry commented Nov 14, 2024

@haticekaratay - I cannot reproduce and don't see anything here that should have affected that 🤔 can you try again now that its rebased? Is anyone else seeing the same?

@haticekaratay
Copy link
Contributor

@haticekaratay - I cannot reproduce and don't see anything here that should have affected that 🤔 can you try again now that its rebased? Is anyone else seeing the same?

I no longer see it after the rebase. Everything is good now! :)

Screen.Recording.2024-11-14.at.9.27.46.AM.mov

@kecnry kecnry merged commit 6fc4566 into spacetelescope:main Nov 14, 2024
16 of 17 checks passed
@kecnry kecnry deleted the dm-orientation branch November 14, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin Label for plugins common to multiple configurations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants