def _on_widget_moved(self, widget): parameter = self._reverse_lookup_position_widget(widget) es = EventSupressor() for w in self._position_widgets[parameter]: es.add((w.events.moved, w._set_position)) with es.suppress(): parameter.value = widget.position[0]
def suspend_update(self, update_on_resume=True): """Prevents plot from updating until 'with' clause completes. See Also -------- update_plot """ es = EventSupressor() es.add(self.axes_manager.events.indices_changed) if self._model_line: f = self._model_line.update for c in self: es.add(c.events, f) for p in c.parameters: es.add(p.events, f) for c in self: if hasattr(c, '_model_plot_line'): f = c._model_plot_line.update es.add(c.events, f) for p in c.parameters: es.add(p.events, f) old = self._suspend_update self._suspend_update = True with es.suppress(): yield self._suspend_update = old if update_on_resume is True: self.update_plot()