@@ -24,19 +24,22 @@ def __init__(
24
24
napari_viewer : napari .viewer .Viewer ,
25
25
parent : Optional [QWidget ] = None ,
26
26
):
27
+ print ("ScatterBase init" )
27
28
super ().__init__ (napari_viewer , parent = parent )
28
29
self .add_single_axes ()
29
30
30
31
def clear (self ) -> None :
31
32
"""
32
33
Clear the axes.
33
34
"""
35
+ print ("ScatterBase clear" )
34
36
self .axes .clear ()
35
37
36
38
def draw (self ) -> None :
37
39
"""
38
40
Scatter the currently selected layers.
39
41
"""
42
+ print ("ScatterBase draw" )
40
43
x , y , x_axis_name , y_axis_name = self ._get_data ()
41
44
42
45
if x .size > self ._threshold_to_switch_to_histogram :
@@ -91,6 +94,7 @@ def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
91
94
y_axis_name: str
92
95
The title to display on the y axis
93
96
"""
97
+ print ("Scatter get data" )
94
98
x = self .layers [0 ].data [self .current_z ]
95
99
y = self .layers [1 ].data [self .current_z ]
96
100
x_axis_name = self .layers [0 ].name
@@ -119,12 +123,14 @@ def __init__(
119
123
napari_viewer : napari .viewer .Viewer ,
120
124
parent : Optional [QWidget ] = None ,
121
125
):
126
+ print ("FeatureScatter init" )
122
127
super ().__init__ (napari_viewer , parent = parent )
123
128
124
129
self .layout ().addLayout (QVBoxLayout ())
125
130
126
131
self ._selectors : Dict [str , QComboBox ] = {}
127
132
for dim in ["x" , "y" ]:
133
+ # pdb.set_trace()
128
134
self ._selectors [dim ] = QComboBox ()
129
135
# Re-draw when combo boxes are updated
130
136
self ._selectors [dim ].currentTextChanged .connect (self ._draw )
@@ -139,13 +145,17 @@ def x_axis_key(self) -> Union[str, None]:
139
145
"""
140
146
Key for the x-axis data.
141
147
"""
148
+ # print('Feat x axis key @property')
142
149
if self ._selectors ["x" ].count () == 0 :
150
+ print ("IF X self selectors count = 0" )
143
151
return None
144
152
else :
153
+ # print('ELSE X self selectors currentText')
145
154
return self ._selectors ["x" ].currentText ()
146
155
147
156
@x_axis_key .setter
148
157
def x_axis_key (self , key : str ) -> None :
158
+ print ("Feat x axis key @setter = " , key )
149
159
self ._selectors ["x" ].setCurrentText (key )
150
160
self ._draw ()
151
161
@@ -154,13 +164,17 @@ def y_axis_key(self) -> Union[str, None]:
154
164
"""
155
165
Key for the y-axis data.
156
166
"""
167
+ # print('Feat y axis key @property')
157
168
if self ._selectors ["y" ].count () == 0 :
169
+ print ("IF Y self selectors count = 0" )
158
170
return None
159
171
else :
172
+ # print('ELSE Y self selectors currentText')
160
173
return self ._selectors ["y" ].currentText ()
161
174
162
175
@y_axis_key .setter
163
176
def y_axis_key (self , key : str ) -> None :
177
+ print ("Feat y axis key @setter = " , key )
164
178
self ._selectors ["y" ].setCurrentText (key )
165
179
self ._draw ()
166
180
@@ -174,6 +188,7 @@ def _get_valid_axis_keys(self) -> List[str]:
174
188
The valid axis keys in the FeatureTable. If the table is empty
175
189
or there isn't a table, returns an empty list.
176
190
"""
191
+ print ("Feat get valid axis keys" )
177
192
if len (self .layers ) == 0 or not (hasattr (self .layers [0 ], "features" )):
178
193
return []
179
194
else :
@@ -184,6 +199,8 @@ def _ready_to_scatter(self) -> bool:
184
199
Return True if selected layer has a feature table we can scatter with,
185
200
and the two columns to be scatterd have been selected.
186
201
"""
202
+ # pdb.set_trace()
203
+ print ("Feat ready to scatter" )
187
204
if not hasattr (self .layers [0 ], "features" ):
188
205
return False
189
206
@@ -200,6 +217,7 @@ def draw(self) -> None:
200
217
"""
201
218
Scatter two features from the currently selected layer.
202
219
"""
220
+ print ("Feat draw" )
203
221
if self ._ready_to_scatter ():
204
222
super ().draw ()
205
223
@@ -221,6 +239,7 @@ def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
221
239
an empty string if nothing to plot.
222
240
"""
223
241
# pdb.set_trace()
242
+ print ("Feat get data" )
224
243
feature_table = self .layers [0 ].features
225
244
226
245
x = feature_table [self .x_axis_key ]
@@ -229,15 +248,20 @@ def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
229
248
x_axis_name = str (self .x_axis_key )
230
249
y_axis_name = str (self .y_axis_key )
231
250
251
+ print ("x-axis = " , str (self .x_axis_key ))
252
+ print ("y-axis = " , str (self .y_axis_key ))
253
+
232
254
return x , y , x_axis_name , y_axis_name
233
255
234
256
def on_update_layers (self ) -> None :
235
257
"""
236
258
Called when the layer selection changes by ``self.update_layers()``.
237
259
"""
238
260
# Clear combobox
261
+ print ("Feat on update layers" )
239
262
for dim in ["x" , "y" ]:
240
263
while self ._selectors [dim ].count () > 0 :
241
264
self ._selectors [dim ].removeItem (0 )
242
265
# Add keys for newly selected layer
266
+ # pdb.set_trace()
243
267
self ._selectors [dim ].addItems (self ._get_valid_axis_keys ())
0 commit comments