@@ -39,7 +39,6 @@ class ImageViewer:
39
39
_cursor : str = ImageViewerInterface .ALLOWED_CURSOR_LOCATIONS [0 ]
40
40
# marker style will be stored in catalog table metadata
41
41
_catalogs : dict [str , CatalogInfo ] = field (default_factory = dict )
42
- _default_marker_style : dict [str , Any ] = field (default_factory = dict )
43
42
_cuts : str | tuple [float , float ] = (0 , 1 )
44
43
_stretch : str = "linear"
45
44
# viewer: Any
@@ -54,10 +53,9 @@ class ImageViewer:
54
53
def __post_init__ (self ):
55
54
# This is a dictionary of marker sets. The keys are the names of the
56
55
# marker sets, and the values are the tables containing the markers.
57
- self ._default_marker_style = dict (shape = "circle" , color = "yellow" , size = 10 )
58
56
self ._catalogs = defaultdict (CatalogInfo )
59
57
self ._catalogs [None ].data = None
60
- self ._catalogs [None ].style = self ._default_marker_style .copy ()
58
+ self ._catalogs [None ].style = self ._default_catalog_style .copy ()
61
59
62
60
def _user_catalog_labels (self ) -> list [str ]:
63
61
"""
@@ -89,6 +87,17 @@ def _resolve_catalog_label(self, catalog_label: str | None) -> str:
89
87
90
88
return catalog_label
91
89
90
+ @property
91
+ def _default_catalog_style (self ) -> dict [str , Any ]:
92
+ """
93
+ The default style for the catalog markers.
94
+ """
95
+ return {
96
+ "shape" : "circle" ,
97
+ "color" : "red" ,
98
+ "size" : 5 ,
99
+ }
100
+
92
101
@property
93
102
def stretch (self ) -> str :
94
103
return self ._stretch
@@ -128,7 +137,7 @@ def cursor(self, value: str) -> None:
128
137
129
138
# The methods, grouped loosely by purpose
130
139
131
- def get_catalog_style (self , catalog_label = None ) -> dict [str , dict [ str , Any ] ]:
140
+ def get_catalog_style (self , catalog_label = None ) -> dict [str , Any ]:
132
141
"""
133
142
Get the style for the catalog.
134
143
@@ -151,9 +160,9 @@ def get_catalog_style(self, catalog_label=None) -> dict[str, dict[str, Any]]:
151
160
def set_catalog_style (
152
161
self ,
153
162
catalog_label : str | None = None ,
154
- shape : str = "" ,
155
- color : str = "" ,
156
- size : float = 0 ,
163
+ shape : str = "circle " ,
164
+ color : str = "red " ,
165
+ size : float = 5 ,
157
166
** kwargs
158
167
) -> None :
159
168
"""
@@ -172,9 +181,9 @@ def set_catalog_style(
172
181
**kwargs
173
182
Additional keyword arguments to pass to the marker style.
174
183
"""
175
- shape = shape if shape else self . _default_marker_style [ "shape" ]
176
- color = color if color else self . _default_marker_style [ "color" ]
177
- size = size if size else self . _default_marker_style [ "size" ]
184
+ shape = shape
185
+ color = color
186
+ size = size
178
187
179
188
catalog_label = self ._resolve_catalog_label (catalog_label )
180
189
@@ -305,11 +314,12 @@ def load_catalog(self, table: Table, x_colname: str = 'x', y_colname: str = 'y',
305
314
self ._catalogs [catalog_label ].data = vstack ([old_table , to_add ])
306
315
else :
307
316
self ._catalogs [catalog_label ].data = to_add
308
-
317
+ breakpoint ()
309
318
if catalog_style is None :
310
- catalog_style = self ._default_marker_style .copy ()
311
-
312
- self ._catalogs [catalog_label ].style = catalog_style
319
+ if self ._catalogs [catalog_label ].style is None :
320
+ catalog_style = self ._default_catalog_style .copy ()
321
+ else :
322
+ self ._catalogs [catalog_label ].style = catalog_style
313
323
314
324
load_catalog .__doc__ = ImageViewerInterface .load_catalog .__doc__
315
325
0 commit comments