Skip to content

Remove circular ref in base widget #116

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

Merged
merged 1 commit into from
May 17, 2023
Merged
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: 0 additions & 1 deletion src/napari_matplotlib/base.py
Original file line number Diff line number Diff line change
@@ -48,7 +48,6 @@ def __init__(self, napari_viewer: napari.viewer.Viewer):

self.viewer = napari_viewer
self.canvas = FigureCanvas()
self.canvas.widget = self

self.canvas.figure.patch.set_facecolor("none")
self.canvas.figure.set_layout_engine("constrained")
6 changes: 5 additions & 1 deletion src/napari_matplotlib/tests/test_histogram.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from copy import deepcopy

import pytest

from napari_matplotlib import HistogramWidget
@@ -9,4 +11,6 @@ def test_example_q_widget(make_napari_viewer, astronaut_data):
viewer = make_napari_viewer()
viewer.add_image(astronaut_data[0], **astronaut_data[1])
fig = HistogramWidget(viewer).figure
return fig
# Need to return a copy, as original figure is too eagerley garbage
# collected by the widget
return deepcopy(fig)
6 changes: 5 additions & 1 deletion src/napari_matplotlib/tests/test_slice.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from copy import deepcopy

import pytest

from napari_matplotlib import SliceWidget
@@ -8,4 +10,6 @@ def test_slice(make_napari_viewer, brain_data):
viewer = make_napari_viewer()
viewer.add_image(brain_data[0], **brain_data[1])
fig = SliceWidget(viewer).figure
return fig
# Need to return a copy, as original figure is too eagerley garbage
# collected by the widget
return deepcopy(fig)