|
26 | 26 | from matplotlib import is_interactive |
27 | 27 | from matplotlib.backends.backend_webagg_core import (FigureManagerWebAgg, |
28 | 28 | FigureCanvasWebAggCore, |
29 | | - NavigationToolbar2WebAgg) |
| 29 | + NavigationToolbar2WebAgg, |
| 30 | + TimerTornado) |
30 | 31 | from matplotlib.backend_bases import (ShowBase, NavigationToolbar2, |
31 | | - TimerBase, FigureCanvasBase) |
| 32 | + FigureCanvasBase) |
32 | 33 |
|
33 | 34 |
|
34 | 35 | class Show(ShowBase): |
@@ -185,38 +186,6 @@ def remove_comm(self, comm_id): |
185 | 186 | if not socket.comm.comm_id == comm_id]) |
186 | 187 |
|
187 | 188 |
|
188 | | -class TimerTornado(TimerBase): |
189 | | - def _timer_start(self): |
190 | | - self._timer_stop() |
191 | | - if self._single: |
192 | | - ioloop = tornado.ioloop.IOLoop.instance() |
193 | | - self._timer = ioloop.add_timeout( |
194 | | - datetime.timedelta(milliseconds=self.interval), |
195 | | - self._on_timer) |
196 | | - else: |
197 | | - self._timer = tornado.ioloop.PeriodicCallback( |
198 | | - self._on_timer, |
199 | | - self.interval) |
200 | | - self._timer.start() |
201 | | - |
202 | | - def _timer_stop(self): |
203 | | - if self._timer is None: |
204 | | - return |
205 | | - elif self._single: |
206 | | - ioloop = tornado.ioloop.IOLoop.instance() |
207 | | - ioloop.remove_timeout(self._timer) |
208 | | - else: |
209 | | - self._timer.stop() |
210 | | - |
211 | | - self._timer = None |
212 | | - |
213 | | - def _timer_set_interval(self): |
214 | | - # Only stop and restart it if the timer has already been started |
215 | | - if self._timer is not None: |
216 | | - self._timer_stop() |
217 | | - self._timer_start() |
218 | | - |
219 | | - |
220 | 189 | class FigureCanvasNbAgg(FigureCanvasWebAggCore): |
221 | 190 | def new_timer(self, *args, **kwargs): |
222 | 191 | return TimerTornado(*args, **kwargs) |
|
0 commit comments