Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support deleting all viewers without crashing app #2745

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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