Skip to content

Commit

Permalink
fix support for multiple file/objects across multiple viewers
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Aug 18, 2023
1 parent c0c66f3 commit 8d44ea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion jdaviz/configs/imviz/plugins/footprints/footprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,12 @@ def overlay_regions(self):
for k in ('ra', 'dec', 'pa', 'v2_offset', 'v3_offset')}

if self.preset_selected == 'From File...':
regs = self.preset.selected_obj
# we need to cache these locally in order to support multiple files/regions between
# different overlay entries all selecting From File...
overlay = self._overlays.get(self.overlay_selected, {})
if 'regions' not in overlay and isinstance(self.preset.selected_obj, regions.Regions):
overlay['regions'] = self.preset.selected_obj
regs = overlay.get('regions')
elif self.preset_selected in preset_regions._instruments:
regs = preset_regions.jwst_footprint(self.preset_selected, **callable_kwargs)
else:
Expand Down
5 changes: 3 additions & 2 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ def _on_file_path_changed(self, event):

def import_file(self, path):
"""
Select 'From File...' and set the path
Select 'From File...' and set the path.
"""
# NOTE: this will trigger self._from_file_changed which in turn will
# pass through the parser, raise an error if necessary, and set
Expand All @@ -856,12 +856,13 @@ def import_file(self, path):

def import_obj(self, obj):
"""
Import a supported object directly from the API.
"""
msg, self._cached_obj = self._file_parser(obj)
if msg:
raise ValueError(msg)
self.selected = 'From File...'
self.from_file = list(self._cached_obj.keys())[0]
self.selected = 'From File...'


class HasFileImportSelect(VuetifyTemplate, HubListener):
Expand Down

0 comments on commit 8d44ea1

Please sign in to comment.