Skip to content

Commit 7c43222

Browse files
committed
Finish most of API implementation
1 parent 27bc041 commit 7c43222

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

astrowidgets/bqplot.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ def __init__(self, *args, image_width=500, image_height=500):
414414
self._wcs = None
415415
self._is_marking = False
416416

417+
self.scroll_pan = True
417418
# Use this to manage whether or not to send changes in zoom level
418419
# to the viewer.
419420
self._zoom_source_is_gui = False
@@ -422,6 +423,10 @@ def __init__(self, *args, image_width=500, image_height=500):
422423
# updating the zoom.
423424
self._updating_zoom = False
424425

426+
# Provide an Output widget to which prints can be directed for
427+
# debugging.
428+
self._print_out = ipw.Output()
429+
425430
self.marker = {'color': 'red', 'radius': 20, 'type': 'square'}
426431
self.cuts = apviz.AsymmetricPercentileInterval(1, 99)
427432

@@ -776,15 +781,6 @@ def set_colormap(self, cmap_name, reverse=False):
776781
def colormap_options(self):
777782
return pyplot.colormaps()
778783

779-
# # Marker-related methods
780-
# @abstractmethod
781-
# def start_marking(self):
782-
# raise NotImplementedError
783-
784-
# @abstractmethod
785-
# def stop_marking(self):
786-
# raise NotImplementedError
787-
788784
def _validate_marker_name(self, marker_name):
789785
if marker_name in self.RESERVED_MARKER_SET_NAMES:
790786
raise ValueError(
@@ -818,11 +814,12 @@ def add_markers(self, table, x_colname='x', y_colname='y',
818814
# the same name to be plotted at once.
819815
marks = self.get_markers_by_name(marker_name)
820816

821-
self._astro_im.plot_named_markers(marks['x'], marks['y'],
822-
marker_name,
823-
color=self.marker['color'],
824-
size=self.marker['radius']**2,
825-
style=self.marker['type'])
817+
if marks:
818+
self._astro_im.plot_named_markers(marks['x'], marks['y'],
819+
marker_name,
820+
color=self.marker['color'],
821+
size=self.marker['radius']**2,
822+
style=self.marker['type'])
826823

827824
def remove_markers_by_name(self, marker_name):
828825
# Remove from our tracking table
@@ -1020,3 +1017,13 @@ def restore_and_clear_cached_state(self):
10201017
self.click_drag = self._cached_state['click_drag']
10211018
self.scroll_pan = self._cached_state['scroll_pan']
10221019
self._cached_state = {}
1020+
1021+
@property
1022+
def print_out(self):
1023+
"""
1024+
Return an output widget for display in the notebook which
1025+
captures any printed output produced by the viewer widget.
1026+
1027+
Intended primarily for debugging.
1028+
"""
1029+
return self._print_out

0 commit comments

Comments
 (0)