diff --git a/lcviz/plugins/viewer_creator/viewer_creator.py b/lcviz/plugins/viewer_creator/viewer_creator.py index 8830e8be..d33a533e 100644 --- a/lcviz/plugins/viewer_creator/viewer_creator.py +++ b/lcviz/plugins/viewer_creator/viewer_creator.py @@ -25,7 +25,8 @@ def _rebuild_available_viewers(self, *args): phase_viewers = [{'name': f'lcviz-phase-viewer:{e}', 'label': f'flux-vs-phase:{e}'} for e in self.app._jdaviz_helper.plugins['Ephemeris'].component.choices] # noqa else: - phase_viewers = [] + phase_viewers = [{'name': 'lcviz-phase-viewer:default', + 'label': 'flux-vs-phase:default'}] self.viewer_types = [v for v in self.viewer_types if v['name'].startswith('lcviz') and not v['label'].startswith('flux-vs-phase')] + phase_viewers diff --git a/lcviz/tests/test_plugin_ephemeris.py b/lcviz/tests/test_plugin_ephemeris.py index 303ecf1d..dea97b68 100644 --- a/lcviz/tests/test_plugin_ephemeris.py +++ b/lcviz/tests/test_plugin_ephemeris.py @@ -118,9 +118,9 @@ def test_create_phase_viewer(helper, light_curve_like_kepler_quarter): ephem = helper.plugins['Ephemeris'] vc = helper._tray_tools['lcviz-viewer-creator'] - assert len(vc.viewer_types) == 1 # just time viewer + assert len(vc.viewer_types) == 2 # time viewer, phase viewer for default _ = ephem.create_phase_viewer() - assert len(vc.viewer_types) == 2 + assert len(ephem._obj._get_phase_viewers()) == 1 vc.vue_create_viewer('flux-vs-phase:default') assert len(ephem._obj._get_phase_viewers()) == 2 @@ -134,3 +134,6 @@ def test_create_phase_viewer(helper, light_curve_like_kepler_quarter): for pv in ephem._obj._get_phase_viewers(): assert pv._ephemeris_component == 'renamed' + + ephem.add_component('new') + assert len(vc.viewer_types) == 3