Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 415a237

Browse filesBrowse files
authored
Merge pull request #116 from dstansby/begone-circular-ref
Remove circular ref in base widget
2 parents e8c276c + 6b90aa8 commit 415a237
Copy full SHA for 415a237

File tree

3 files changed

+10
-3
lines changed
Filter options

3 files changed

+10
-3
lines changed

‎src/napari_matplotlib/base.py

Copy file name to clipboardExpand all lines: src/napari_matplotlib/base.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def __init__(self, napari_viewer: napari.viewer.Viewer):
4848

4949
self.viewer = napari_viewer
5050
self.canvas = FigureCanvas()
51-
self.canvas.widget = self
5251

5352
self.canvas.figure.patch.set_facecolor("none")
5453
self.canvas.figure.set_layout_engine("constrained")

‎src/napari_matplotlib/tests/test_histogram.py

Copy file name to clipboardExpand all lines: src/napari_matplotlib/tests/test_histogram.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from copy import deepcopy
2+
13
import pytest
24

35
from napari_matplotlib import HistogramWidget
@@ -9,4 +11,6 @@ def test_example_q_widget(make_napari_viewer, astronaut_data):
911
viewer = make_napari_viewer()
1012
viewer.add_image(astronaut_data[0], **astronaut_data[1])
1113
fig = HistogramWidget(viewer).figure
12-
return fig
14+
# Need to return a copy, as original figure is too eagerley garbage
15+
# collected by the widget
16+
return deepcopy(fig)

‎src/napari_matplotlib/tests/test_slice.py

Copy file name to clipboardExpand all lines: src/napari_matplotlib/tests/test_slice.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from copy import deepcopy
2+
13
import pytest
24

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.