From 05ca4132f17a581939fd0b206319f215248e5232 Mon Sep 17 00:00:00 2001 From: George Steel Date: Sat, 27 Apr 2024 14:16:18 -0400 Subject: Add option to disable the stitch plan cache (#2655) Setting the cache size to 0 bypasses the cache completely. This is necessary during development to ensure newly-changed code actually gets run. Also fixes the error pane in the params gui. * make params warning pane large enough to see contents * rename sizers in preferences dialog descriptive names * add shapely version bound * add option to disable stitch plan cache * remove out-of-date wxg file * make a cache size of 0 disable the cache --- lib/elements/element.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/elements/element.py') diff --git a/lib/elements/element.py b/lib/elements/element.py index c9d7c377..ae0ff5c6 100644 --- a/lib/elements/element.py +++ b/lib/elements/element.py @@ -22,7 +22,7 @@ from ..svg import (PIXELS_PER_MM, apply_transforms, convert_length, get_node_transform) from ..svg.tags import INKSCAPE_LABEL, INKSTITCH_ATTRIBS from ..utils import Point, cache -from ..utils.cache import CacheKeyGenerator, get_stitch_plan_cache +from ..utils.cache import get_stitch_plan_cache, is_cache_disabled, CacheKeyGenerator class Param(object): @@ -496,6 +496,9 @@ class EmbroideryElement(object): @debug.time def _load_cached_stitch_groups(self, previous_stitch): + if is_cache_disabled(): + return None + if not self.uses_previous_stitch(): # we don't care about the previous stitch previous_stitch = None @@ -519,6 +522,9 @@ class EmbroideryElement(object): @debug.time def _save_cached_stitch_groups(self, stitch_groups, previous_stitch): + if is_cache_disabled(): + return + stitch_plan_cache = get_stitch_plan_cache() cache_key = self.get_cache_key(previous_stitch) if cache_key not in stitch_plan_cache: -- cgit v1.2.3