Skip to content

Commit

Permalink
use @with_spinner from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Nov 27, 2023
1 parent e3e666b commit 0c30fa8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions lcviz/plugins/binning/binning.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from jdaviz.core.registries import tray_registry
from jdaviz.core.template_mixin import (PluginTemplateMixin,
DatasetSelectMixin, AddResultsMixin,
skip_if_no_updates_since_last_active)
skip_if_no_updates_since_last_active,
with_spinner)
from jdaviz.core.user_api import PluginUserApi

from lcviz.events import EphemerisChangedMessage
Expand Down Expand Up @@ -50,7 +51,6 @@ class Binning(PluginTemplateMixin, DatasetSelectMixin, EphemerisSelectMixin, Add

last_live_time = Float(0).tag(sync=True)
previews_temp_disable = Bool(False).tag(sync=True)
spinner = Bool(False).tag(sync=True)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -213,8 +213,8 @@ def _on_ephemeris_update(self, msg):

self._live_update()

@with_spinner()
def bin(self, add_data=True):
self.spinner = True
if self.n_bins == '' or self.n_bins <= 0:
raise ValueError("n_bins must be a positive integer")

Expand Down Expand Up @@ -260,7 +260,6 @@ def bin(self, add_data=True):
# by resetting x_att, the preview marks may have dissappeared
self._live_update()

self.spinner = False
return lc

def vue_apply(self, event={}):
Expand Down
7 changes: 3 additions & 4 deletions lcviz/plugins/flatten/flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from jdaviz.core.registries import tray_registry
from jdaviz.core.template_mixin import (PluginTemplateMixin,
DatasetSelectMixin, AddResultsMixin,
skip_if_no_updates_since_last_active)
skip_if_no_updates_since_last_active,
with_spinner)
from jdaviz.core.user_api import PluginUserApi

from lcviz.marks import LivePreviewTrend, LivePreviewFlattened
Expand Down Expand Up @@ -60,7 +61,6 @@ class Flatten(PluginTemplateMixin, DatasetSelectMixin, AddResultsMixin):

last_live_time = Float(0).tag(sync=True)
previews_temp_disable = Bool(False).tag(sync=True)
spinner = Bool(False).tag(sync=True)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -121,6 +121,7 @@ def _set_default_results_label(self, event={}):
else:
self.results_label_default = f"{self.dataset_selected} (flattened)"

@with_spinner()
def flatten(self, add_data=True):
"""
Flatten the input light curve (``dataset``) using lightkurve.flatten.
Expand All @@ -138,7 +139,6 @@ def flatten(self, add_data=True):
trend_lc : `~lightkurve.LightCurve`
The trend used to flatten the light curve.
"""
self.spinner = True
input_lc = self.dataset.selected_obj
if input_lc is None: # pragma: no cover
raise ValueError("no input dataset selected")
Expand All @@ -161,7 +161,6 @@ def flatten(self, add_data=True):
data = _data_with_reftime(self.app, output_lc)
self.add_results.add_results_from_plugin(data)

self.spinner = False
return output_lc, trend_lc

def _clear_marks(self):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers = [
]
dependencies = [
"astropy>=5.2",
"jdaviz>=3.7.1",
"jdaviz>=3.8",
"lightkurve@git+https://github.com/lightkurve/lightkurve", # until https://github.com/lightkurve/lightkurve/pull/1342 is in a release (anything after 2.4.0)
]
dynamic = [
Expand Down

0 comments on commit 0c30fa8

Please sign in to comment.