diff --git a/lcviz/plugins/binning/binning.py b/lcviz/plugins/binning/binning.py index f2440404..24d2348b 100644 --- a/lcviz/plugins/binning/binning.py +++ b/lcviz/plugins/binning/binning.py @@ -1,5 +1,3 @@ -import numpy as np -from time import time from astropy.time import Time from traitlets import Bool, Float, observe from glue.config import data_translator @@ -10,7 +8,7 @@ from jdaviz.core.template_mixin import (PluginTemplateMixin, DatasetSelectMixin, AddResultsMixin, skip_if_no_updates_since_last_active, - with_spinner) + with_spinner, with_temp_disable) from jdaviz.core.user_api import PluginUserApi from lcviz.components import FluxColumnSelectMixin @@ -54,9 +52,6 @@ class Binning(PluginTemplateMixin, FluxColumnSelectMixin, DatasetSelectMixin, n_bins = IntHandleEmpty(100).tag(sync=True) bin_enabled = Bool(True).tag(sync=True) - last_live_time = Float(0).tag(sync=True) - previews_temp_disable = Bool(False).tag(sync=True) - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -164,8 +159,9 @@ def _toggle_marks(self, event={}): @observe('flux_column_selected', 'dataset_selected', 'ephemeris_selected', - 'n_bins', 'previews_temp_disable') + 'n_bins', 'previews_temp_disabled') @skip_if_no_updates_since_last_active() + @with_temp_disable(timeout=0.3) def _live_update(self, event={}): self.bin_enabled = self.n_bins != '' and self.n_bins > 0 @@ -173,11 +169,6 @@ def _live_update(self, event={}): self._clear_marks() return - if self.previews_temp_disable: - return - - start = time() - if event.get('name', '') not in ('is_active', 'show_live_preview'): # mark visibility hasn't been handled yet self._toggle_marks() @@ -214,10 +205,6 @@ def _live_update(self, event={}): mark.times = [] mark.update_xy(times, lc.flux.value) - self.last_live_time = np.round(time() - start, 2) - if self.last_live_time > 0.3: - self.previews_temp_disable = True - def _on_ephemeris_update(self, msg): if not self.show_live_preview or not self.is_active: return diff --git a/lcviz/plugins/binning/binning.vue b/lcviz/plugins/binning/binning.vue index c280da46..6bad2b59 100644 --- a/lcviz/plugins/binning/binning.vue +++ b/lcviz/plugins/binning/binning.vue @@ -57,23 +57,11 @@ - - Live-updating is temporarily disabled (last update took {{last_live_time}}s) - - - - disable previews - - - - - - - update preview - - - - + 0.3: - self.previews_temp_disable = True - def vue_apply(self, *args, **kwargs): try: self.flatten(add_data=True) diff --git a/lcviz/plugins/flatten/flatten.vue b/lcviz/plugins/flatten/flatten.vue index 191df121..be51f402 100644 --- a/lcviz/plugins/flatten/flatten.vue +++ b/lcviz/plugins/flatten/flatten.vue @@ -138,23 +138,12 @@ hint="Label for flux column." > - - Live-updating is temporarily disabled (last update took {{last_live_time}}s) - - - - disable previews - - - - - - - update preview - - - - +