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

stylized layer icons in legend (future data-menu) #3220

Merged
merged 20 commits into from
Oct 21, 2024

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Oct 15, 2024

Description

This pull request generalizes the existing stylized layer icons used for layer tabs in plot options to also be used in the viewer layer legends (which will eventually be used to open the new data-menu).

Screenshot 2024-10-16 at 8 34 49 AM Screenshot 2024-10-16 at 8 34 59 AM

TODO:

  • fix test failures
  • re-implement prefix_icon n the flyout

Known "delayed update" issues hopefully fixed by upstream subset messaging work:

  • linewidth in spectrum viewer legend (updates after change to color)
  • new spectral subset in spectrum viewer legend (updates after additional subset)
  • change in color_mode needs to force styling update (changing color/colormap after does)

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)?

@kecnry kecnry added this to the 4.1 milestone Oct 15, 2024
@github-actions github-actions bot added the plugin Label for plugins common to multiple configurations label Oct 15, 2024
@kecnry kecnry force-pushed the layer-icon-generalize branch 4 times, most recently from 256c41b to 5b77543 Compare October 16, 2024 16:55
@kecnry
Copy link
Member Author

kecnry commented Oct 16, 2024

This is now ready for reviews (see notes in description about known buggy behaviors which likely will be follow-up efforts unless anyone has concerns). I'm leaving this in draft since we want to defer merge until after the 4.0 release.

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 98.14815% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.64%. Comparing base (9a1fe09) to head (8f9b263).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...viz/configs/default/plugins/data_menu/data_menu.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3220      +/-   ##
==========================================
+ Coverage   88.62%   88.64%   +0.01%     
==========================================
  Files         125      125              
  Lines       18775    18789      +14     
==========================================
+ Hits        16639    16655      +16     
+ Misses       2136     2134       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Looks good to me so far (given the caveats listed in the description).

</div>
</template>

<style scoped>
.viewer-label {
display: block;
float: right;
background-color: #c3c3c3c3;
width: 24px;
background-color: #c3c3c32c;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, this adds transparency to the existing gray

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we specify cursor: default until the icons are clickable (and then pointer)?

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea, done via passing disabled to the underlying v-btn.

Comment on lines +68 to +69
/* follow-up: use actual colors from the DQ plugins */
color_or_cmap = 'rainbow'
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what color DQ should get. We could take the first N colors from the DQ colormap like you're probably saying in this comment, but they're (intentionally) random, and this might not be the most visually meaningful way to represent DQ.

return 'repeating-linear-gradient(30deg, rgba(0,0,0,0.4), rgba(0,0,0,0.4) 8px, transparent 8px, transparent 8px, transparent 10px)'
}
},
colorBackgroundStyle(colors, cmap_samples) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't expect that these loops to evaluate the colormap for the icons cost much. But is there a way to prove to ourselves that this is true?

Copy link
Member Author

Choose a reason for hiding this comment

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

we could try to profile it? All this is doing though is taking the input lists generated in python and joining them into a string, with a bit of math to set the widths of each entry, so I really don't expect it to show up in anything.

may eventually replace layer-viewer-icon
* will eventually be "View data layers and subsets"  according to specs, but for now will just omit tooltip until the data-menu is implemented
currently just stylizes as a rainbow colormap, we could eventually replace this with the actual colors defined in the DQ plugin, but that would require quite a few callbacks to update styling at each change of any color in the list or adding/removing flags, etc
for now this will mimic z-ordering (unless layers are manually toggled to change order) - in the future when we implement reordering, we will need to actually follow the z-order
* still assigned late or incorrectly at times - but using same detection logic as previously
@kecnry kecnry marked this pull request as ready for review October 18, 2024 16:17
@rosteen
Copy link
Collaborator

rosteen commented Oct 18, 2024

I'm pretty sure I know what mixed visibility means in this case (the subset layer for only one data layer is visible), but I could see it being confusing for the user considering they can see the subset no matter what data layer is shown. Not specific to this PR as it's also this way in Plot Options, but it's more...visible...here, and thus might cause more confusion. Would it perhaps make more sense to not have the cross hatching on subset layers? Again, not a hold up for this PR, just the first thing I thought when testing this.

Screenshot 2024-10-18 at 5 48 09 PM

@rosteen
Copy link
Collaborator

rosteen commented Oct 21, 2024

Doing more testing this morning, I found a bug in Specviz. The layer icon for a subset only appears after you make another subset, rather than when the first is finalized:

Screen.Recording.2024-10-21.at.8.42.56.AM.mov

@rosteen
Copy link
Collaborator

rosteen commented Oct 21, 2024

Never mind, that was a known issue. That's what I get for reviewing in the morning without re-reading the original description!

Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

Looks ok to me, modulo the known issues to be handled in follow ups.

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.

This looks good to go. Thanks!

@kecnry kecnry merged commit 1c85b5d into spacetelescope:main Oct 21, 2024
24 of 25 checks passed
@kecnry kecnry deleted the layer-icon-generalize branch October 21, 2024 13:51
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 Ready for final review UI/UX😍
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants