From b552edc0776a0ab9d7635fb792f2744de995931f Mon Sep 17 00:00:00 2001 From: Jesse Averbukh Date: Thu, 12 Dec 2024 11:21:07 -0500 Subject: [PATCH] Catch case with no sound devices and set plugin to disabled --- jdaviz/configs/cubeviz/plugins/sonify_data/sonify_data.py | 5 +++-- jdaviz/configs/cubeviz/plugins/tools.py | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jdaviz/configs/cubeviz/plugins/sonify_data/sonify_data.py b/jdaviz/configs/cubeviz/plugins/sonify_data/sonify_data.py index e11152e50b..18f7d70876 100644 --- a/jdaviz/configs/cubeviz/plugins/sonify_data/sonify_data.py +++ b/jdaviz/configs/cubeviz/plugins/sonify_data/sonify_data.py @@ -54,10 +54,11 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._plugin_description = 'Sonify a data cube' self.docs_description = 'Sonify a data cube using the Strauss package.' - if not self.has_strauss: + if not self.has_strauss or len(sd.default.device) < 1: self.disabled_msg = ('To use Sonify Data, install strauss and restart Jdaviz. You ' 'can do this by running `pip install .[strauss]` in the command' - ' line and then launching Jdaviz.') + ' line and then launching Jdaviz. Currently, this plugin only works' + 'on devices with valid sound output.') else: devices, indexes = self.build_device_lists() diff --git a/jdaviz/configs/cubeviz/plugins/tools.py b/jdaviz/configs/cubeviz/plugins/tools.py index 93b6f09248..2def272785 100644 --- a/jdaviz/configs/cubeviz/plugins/tools.py +++ b/jdaviz/configs/cubeviz/plugins/tools.py @@ -11,7 +11,6 @@ from jdaviz.core.tools import PanZoom, BoxZoom, _MatchedZoomMixin from jdaviz.configs.default.plugins.tools import ProfileFromCube - __all__ = [] ICON_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'data', 'icons')