From 078f38230e61b61a666cda81214be561010c6b2c Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 13:39:45 -0500 Subject: [PATCH 01/17] remove __getstate__ in abstract_data_source.py --- chaco/abstract_data_source.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) 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 From 374549509a5cc95d9bef49f8a4dff4ad633b5bc6 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 13:46:15 -0500 Subject: [PATCH 02/17] remove __getstate__ from axis.py --- chaco/axis.py | 64 +++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 46 deletions(-) diff --git a/chaco/axis.py b/chaco/axis.py index e321014e4..0d667621c 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) From b7f7210154085b1a5733d9bb9ac92a8f7cdaadeb Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 13:59:02 -0500 Subject: [PATCH 03/17] remove __getstate__ from grid.py --- chaco/grid.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/chaco/grid.py b/chaco/grid.py index d3af7f32c..79c6f02ae 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) From 72700bb6d53a629734f773b41c0812d36ed52316 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:00:21 -0500 Subject: [PATCH 04/17] remove __getstate__ from base_xy_plot.py --- chaco/base_xy_plot.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) 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: From 77c0e59196e6d9d1ee07ccca5286c75ed58e75a1 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:02:26 -0500 Subject: [PATCH 05/17] remove __getstate__ from cross_plot_frame.py, also delete commented out _pickle code --- chaco/cross_plot_frame.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) 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 From 80a16b97b15e10e80733c8ed7b6027d68ac7149d Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:03:08 -0500 Subject: [PATCH 06/17] remove __getstate__ from lineplot.py --- chaco/lineplot.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/chaco/lineplot.py b/chaco/lineplot.py index c904e7817..ff6d12d40 100644 --- a/chaco/lineplot.py +++ b/chaco/lineplot.py @@ -449,14 +449,6 @@ def _line_width_changed(self): self.invalidate_draw() self.request_redraw() - 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 From fae52fad11656dadff9770acd0f3b4d25efdac77 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:03:35 -0500 Subject: [PATCH 07/17] remove __getstate__ from multi_line_plot.py --- chaco/multi_line_plot.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/chaco/multi_line_plot.py b/chaco/multi_line_plot.py index 46e3c1a4b..0583df3f4 100644 --- a/chaco/multi_line_plot.py +++ b/chaco/multi_line_plot.py @@ -528,11 +528,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 From c7c93abc5f0207f97662e056fc7226fa8b4335ca Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:12:16 -0500 Subject: [PATCH 08/17] remove __getstate__ from tools/simple_zoom.py --- chaco/tools/simple_zoom.py | 45 +++++++++----------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/chaco/tools/simple_zoom.py b/chaco/tools/simple_zoom.py index 3d08951f2..5957d1178 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 From f38cbcc41abcf915aa8c6c7578f4db84f9c0812b Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:21:06 -0500 Subject: [PATCH 09/17] remove __getstate__ from simple_plot_frame.py --- chaco/simple_plot_frame.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) 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 From eeea9650b7279c62425c696e89a6664f8d6220d1 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:23:41 -0500 Subject: [PATCH 10/17] remove __getstate__ from abstract_mapper.py (_cache_valid is not a trait on the class) --- chaco/abstract_mapper.py | 7 ------- 1 file changed, 7 deletions(-) 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 From 6fc674f24ff4daf9cb9f33220f1219df67e3eb93 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:36:33 -0500 Subject: [PATCH 11/17] fix array_data_source.py __getstate__ and its tests --- chaco/array_data_source.py | 2 +- chaco/tests/test_arraydatasource.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/chaco/array_data_source.py b/chaco/array_data_source.py index 0b4a5992a..7c6acae35 100644 --- a/chaco/array_data_source.py +++ b/chaco/array_data_source.py @@ -301,7 +301,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/tests/test_arraydatasource.py b/chaco/tests/test_arraydatasource.py index 02c4df286..366aad8c0 100644 --- a/chaco/tests/test_arraydatasource.py +++ b/chaco/tests/test_arraydatasource.py @@ -231,8 +231,17 @@ 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") + + #@unittest.skip("persist_data probably shouldn't be persisted") def test_serialization_state_no_persist(self): self.data_source.persist_data = False @@ -247,7 +256,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): From ba66fc8fa49f54c78e04e1fe31bf2894c2acd4f3 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:41:48 -0500 Subject: [PATCH 12/17] update plot_containers.py --- chaco/plot_containers.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) 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): """ From 2152d9bc148198cc346d4e2717804c68875bca84 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:42:26 -0500 Subject: [PATCH 13/17] delete commented out test skip --- chaco/tests/test_arraydatasource.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/chaco/tests/test_arraydatasource.py b/chaco/tests/test_arraydatasource.py index 366aad8c0..6f409d8b5 100644 --- a/chaco/tests/test_arraydatasource.py +++ b/chaco/tests/test_arraydatasource.py @@ -240,8 +240,6 @@ def test_serialization_state(self): ]: 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 From a984b40d5ac4d08e241468855c7647b24b47dc89 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 7 Apr 2021 14:56:19 -0500 Subject: [PATCH 14/17] delete _pickles commented out code --- chaco/base_plot_frame.py | 1 - 1 file changed, 1 deletion(-) 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) From 6bfb91299a7bb4f3442a5e2850adcde108b3c9ba Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Tue, 13 Apr 2021 10:19:43 -0500 Subject: [PATCH 15/17] make all private cache related traits transient (might be overrkill) --- chaco/base_1d_mapper.py | 2 +- chaco/base_1d_plot.py | 12 ++++++------ chaco/base_contour_plot.py | 4 ++-- chaco/cmap_image_plot.py | 4 ++-- chaco/contour_line_plot.py | 8 ++++---- chaco/contour_poly_plot.py | 4 ++-- chaco/image_data.py | 4 ++-- chaco/image_plot.py | 6 +++--- chaco/label.py | 2 +- chaco/scatterplot.py | 10 +++++----- chaco/text_plot.py | 6 +++--- chaco/text_plot_1d.py | 6 +++--- 12 files changed, 34 insertions(+), 34 deletions(-) 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 8b41cf710..74e4161ce 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 327933f53..6e98c2c2d 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/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/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 34ec3c4d7..bc0a296db 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/scatterplot.py b/chaco/scatterplot.py index 0ff6c9baf..51220eee8 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/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 From 55893e013226bf14c1486f1c0b198c127e261383 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Thu, 15 Apr 2021 07:18:35 -0700 Subject: [PATCH 16/17] fix merge conflict issues --- chaco/tools/simple_zoom.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/chaco/tools/simple_zoom.py b/chaco/tools/simple_zoom.py index 18d5fe15e..46ccb2f13 100644 --- a/chaco/tools/simple_zoom.py +++ b/chaco/tools/simple_zoom.py @@ -38,7 +38,6 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): #: Perform a "box" selection on two axes. tool_mode = Enum("box", "range") -<<<<<<< HEAD # 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, transient=True) @@ -46,15 +45,6 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): # 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", transient=True) -======= - #: 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) - - #: 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") ->>>>>>> master # ------------------------------------------------------------------------- # Zoom control @@ -78,7 +68,6 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): #: Conversion ratio from wheel steps to zoom factors. wheel_zoom_step = Float(1.0) -<<<<<<< HEAD # 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",), transient=True) @@ -86,40 +75,20 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): # 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",), transient=True) -======= - #: 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",)) - - #: 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",)) ->>>>>>> master #: Disable the tool after the zoom is completed? disable_on_complete = Bool(True) -<<<<<<< HEAD # The minimum amount of screen space the user must select in order for # the tool to actually take effect. minimum_screen_delta = Int(10, transient=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) ->>>>>>> master # ------------------------------------------------------------------------- # Appearance properties (for Box mode) # ------------------------------------------------------------------------- -<<<<<<< HEAD # The pointer to use when drawing a zoom box. pointer = Str("magnifier", transient=True) -======= - #: The pointer to use when drawing a zoom box. - pointer = "magnifier" ->>>>>>> master #: The color of the selection box. color = ColorTrait("lightskyblue") @@ -138,13 +107,8 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): #: The thickness of selection rectangle border. border_size = Int(1) -<<<<<<< HEAD # The possible event states of this zoom tool. event_state = Enum("normal", "selecting", transient=True) -======= - #: The possible event states of this zoom tool. - event_state = Enum("normal", "selecting") ->>>>>>> master # ------------------------------------------------------------------------ # Key mappings From f3395f08b3db6ad57c40f3dc87125c6751aae3b9 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Thu, 15 Apr 2021 07:43:17 -0700 Subject: [PATCH 17/17] bring back #: --- chaco/tools/simple_zoom.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/chaco/tools/simple_zoom.py b/chaco/tools/simple_zoom.py index 46ccb2f13..b60e44060 100644 --- a/chaco/tools/simple_zoom.py +++ b/chaco/tools/simple_zoom.py @@ -38,12 +38,12 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): #: Perform a "box" selection on two axes. tool_mode = Enum("box", "range") - # 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. + #: 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, 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. + #: 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", transient=True) # ------------------------------------------------------------------------- @@ -68,26 +68,26 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): #: Conversion ratio from wheel steps to zoom factors. wheel_zoom_step = Float(1.0) - # The key press to enter zoom mode, if **always_on** is False. Has no effect - # if **always_on** is True. + #: 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",), transient=True) - # The key press to leave zoom mode, if **always_on** is False. Has no effect - # if **always_on** is 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",), 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. + #: The minimum amount of screen space the user must select in order for + #: the tool to actually take effect. minimum_screen_delta = Int(10, transient=True) # ------------------------------------------------------------------------- # Appearance properties (for Box mode) # ------------------------------------------------------------------------- - # The pointer to use when drawing a zoom box. + #: The pointer to use when drawing a zoom box. pointer = Str("magnifier", transient=True) #: The color of the selection box. @@ -107,7 +107,7 @@ class SimpleZoom(AbstractOverlay, ToolHistoryMixin, BaseZoomTool): #: The thickness of selection rectangle border. border_size = Int(1) - # The possible event states of this zoom tool. + #: The possible event states of this zoom tool. event_state = Enum("normal", "selecting", transient=True) # ------------------------------------------------------------------------