live-preview marks based on mouseover #2293
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request modifies the previous
plugin_opened
logic (which only triggered when a plugin was opened in the tray) that controlled the visibilities of "live-preview marks" from plugins to instead be triggered based on whether the mouse is actively over the plugin. A switch (which defaults to false in most cases) can then be toggled to make the live-preview marks persistent and remain visible when the mouse leaves the plugin. Internally, the plugin is considered "active" (and live-preview marks shown) whenever the mouse is over the plugin ORpersistent_previews == True
.This includes a visual cue when the plugin is considered "active" matching the color of the live-preview marks (if/when we support customizing the color of the marks, this highlighting should also adjust to match).
Screen.Recording.2023-07-11.at.8.59.09.AM.mov
For spectral extraction, which already used mouseover location to determine which section is active, additional visual cues are added:
Screen.Recording.2023-07-11.at.9.19.25.AM.mov
Lastly, for any plugin for which
plugin.has_previews == True
, this exposes atemporarily_show_previews
context manager that can be used for workflows in the API:Screen.Recording.2023-07-11.at.9.20.44.AM.mov
This PR affects the following plugins:
send_state
(see replace all hacky traitlet replacements with send_state #2285) to avoid any unnecessary lag.plugin.show()
, but is then updated regardless of the plugin's active status.plugin.show()
, but is then updated regardless of the plugin's active statusplugin.show_continuum_marks()
which used to allow showing these marks from the API is now deprecated, in favor of usingplugin.persistent_previews = True
orwith plugin.temporarily_show_previews():
Development considerations:
self.has_previews = True
and pass:has_previews="has_previews" :plugin_active.sync="plugin_active" :persistent_previews.sync="persistent_previews"
toj-tray-plugin
(as indicated in the developer docs). It should then observe theshow_previews
traitlet to control the visibility of any marks.plugin_opened_in_tray
traitlet but will also need to overrideplugin.show
to handle the case where the plugin is first opened from the API (as is done here for plot options and compass).Change log entry
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, maintainershould 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.
trivial
label.