Skip to content

Commit a8f7cbd

Browse files
committed
Make constants class variables
1 parent 62f6b97 commit a8f7cbd

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

astrowidgets/ginga.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323

2424
__all__ = ['ImageWidget']
2525

26-
# Allowed locations for cursor display
27-
ALLOWED_CURSOR_LOCATIONS = ['top', 'bottom', None]
28-
29-
# List of marker names that are for internal use only
30-
RESERVED_MARKER_SET_NAMES = ['all']
31-
3226

3327
class ImageWidget(ipyw.VBox):
3428
"""
@@ -55,6 +49,11 @@ class ImageWidget(ipyw.VBox):
5549
correct value to use.*
5650
5751
"""
52+
# Allowed locations for cursor display
53+
ALLOWED_CURSOR_LOCATIONS = ('top', 'bottom', None)
54+
55+
# List of marker names that are for internal use only
56+
RESERVED_MARKER_SET_NAMES = ('all', )
5857

5958
def __init__(self, logger=None, image_width=500, image_height=500,
6059
pixel_coords_offset=0, **kwargs):
@@ -648,11 +647,11 @@ def _validate_marker_name(self, marker_name):
648647
"""
649648
Raise an error if the marker_name is not allowed.
650649
"""
651-
if marker_name in RESERVED_MARKER_SET_NAMES:
650+
if marker_name in self.RESERVED_MARKER_SET_NAMES:
652651
raise ValueError('The marker name {} is not allowed. Any name is '
653652
'allowed except these: '
654653
'{}'.format(marker_name,
655-
', '.join(RESERVED_MARKER_SET_NAMES)))
654+
', '.join(self.RESERVED_MARKER_SET_NAMES)))
656655

657656
def add_markers(self, table, x_colname='x', y_colname='y',
658657
skycoord_colname='coord', use_skycoord=False,
@@ -888,7 +887,7 @@ def cursor(self, val):
888887
else:
889888
raise ValueError('Invalid value {} for cursor.'
890889
'Valid values are: '
891-
'{}'.format(val, ALLOWED_CURSOR_LOCATIONS))
890+
'{}'.format(val, self.ALLOWED_CURSOR_LOCATIONS))
892891
self._cursor = val
893892

894893
@property

astrowidgets/interface_definition.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ class ImageViewerInterface(Protocol):
3030
stretch: str
3131
# viewer: Any
3232

33+
# Allowed locations for cursor display
34+
ALLOWED_CURSOR_LOCATIONS = ('top', 'bottom', None)
35+
36+
# List of marker names that are for internal use only
37+
RESERVED_MARKER_SET_NAMES = ('all')
38+
3339
# The methods, grouped loosely by purpose
3440

3541
# Methods for loading data

0 commit comments

Comments
 (0)