Skip to content

Navigation Menu

Sign in
Appearance settings

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 578703a

Browse filesBrowse files
committed
Add typing to FeaturesScatterWidget
1 parent caca5d0 commit 578703a
Copy full SHA for 578703a

File tree

Expand file treeCollapse file tree

2 files changed

+13
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-3
lines changed

‎src/napari_matplotlib/base.py

Copy file name to clipboardExpand all lines: src/napari_matplotlib/base.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from pathlib import Path
3+
from typing import Tuple
34

45
import matplotlib as mpl
56
import napari
@@ -70,7 +71,7 @@ def __init__(self, napari_viewer: napari.viewer.Viewer):
7071
# Accept any number of input layers by default
7172
n_layers_input = Interval(None, None)
7273
# Accept any type of input layer by default
73-
input_layer_types = (napari.layers.Layer,)
74+
input_layer_types: Tuple[napari.layers.Layer, ...] = (napari.layers.Layer,)
7475

7576
@property
7677
def n_selected_layers(self) -> int:

‎src/napari_matplotlib/scatter.py

Copy file name to clipboardExpand all lines: src/napari_matplotlib/scatter.py
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,15 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
116116

117117

118118
class FeaturesScatterWidget(ScatterBaseWidget):
119-
n_layers_input = 1
119+
n_layers_input = Interval(1, 1)
120+
# All layers that have a .features attributes
121+
input_layer_types = (
122+
napari.layers.Labels,
123+
napari.layers.Points,
124+
napari.layers.Shapes,
125+
napari.layers.Tracks,
126+
napari.layers.Vectors,
127+
)
120128

121129
def __init__(
122130
self,
@@ -164,7 +172,8 @@ def _set_axis_keys(self, x_axis_key: str, y_axis_key: str):
164172
self._draw()
165173

166174
def _get_valid_axis_keys(self, combo_widget=None) -> List[str]:
167-
"""Get the valid axis keys from the layer FeatureTable.
175+
"""
176+
Get the valid axis keys from the layer FeatureTable.
168177
169178
Returns
170179
-------

0 commit comments

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