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

Initialize all trace metadata IDs #62

Merged
merged 1 commit into from
May 10, 2024
Merged
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
3 changes: 2 additions & 1 deletion glue_plotly/viewers/histogram/dotplot_layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# normalized mode, as a dotplot only makes sense when the heights are integral.

import numpy as np
from uuid import uuid4

from glue.core.exceptions import IncompatibleAttribute
from glue.viewers.common.layer_artist import LayerArtist
Expand Down Expand Up @@ -35,7 +36,7 @@

self.view = view
self.bins = None
self._dots_id = None
self._dots_id = uuid4().hex

Check warning on line 39 in glue_plotly/viewers/histogram/dotplot_layer_artist.py

View check run for this annotation

Codecov / codecov/patch

glue_plotly/viewers/histogram/dotplot_layer_artist.py#L39

Added line #L39 was not covered by tests

self._viewer_state.add_global_callback(self._update_dotplot)
self.state.add_global_callback(self._update_dotplot)
Expand Down
3 changes: 2 additions & 1 deletion glue_plotly/viewers/histogram/layer_artist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
from uuid import uuid4

from glue.core.exceptions import IncompatibleAttribute
from glue.viewers.common.layer_artist import LayerArtist
Expand Down Expand Up @@ -30,7 +31,7 @@

self.view = view
self.bins = None
self._bars_id = None
self._bars_id = uuid4().hex

Check warning on line 34 in glue_plotly/viewers/histogram/layer_artist.py

View check run for this annotation

Codecov / codecov/patch

glue_plotly/viewers/histogram/layer_artist.py#L34

Added line #L34 was not covered by tests

self._viewer_state.add_global_callback(self._update_histogram)
self.state.add_global_callback(self._update_histogram)
Expand Down
10 changes: 7 additions & 3 deletions glue_plotly/viewers/scatter/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@
scatter = self._create_scatter()
self.view.figure.add_trace(scatter)

self._lines_id = None
self._error_id = None
self._vector_id = None
# We want to initialize these to some dummy UUIDs so that
# _get_lines, _get_error_bars, _get_vectors, etc. don't pick up
# any other traces that tools have added to the viewer, which
# will happen if these IDs are None
self._lines_id = uuid4().hex
self._error_id = uuid4().hex
self._vector_id = uuid4().hex

Check warning on line 93 in glue_plotly/viewers/scatter/layer_artist.py

View check run for this annotation

Codecov / codecov/patch

glue_plotly/viewers/scatter/layer_artist.py#L91-L93

Added lines #L91 - L93 were not covered by tests

def remove(self):
self.view._remove_traces([self._get_scatter()])
Expand Down
Loading