Skip to content

Commit c3d1d01

Browse files
committed
introduced FEATURES_LAYER_TYPES variable to be used across widgets
1 parent 98d84f6 commit c3d1d01

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/napari_matplotlib/features.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from napari.layers import Labels, Points, Shapes, Tracks, Vectors
2+
3+
FEATURES_LAYER_TYPES = (
4+
Labels,
5+
Points,
6+
Shapes,
7+
Tracks,
8+
Vectors,
9+
)

src/napari_matplotlib/histogram.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from .base import NapariMPLWidget
99
from .util import Interval
10+
from .features import FEATURES_LAYER_TYPES
1011

1112
__all__ = ["HistogramWidget", "FeaturesHistogramWidget"]
1213

@@ -69,13 +70,7 @@ def draw(self) -> None:
6970
class FeaturesHistogramWidget(NapariMPLWidget):
7071
n_layers_input = Interval(1, 1)
7172
# All layers that have a .features attributes
72-
input_layer_types = (
73-
napari.layers.Labels,
74-
napari.layers.Points,
75-
napari.layers.Shapes,
76-
napari.layers.Tracks,
77-
napari.layers.Vectors,
78-
)
73+
input_layer_types = FEATURES_LAYER_TYPES
7974

8075
def __init__(self, napari_viewer: napari.viewer.Viewer):
8176
super().__init__(napari_viewer)

src/napari_matplotlib/scatter.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from .base import NapariMPLWidget
88
from .util import Interval
9+
from .features import FEATURES_LAYER_TYPES
910

1011
__all__ = ["ScatterBaseWidget", "ScatterWidget",
1112
"FeaturesScatterWidget"]
@@ -107,13 +108,7 @@ class FeaturesScatterWidget(ScatterBaseWidget):
107108

108109
n_layers_input = Interval(1, 1)
109110
# All layers that have a .features attributes
110-
input_layer_types = (
111-
napari.layers.Labels,
112-
napari.layers.Points,
113-
napari.layers.Shapes,
114-
napari.layers.Tracks,
115-
napari.layers.Vectors,
116-
)
111+
input_layer_types = FEATURES_LAYER_TYPES
117112

118113
def __init__(
119114
self,

0 commit comments

Comments
 (0)