Skip to content

Commit

Permalink
Catch case with no sound devices and set plugin to disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
javerbukh committed Dec 12, 2024
1 parent 8172cdd commit b552edc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions jdaviz/configs/cubeviz/plugins/sonify_data/sonify_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion jdaviz/configs/cubeviz/plugins/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit b552edc

Please sign in to comment.