diff --git a/chaco/abstract_data_source.py b/chaco/abstract_data_source.py index 426872043..0cfb7c21d 100644 --- a/chaco/abstract_data_source.py +++ b/chaco/abstract_data_source.py @@ -26,12 +26,12 @@ class AbstractDataSource(HasTraits): #: The dimensionality of the value at each index point. #: Subclasses re-declare this trait as a read-only trait with #: the right default value. - value_dimension = DimensionTrait + value_dimension = DimensionTrait(transient=True) #: The dimensionality of the indices into this data source. #: Subclasses re-declare this trait as a read-only trait with #: the right default value. - index_dimension = DimensionTrait + index_dimension = DimensionTrait(transient=True) #: A dictionary keyed on strings. In general, it maps to indices (or tuples #: of indices, depending on **value_dimension**), as in the case of @@ -51,7 +51,7 @@ class AbstractDataSource(HasTraits): #: Should the data that this datasource refers to be serialized when #: the datasource is serialized? - persist_data = Bool(True) + persist_data = Bool(True, transient=True) # ------------------------------------------------------------------------ # Abstract methods @@ -118,13 +118,3 @@ def get_bounds(self): def _metadata_default(self): return {"selections": [], "annotations": []} - - def __getstate__(self): - state = super(AbstractDataSource, self).__getstate__() - - # everything but 'metadata' - for key in ["value_dimension", "index_dimension", "persist_data"]: - if key in state: - del state[key] - - return state diff --git a/chaco/abstract_mapper.py b/chaco/abstract_mapper.py index d4ff84da7..e7d765fb6 100644 --- a/chaco/abstract_mapper.py +++ b/chaco/abstract_mapper.py @@ -49,13 +49,6 @@ def map_data_array(self, screen_vals): # ------------------------------------------------------------------------ # Persistence-related methods # ------------------------------------------------------------------------ - def __getstate__(self): - state = super(AbstractMapper, self).__getstate__() - for key in ["_cache_valid"]: - if key in state: - del state[key] - - return state def _post_load(self): self._cache_valid = False diff --git a/chaco/array_data_source.py b/chaco/array_data_source.py index 37c6ce404..19858c428 100644 --- a/chaco/array_data_source.py +++ b/chaco/array_data_source.py @@ -294,7 +294,7 @@ def _metadata_items_changed(self, event): # ------------------------------------------------------------------------ def __getstate__(self): - state = self.__dict__.copy() + state = super(ArrayDataSource, self).__getstate__() if not self.persist_data: state.pop("_data", None) state.pop("_cached_mask", None) diff --git a/chaco/axis.py b/chaco/axis.py index 97b79db53..3d4b43936 100644 --- a/chaco/axis.py +++ b/chaco/axis.py @@ -177,24 +177,24 @@ class PlotAxis(AbstractOverlay): # Cached position calculations - _tick_list = List # These are caches of their respective positions - _tick_positions = ArrayOrNone() - _tick_label_list = ArrayOrNone() - _tick_label_positions = ArrayOrNone() - _tick_label_bounding_boxes = List - _major_axis_size = Float - _minor_axis_size = Float - _major_axis = Array - _title_orientation = Array - _title_angle = Float - _origin_point = Array - _inside_vector = Array - _axis_vector = Array - _axis_pixel_vector = Array - _end_axis_point = Array - - ticklabel_cache = List - _cache_valid = Bool(False) + _tick_list = List(transient=True) # These are caches of their respective positions + _tick_positions = ArrayOrNone(transient=True) + _tick_label_list = ArrayOrNone(transient=True) + _tick_label_positions = ArrayOrNone(transient=True) + _tick_label_bounding_boxes = List(transient=True) + _major_axis_size = Float(transient=True) + _minor_axis_size = Float(transient=True) + _major_axis = Array(transient=True) + _title_orientation = Array(transient=True) + _title_angle = Float(transient=True) + _origin_point = Array(transient=True) + _inside_vector = Array(transient=True) + _axis_vector = Array(transient=True) + _axis_pixel_vector = Array(transient=True) + _end_axis_point = Array(transient=True) + + ticklabel_cache = List(transient=True) + _cache_valid = Bool(False, transient=True) # ------------------------------------------------------------------------ # Public methods @@ -831,34 +831,6 @@ def _title_angle_default(self): # Persistence-related methods # ------------------------------------------------------------------------ - def __getstate__(self): - dont_pickle = [ - "_tick_list", - "_tick_positions", - "_tick_label_list", - "_tick_label_positions", - "_tick_label_bounding_boxes", - "_major_axis_size", - "_minor_axis_size", - "_major_axis", - "_title_orientation", - "_title_angle", - "_origin_point", - "_inside_vector", - "_axis_vector", - "_axis_pixel_vector", - "_end_axis_point", - "_ticklabel_cache", - "_cache_valid", - ] - - state = super(PlotAxis, self).__getstate__() - for key in dont_pickle: - if key in state: - del state[key] - - return state - def __setstate__(self, state): super(PlotAxis, self).__setstate__(state) self._mapper_changed(None, self.mapper) diff --git a/chaco/base_1d_mapper.py b/chaco/base_1d_mapper.py index af62f3efa..ff4fc0ace 100644 --- a/chaco/base_1d_mapper.py +++ b/chaco/base_1d_mapper.py @@ -37,7 +37,7 @@ class Base1DMapper(AbstractMapper): # If the subclass uses a cache, _cache_valid is maintained to # monitor its status - _cache_valid = Bool(False) + _cache_valid = Bool(False, transient=True) # Indicates whether or not the bounds have been set at all, or if they # are at their initial default values. diff --git a/chaco/base_1d_plot.py b/chaco/base_1d_plot.py index 18932eff3..71315f698 100644 --- a/chaco/base_1d_plot.py +++ b/chaco/base_1d_plot.py @@ -64,22 +64,22 @@ class Base1DPlot(AbstractPlotRenderer): # ------------------------------------------------------------------------ #: flag whether the data cache is valid - _cache_valid = Bool(False) + _cache_valid = Bool(False, transient=True) #: cache of the index values in data space - _cached_data = Any() + _cached_data = Any(transient=True) #: cache of the sorted index values in data space - _cached_data_pts_sorted = Any() + _cached_data_pts_sorted = Any(transient=True) #: cache of the sorted indices of the index values - _cached_data_argsort = Any() + _cached_data_argsort = Any(transient=True) #: flag whether the screen coordinates are valid - _screen_cache_valid = Bool(False) + _screen_cache_valid = Bool(False, transient=True) #: cache holding the screen coordinates of the index values - _cached_screen_pts = Any() + _cached_screen_pts = Any(transient=True) # ------------------------------------------------------------------------ # AbstractPlotRenderer interface diff --git a/chaco/base_contour_plot.py b/chaco/base_contour_plot.py index 800f220c7..c2181f8ee 100644 --- a/chaco/base_contour_plot.py +++ b/chaco/base_contour_plot.py @@ -54,10 +54,10 @@ class BaseContourPlot(Base2DPlot): # ------------------------------------------------------------------------ # Is the cached level data valid? - _level_cache_valid = Bool(False) + _level_cache_valid = Bool(False, transient=True) # Is the cached color data valid? - _colors_cache_valid = Bool(False) + _colors_cache_valid = Bool(False, transient=True) # List of levels and their associated line properties. _levels = List diff --git a/chaco/base_plot_frame.py b/chaco/base_plot_frame.py index 33c5f746f..aadaf3010 100644 --- a/chaco/base_plot_frame.py +++ b/chaco/base_plot_frame.py @@ -154,7 +154,6 @@ def __setattr__(self, name, value): super(BasePlotFrame, self).__setattr__(name, value) ### Persistence ########################################################### - # _pickles = ("_frame_slots", "_components", "fit_components", "fit_window") def post_load(self, path=None): super(BasePlotFrame, self).post_load(path) diff --git a/chaco/base_xy_plot.py b/chaco/base_xy_plot.py index d39351c09..cfe77b4f4 100644 --- a/chaco/base_xy_plot.py +++ b/chaco/base_xy_plot.py @@ -121,18 +121,18 @@ class BaseXYPlot(AbstractPlotRenderer): # ------------------------------------------------------------------------ # Are the cache traits valid? If False, new ones need to be compute. - _cache_valid = Bool(False) + _cache_valid = Bool(False, transient=True) # Cached array of (x,y) data-space points; regardless of self.orientation, # these points are always stored as (index_pt, value_pt). - _cached_data_pts = Array + _cached_data_pts = Array(transient=True) # Cached array of (x,y) screen-space points. - _cached_screen_pts = Array + _cached_screen_pts = Array(transient=True) # Does **_cached_screen_pts** contain the screen-space coordinates # of the points currently in **_cached_data_pts**? - _screen_cache_valid = Bool(False) + _screen_cache_valid = Bool(False, transient=True) # Reference to a spatial subdivision acceleration structure. _subdivision = Any @@ -721,19 +721,6 @@ def _use_subdivision_changed(self, old, new): # Persistence # ------------------------------------------------------------------------ - def __getstate__(self): - state = super(BaseXYPlot, self).__getstate__() - for key in [ - "_cache_valid", - "_cached_data_pts", - "_screen_cache_valid", - "_cached_screen_pts", - ]: - if key in state: - del state[key] - - return state - def __setstate__(self, state): super(BaseXYPlot, self).__setstate__(state) if self.index is not None: diff --git a/chaco/cmap_image_plot.py b/chaco/cmap_image_plot.py index 69e36742f..8306d9378 100644 --- a/chaco/cmap_image_plot.py +++ b/chaco/cmap_image_plot.py @@ -52,10 +52,10 @@ class CMapImagePlot(ImagePlot): # ------------------------------------------------------------------------ # Is the mapped image valid? - _mapped_image_cache_valid = Bool(False) + _mapped_image_cache_valid = Bool(False, transient=True) # Cache of the fully mapped RGB(A) image. - _cached_mapped_image = Any + _cached_mapped_image = Any(transient=True) # ------------------------------------------------------------------------ # Public methods diff --git a/chaco/contour_line_plot.py b/chaco/contour_line_plot.py index 7851cd792..fc9ccb767 100644 --- a/chaco/contour_line_plot.py +++ b/chaco/contour_line_plot.py @@ -46,16 +46,16 @@ class ContourLinePlot(BaseContourPlot): # ------------------------------------------------------------------------ # Are the cached contours valid? If False, new ones need to be computed. - _contour_cache_valid = Bool(False) + _contour_cache_valid = Bool(False, transient=True) # Cached collection of traces. - _cached_contours = Dict + _cached_contours = Dict(transient=True) # Is the cached width data valid? - _widths_cache_valid = Bool(False) + _widths_cache_valid = Bool(False, transient=True) # Is the cached style data valid? - _styles_cache_valid = Bool(False) + _styles_cache_valid = Bool(False, transient=True) # Cached list of line widths _widths = List diff --git a/chaco/contour_poly_plot.py b/chaco/contour_poly_plot.py index df6c7edb9..9b82f31bf 100644 --- a/chaco/contour_poly_plot.py +++ b/chaco/contour_poly_plot.py @@ -24,10 +24,10 @@ class ContourPolyPlot(BaseContourPlot): # ------------------------------------------------------------------------ # Are the cached contours valid? If False, new ones need to be computed. - _poly_cache_valid = Bool(False) + _poly_cache_valid = Bool(False, transient=True) # Cached collection of traces. - _cached_polys = Dict + _cached_polys = Dict(transient=True) # ------------------------------------------------------------------------ # Private methods diff --git a/chaco/cross_plot_frame.py b/chaco/cross_plot_frame.py index 366cc99fe..9c0530fd9 100644 --- a/chaco/cross_plot_frame.py +++ b/chaco/cross_plot_frame.py @@ -51,7 +51,7 @@ class CrossPlotFrame(BasePlotFrame): bottom_height = Float(50.0) # Does the component need to do a layout call? - _layout_needed = Bool(True) + _layout_needed = Bool(True, transient=True) def __init__(self, **kwtraits): bounds = kwtraits.pop("bounds", list(self.default_bounds)) @@ -152,15 +152,3 @@ def _do_layout(self): if "v" not in slot.resizable: slot.outer_height = preferred_size[1] slot.do_layout() - - ### Persistence ########################################################### - - # _pickles = ("left_width", "right_width", "top_height", "bottom_height") - - def __getstate__(self): - state = super(CrossPlotFrame, self).__getstate__() - for key in ["_layout_needed"]: - if key in state: - del state[key] - - return state diff --git a/chaco/grid.py b/chaco/grid.py index a1274eb7a..9ce504057 100644 --- a/chaco/grid.py +++ b/chaco/grid.py @@ -164,13 +164,13 @@ class PlotGrid(AbstractOverlay): # Private traits; mostly cached information # ------------------------------------------------------------------------ - _cache_valid = Bool(False) - _tick_list = Any - _tick_positions = Any + _cache_valid = Bool(False, transient=True) + _tick_list = Any(transient=True) + _tick_positions = Any(transient=True) # An array (N,2) of start,end positions in the transverse direction # i.e. the direction corresponding to self.orientation - _tick_extents = Any + _tick_extents = Any(transient=True) # _length = Float(0.0) @@ -444,19 +444,6 @@ def _orientation_changed(self): ### Persistence ########################################################### - def __getstate__(self): - state = super(PlotGrid, self).__getstate__() - for key in [ - "_cache_valid", - "_tick_list", - "_tick_positions", - "_tick_extents", - ]: - if key in state: - del state[key] - - return state - def _post_load(self): super(PlotGrid, self)._post_load() self._mapper_changed(None, self.mapper) diff --git a/chaco/image_data.py b/chaco/image_data.py index 8f3025c75..dbf8842d0 100644 --- a/chaco/image_data.py +++ b/chaco/image_data.py @@ -71,10 +71,10 @@ class ImageData(AbstractDataSource): _data = ImageTrait # Is the bounds cache valid? If False, it needs to be computed. - _bounds_cache_valid = Bool(False) + _bounds_cache_valid = Bool(False, transient=True) # Cached value of min and max as long as **data** doesn't change. - _bounds_cache = Tuple + _bounds_cache = Tuple(transient=True) # ------------------------------------------------------------------------ # Public methods diff --git a/chaco/image_plot.py b/chaco/image_plot.py index b8c33b336..7131d1843 100644 --- a/chaco/image_plot.py +++ b/chaco/image_plot.py @@ -76,14 +76,14 @@ class ImagePlot(Base2DPlot): # ------------------------------------------------------------------------ # Are the cache traits valid? If False, new ones need to be computed. - _image_cache_valid = Bool(False) + _image_cache_valid = Bool(False, transient=True) # Cached image of the bmp data (not the bmp data in self.data.value). - _cached_image = Instance(GraphicsContextArray) + _cached_image = Instance(GraphicsContextArray, transient=True) # Tuple-defined rectangle (x, y, dx, dy) in screen space in which the # **_cached_image** is to be drawn. - _cached_dest_rect = Either(Tuple, List) + _cached_dest_rect = Either(Tuple, List, transient=True) # Bool indicating whether the origin is top-left or bottom-right. # The name "principal diagonal" is borrowed from linear algebra. diff --git a/chaco/label.py b/chaco/label.py index ce1a7fbed..19b4ed9f3 100644 --- a/chaco/label.py +++ b/chaco/label.py @@ -72,7 +72,7 @@ class Label(HasTraits): # ------------------------------------------------------------------------ _bounding_box = List() - _position_cache_valid = Bool(False) + _position_cache_valid = Bool(False, transient=True) _text_needs_fitting = Bool(False) _line_xpos = Any() _line_ypos = Any() diff --git a/chaco/lineplot.py b/chaco/lineplot.py index 2c0953d24..6a7861521 100644 --- a/chaco/lineplot.py +++ b/chaco/lineplot.py @@ -433,14 +433,6 @@ def _downsample_vectorized(self): d = z[:, 0] + z[:, 1] # ... TODO ... - def __getstate__(self): - state = super(LinePlot, self).__getstate__() - for key in ["traits_view"]: - if key in state: - del state[key] - - return state - @cached_property def _get_effective_color(self): alpha = self.color_[-1] if len(self.color_) == 4 else 1 diff --git a/chaco/multi_line_plot.py b/chaco/multi_line_plot.py index 8a95357dc..6b47476e4 100644 --- a/chaco/multi_line_plot.py +++ b/chaco/multi_line_plot.py @@ -512,11 +512,3 @@ def _amplitude_changed(self): self.value.data_changed = True self.invalidate_draw() self.request_redraw() - - def __getstate__(self): - state = super(MultiLinePlot, self).__getstate__() - for key in ["traits_view"]: - if key in state: - del state[key] - - return state diff --git a/chaco/plot_containers.py b/chaco/plot_containers.py index 41b288ed1..7b8bcada7 100644 --- a/chaco/plot_containers.py +++ b/chaco/plot_containers.py @@ -113,10 +113,10 @@ class StackedPlotContainer(BasePlotContainer): # The dimension along which to stack components that are added to # this container. - stack_dimension = Enum("h", "v") + stack_dimension = Enum("h", "v", transient=True) # The "other" dimension, i.e., the dual of the stack dimension. - other_dimension = Enum("v", "h") + other_dimension = Enum("v", "h", transient=True) # The index into obj.position and obj.bounds that corresponds to # **stack_dimension**. This is a class-level and not an instance-level @@ -281,9 +281,8 @@ def _do_stack_layout(self, components, align): # PICKLE FIXME: blocked with _pickles, but not sure that was correct. def __getstate__(self): state = super(StackedPlotContainer, self).__getstate__() - for key in ["stack_dimension", "other_dimension", "stack_index"]: - if key in state: - del state[key] + if "stack_index" in state: + del state["stack_index"] return state @@ -306,7 +305,7 @@ class HPlotContainer(StackedPlotContainer): #: The vertical alignment of objects that don't span the full height. valign = Enum("bottom", "top", "center") - _cached_preferred_size = Tuple + _cached_preferred_size = Tuple(transient=True) def _do_layout(self): """Actually performs a layout (called by do_layout()).""" @@ -324,15 +323,6 @@ def _do_layout(self): return self._do_stack_layout(components, align) - ### Persistence ########################################################### - - def __getstate__(self): - state = super(HPlotContainer, self).__getstate__() - for key in ["_cached_preferred_size"]: - if key in state: - del state[key] - return state - class VPlotContainer(StackedPlotContainer): """ diff --git a/chaco/scatterplot.py b/chaco/scatterplot.py index 5c5058fdf..5a3001d42 100644 --- a/chaco/scatterplot.py +++ b/chaco/scatterplot.py @@ -271,11 +271,11 @@ class ScatterPlot(BaseXYPlot): # Private traits # ------------------------------------------------------------------------ - _cached_selected_pts = ArrayOrNone - _cached_selected_screen_pts = Array - _cached_point_mask = Array - _cached_selection_point_mask = Array - _selection_cache_valid = Bool(False) + _cached_selected_pts = ArrayOrNone(transient=True) + _cached_selected_screen_pts = Array(transient=True) + _cached_point_mask = Array(transient=True) + _cached_selection_point_mask = Array(transient=True) + _selection_cache_valid = Bool(False, transient=True) # ------------------------------------------------------------------------ # Overridden PlotRenderer methods diff --git a/chaco/simple_plot_frame.py b/chaco/simple_plot_frame.py index 2ebc6a2a9..836591c5f 100644 --- a/chaco/simple_plot_frame.py +++ b/chaco/simple_plot_frame.py @@ -45,7 +45,7 @@ class SimplePlotFrame(BasePlotFrame): # ------------------------------------------------------------------------ # Does the component need to do a layout call? - _layout_needed = Bool(True) + _layout_needed = Bool(True, transient=True) def __init__(self, **kwtraits): # Delay setting the bounds until after base class initialization @@ -128,14 +128,3 @@ def _do_layout(self): component.outer_position = [0, 0] component.do_layout() - - ### Persistence ########################################################### - # _pickles = () - - def __getstate__(self): - state = super(SimplePlotFrame, self).__getstate__() - for key in ["_layout_needed"]: - if key in state: - del state[key] - - return state diff --git a/chaco/tests/test_arraydatasource.py b/chaco/tests/test_arraydatasource.py index ef25f2ce8..42fecc730 100644 --- a/chaco/tests/test_arraydatasource.py +++ b/chaco/tests/test_arraydatasource.py @@ -231,8 +231,15 @@ def test_serialization_state(self): self.assertNotIn("value_dimension", state) self.assertNotIn("index_dimension", state) self.assertNotIn("persist_data", state) + for key in [ + "_data", + "_cached_mask", + "_cached_bounds", + "_min_index", + "_max_index", + ]: + self.assertIn(key, state) - @unittest.skip("persist_data probably shouldn't be persisted") def test_serialization_state_no_persist(self): self.data_source.persist_data = False @@ -247,7 +254,7 @@ def test_serialization_state_no_persist(self): "_min_index", "_max_index", ]: - self.assertIn(key, state) + self.assertNotIn(key, state) @unittest.skip("I think this is just broken") def test_serialization_post_load(self): diff --git a/chaco/text_plot.py b/chaco/text_plot.py index 715924aae..810c8f587 100644 --- a/chaco/text_plot.py +++ b/chaco/text_plot.py @@ -49,13 +49,13 @@ class TextPlot(BaseXYPlot): # ------------------------------------------------------------------------ #: flag for whether the cache of Label instances is valid - _label_cache_valid = Bool(False) + _label_cache_valid = Bool(False, transient=True) #: cache of Label instances for faster rendering - _label_cache = List + _label_cache = List(transient=True) #: cache of bounding boxes of labels - _label_box_cache = List + _label_box_cache = List(transient=True) # ------------------------------------------------------------------------ # Private methods diff --git a/chaco/text_plot_1d.py b/chaco/text_plot_1d.py index 9b8dd5b23..430437059 100644 --- a/chaco/text_plot_1d.py +++ b/chaco/text_plot_1d.py @@ -56,13 +56,13 @@ class TextPlot1D(Base1DPlot): _text_position = Float #: flag for whether the cache of Label instances is valid - _label_cache_valid = Bool(False) + _label_cache_valid = Bool(False, transient=True) #: cache of Label instances for faster rendering - _label_cache = List + _label_cache = List(transient=True) #: cache of bounding boxes of labels - _label_box_cache = List + _label_box_cache = List(transient=True) # ------------------------------------------------------------------------ # Private methods diff --git a/chaco/tools/simple_zoom.py b/chaco/tools/simple_zoom.py index 94579c736..b60e44060 100644 --- a/chaco/tools/simple_zoom.py +++ b/chaco/tools/simple_zoom.py @@ -40,11 +40,11 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): #: Is the tool always "on"? If True, left-clicking always initiates #: a zoom operation; if False, the user must press a key to enter zoom mode. - always_on = Bool(False) + always_on = Bool(False, transient=True) #: Defines a meta-key, that works with always_on to set the zoom mode. This #: is useful when the zoom tool is used in conjunction with the pan tool. - always_on_modifier = Enum(None, "shift", "control", "alt") + always_on_modifier = Enum(None, "shift", "control", "alt", transient=True) # ------------------------------------------------------------------------- # Zoom control @@ -70,25 +70,25 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): #: The key press to enter zoom mode, if **always_on** is False. Has no effect #: if **always_on** is True. - enter_zoom_key = Instance(KeySpec, args=("z",)) + enter_zoom_key = Instance(KeySpec, args=("z",), transient=True) #: The key press to leave zoom mode, if **always_on** is False. Has no effect #: if **always_on** is True. - exit_zoom_key = Instance(KeySpec, args=("z",)) + exit_zoom_key = Instance(KeySpec, args=("z",), transient=True) #: Disable the tool after the zoom is completed? disable_on_complete = Bool(True) #: The minimum amount of screen space the user must select in order for #: the tool to actually take effect. - minimum_screen_delta = Int(10) + minimum_screen_delta = Int(10, transient=True) # ------------------------------------------------------------------------- # Appearance properties (for Box mode) # ------------------------------------------------------------------------- #: The pointer to use when drawing a zoom box. - pointer = "magnifier" + pointer = Str("magnifier", transient=True) #: The color of the selection box. color = ColorTrait("lightskyblue") @@ -108,7 +108,7 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): border_size = Int(1) #: The possible event states of this zoom tool. - event_state = Enum("normal", "selecting") + event_state = Enum("normal", "selecting", transient=True) # ------------------------------------------------------------------------ # Key mappings @@ -123,17 +123,17 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): # If **always_on** is False, this attribute indicates whether the tool # is currently enabled. - _enabled = Bool(False) + _enabled = Bool(False, transient=True) # the original numerical screen ranges _orig_low_setting = Trait(None, Tuple, Float, Str) _orig_high_setting = Trait(None, Tuple, Float, Str) # The (x,y) screen point where the mouse went down. - _screen_start = Trait(None, None, Tuple) + _screen_start = Trait(None, None, Tuple, transient=True) # The (x,,y) screen point of the last seen mouse move event. - _screen_end = Trait(None, None, Tuple) + _screen_end = Trait(None, None, Tuple, transient=True) def __init__(self, component=None, *args, **kw): # Support AbstractController-style constructors so that this can be @@ -647,28 +647,3 @@ def _next_state_pressed(self): to the next state. Implements ToolHistoryMixin. """ self._do_zoom() - - ### Persistence ########################################################### - - def __getstate__(self): - dont_pickle = [ - "always_on", - "always_on_modifier", - "enter_zoom_key", - "exit_zoom_key", - "minimum_screen_delta", - "event_state", - "reset_zoom_key", - "prev_zoom_key", - "next_zoom_key", - "pointer", - "_enabled", - "_screen_start", - "_screen_end", - ] - state = super(SimpleZoom, self).__getstate__() - for key in dont_pickle: - if key in state: - del state[key] - - return state