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

ENH: Adding Plot Options toggle for mouseover info/marker #1986

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class ApplicationState(State):
'tab_headers': True,
},
'viewer_labels': True,
'mouseover_marker': True,
'dense_toolbar': True,
'context': {
'notebook': {
Expand Down
4 changes: 4 additions & 0 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ class PlotOptions(PluginTemplateMixin):

show_viewer_labels = Bool(True).tag(sync=True)

show_mouseover_marker = Bool(True).tag(sync=True)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.viewer = ViewerSelect(self, 'viewer_items', 'viewer_selected', 'multiselect')
Expand Down Expand Up @@ -304,6 +306,7 @@ def line_visible(state):
# display_units

self.show_viewer_labels = self.app.state.settings['viewer_labels']
self.show_mouseover_marker = self.app.state.settings['mouseover_marker']
self.app.state.add_callback('settings', self._on_app_settings_changed)

@property
Expand Down Expand Up @@ -331,6 +334,7 @@ def _on_show_viewer_labels_changed(self, event):

def _on_app_settings_changed(self, value):
self.show_viewer_labels = value['viewer_labels']
self.show_mouseover_marker = value['mouseover_marker']

def select_all(self, viewers=True, layers=True):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
persistent-hint
></v-switch>
</v-row>
<v-row>
<v-switch v-if="['specviz', 'cubeviz', 'mosviz'].indexOf(config) !== -1"
v-model="show_mouseover_marker"
label="Show mouseover marker"
hint="Whether to show a marker at the mouse position"
persistent-hint
></v-switch>
</v-row>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
Expand Down
5 changes: 5 additions & 0 deletions jdaviz/configs/specviz/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ def on_mouse_or_key_event(self, data):
else: # pragma: no cover
return

# only handle mouseover markers if the setting is selected:
plot_options_plugin = self.jdaviz_app.get_tray_item_from_name('g-plot-options')
if not plot_options_plugin.show_mouseover_marker:
return

if data['event'] == 'mousemove':
if len(self.jdaviz_app.data_collection) < 1:
return
Expand Down