File tree 4 files changed +10
-1
lines changed
4 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 10
10
)
11
11
from matplotlib .figure import Figure
12
12
from qtpy .QtGui import QIcon
13
- from qtpy .QtWidgets import QVBoxLayout , QWidget
13
+ from qtpy .QtWidgets import QLabel , QVBoxLayout , QWidget
14
14
15
15
from .util import Interval , from_napari_css_get_size_of
16
16
@@ -36,6 +36,9 @@ class BaseNapariMPLWidget(QWidget):
36
36
methods for working with napari layers.
37
37
"""
38
38
39
+ #: Name of widget. If not None, will be displayed as a title in the widget.
40
+ name : Optional [str ] = None
41
+
39
42
def __init__ (
40
43
self ,
41
44
parent : Optional [QWidget ] = None ,
@@ -52,6 +55,8 @@ def __init__(
52
55
self ._replace_toolbar_icons ()
53
56
54
57
self .setLayout (QVBoxLayout ())
58
+ if self .name is not None :
59
+ self .layout ().addWidget (QLabel (self .name ))
55
60
self .layout ().addWidget (self .toolbar )
56
61
self .layout ().addWidget (self .canvas )
57
62
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class HistogramWidget(NapariMPLWidget):
19
19
20
20
n_layers_input = Interval (1 , 1 )
21
21
input_layer_types = (napari .layers .Image ,)
22
+ name = "Histogram"
22
23
23
24
def __init__ (
24
25
self ,
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ class ScatterWidget(ScatterBaseWidget):
75
75
of a scatter plot, to avoid too many scatter points.
76
76
"""
77
77
78
+ name = "Scatter widget"
78
79
n_layers_input = Interval (2 , 2 )
79
80
input_layer_types = (napari .layers .Image ,)
80
81
@@ -104,6 +105,7 @@ class FeaturesScatterWidget(ScatterBaseWidget):
104
105
Widget to scatter data stored in two layer feature attributes.
105
106
"""
106
107
108
+ name = "Features scatter"
107
109
n_layers_input = Interval (1 , 1 )
108
110
# All layers that have a .features attributes
109
111
input_layer_types = (
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class SliceWidget(NapariMPLWidget):
19
19
Plot a 1D slice along a given dimension.
20
20
"""
21
21
22
+ name = "1D slice"
22
23
n_layers_input = Interval (1 , 1 )
23
24
input_layer_types = (napari .layers .Image ,)
24
25
You can’t perform that action at this time.
0 commit comments