Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4fbf6ac

Browse files
authored
make set_feature, reset_feature public (#308)
1 parent f7fa645 commit 4fbf6ac

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

fastplotlib/graphics/_base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ class Interaction(ABC):
166166
"""Mixin class that makes graphics interactive"""
167167

168168
@abstractmethod
169-
def _set_feature(self, feature: str, new_data: Any, indices: Any):
169+
def set_feature(self, feature: str, new_data: Any, indices: Any):
170170
pass
171171

172172
@abstractmethod
173-
def _reset_feature(self, feature: str):
173+
def reset_feature(self, feature: str):
174174
pass
175175

176176
def link(
@@ -312,14 +312,14 @@ def _event_handler(self, event):
312312
# the real world object in the pick_info and not the proxy
313313
if wo is event.pick_info["world_object"]:
314314
indices = i
315-
target_info.target._set_feature(
315+
target_info.target.set_feature(
316316
feature=target_info.feature,
317317
new_data=target_info.new_data,
318318
indices=indices,
319319
)
320320
else:
321321
# if target is a single graphic, then indices do not matter
322-
target_info.target._set_feature(
322+
target_info.target.set_feature(
323323
feature=target_info.feature,
324324
new_data=target_info.new_data,
325325
indices=None,

fastplotlib/graphics/image.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,10 @@ def __init__(
304304
# set it with the actual data
305305
self.data = data
306306

307-
def _set_feature(self, feature: str, new_data: Any, indices: Any):
307+
def set_feature(self, feature: str, new_data: Any, indices: Any):
308308
pass
309309

310-
def _reset_feature(self, feature: str):
310+
def reset_feature(self, feature: str):
311311
pass
312312

313313

@@ -500,8 +500,8 @@ def vmax(self, value: float):
500500
"""Maximum contrast limit."""
501501
self._material.clim = (self._material.clim[0], value)
502502

503-
def _set_feature(self, feature: str, new_data: Any, indices: Any):
503+
def set_feature(self, feature: str, new_data: Any, indices: Any):
504504
pass
505505

506-
def _reset_feature(self, feature: str):
506+
def reset_feature(self, feature: str):
507507
pass

fastplotlib/graphics/line.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ def _get_linear_selector_init_args(self, padding: float, **kwargs):
281281
def _add_plot_area_hook(self, plot_area):
282282
self._plot_area = plot_area
283283

284-
def _set_feature(self, feature: str, new_data: Any, indices: Any = None):
284+
def set_feature(self, feature: str, new_data: Any, indices: Any = None):
285285
if not hasattr(self, "_previous_data"):
286286
self._previous_data = dict()
287287
elif hasattr(self, "_previous_data"):
288-
self._reset_feature(feature)
288+
self.reset_feature(feature)
289289

290290
feature_instance = getattr(self, feature)
291291
if indices is not None:
@@ -302,7 +302,7 @@ def _set_feature(self, feature: str, new_data: Any, indices: Any = None):
302302
data=previous, indices=indices
303303
)
304304

305-
def _reset_feature(self, feature: str):
305+
def reset_feature(self, feature: str):
306306
if feature not in self._previous_data.keys():
307307
return
308308

fastplotlib/graphics/line_collection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def _get_linear_selector_init_args(self, padding, **kwargs):
415415
def _add_plot_area_hook(self, plot_area):
416416
self._plot_area = plot_area
417417

418-
def _set_feature(self, feature: str, new_data: Any, indices: Any):
418+
def set_feature(self, feature: str, new_data: Any, indices: Any):
419419
# if single value force to be an array of size 1
420420
if isinstance(indices, (np.integer, int)):
421421
indices = np.array([indices])
@@ -429,7 +429,7 @@ def _set_feature(self, feature: str, new_data: Any, indices: Any):
429429
if self._previous_data[feature].indices == indices:
430430
return # nothing to change, and this allows bidirectional linking without infinite recursion
431431

432-
self._reset_feature(feature)
432+
self.reset_feature(feature)
433433

434434
# coll_feature = getattr(self[indices], feature)
435435

@@ -455,7 +455,7 @@ def _set_feature(self, feature: str, new_data: Any, indices: Any):
455455
# since calling `feature._set()` triggers all the feature callbacks
456456
feature_instance._set(new_data)
457457

458-
def _reset_feature(self, feature: str):
458+
def reset_feature(self, feature: str):
459459
if feature not in self._previous_data.keys():
460460
return
461461

0 commit comments

Comments
 (0)