Skip to content

Commit

Permalink
Merge pull request #2745 from kecnry/empty-viewer-select
Browse files Browse the repository at this point in the history
support deleting all viewers without crashing app
  • Loading branch information
pllim authored Mar 8, 2024
2 parents b86d854 + 117f2a5 commit 324c96f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jdaviz/configs/default/plugins/plot_options/plot_options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
:hint="viewer_multiselect ? 'Select viewers to set options simultaneously' : 'Select the viewer to set options.'"
/>

<v-row>
<v-row v-if="viewer_selected.length > 0">
<v-expansion-panels accordion>
<v-expansion-panel>
<v-expansion-panel-header v-slot="{ open }">
Expand Down Expand Up @@ -159,7 +159,7 @@
</div>

<!-- GENERAL:AXES -->
<glue-state-sync-wrapper v-if="axes_visible_sync.in_subscribed_states && config !== 'imviz'" :sync="axes_visible_sync" :multiselect="viewer_multiselect" @unmix-state="unmix_state('axes_visible')">
<glue-state-sync-wrapper v-if="axes_visible_sync.in_subscribed_states && viewer_selected.length > 0 && config !== 'imviz'" :sync="axes_visible_sync" :multiselect="viewer_multiselect" @unmix-state="unmix_state('axes_visible')">
<v-switch
v-model="axes_visible_value"
label="Show Axes"
Expand Down
4 changes: 4 additions & 0 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2680,6 +2680,8 @@ def _get_selected_item(self, selected):

@property
def selected_id(self):
if self.selected_item is None:
return None
return self.selected_item.get('id', None)

@property
Expand Down Expand Up @@ -3582,6 +3584,8 @@ def _state_item(item):
@cached_property
def subscribed_icons(self):
# dictionary items giving information about the entries in subscribed_states
if self._viewer_select.selected_item is None:
return []
viewer_icons = self._viewer_select.selected_item.get('icon', [])
if not isinstance(viewer_icons, list):
viewer_icons = [viewer_icons]
Expand Down

0 comments on commit 324c96f

Please sign in to comment.