diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2023-02-16 22:58:10 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-16 22:58:10 -0500 |
| commit | 7aee0979be4f39cde7a6396cdc0d1d2cc4222d90 (patch) | |
| tree | 1123050a6ba7428dbcc8b72bd074161bdb3e014f /lib/stitches/auto_run.py | |
| parent | 30c73dc39c1ac814d0c63ec102c7f8c2b993fdd0 (diff) | |
| parent | f6c2aa89197c82cedfb31465fc4b2acffaeb8f25 (diff) | |
Merge pull request #2045 from inkstitch/lexelby/interruptible-threads
make simulator threads interruptible
Diffstat (limited to 'lib/stitches/auto_run.py')
| -rw-r--r-- | lib/stitches/auto_run.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/stitches/auto_run.py b/lib/stitches/auto_run.py index ff26eb16..82c7fc7e 100644 --- a/lib/stitches/auto_run.py +++ b/lib/stitches/auto_run.py @@ -21,6 +21,7 @@ from .utils.autoroute import (add_elements_to_group, add_jumps, get_starting_and_ending_nodes, preserve_original_groups, remove_original_elements) +from ..utils.threading import check_stop_flag class LineSegments: @@ -59,9 +60,13 @@ class LineSegments: self._lines.append(line) self._elements.append(element) + check_stop_flag() + def _get_intersection_points(self): for i, line1 in enumerate(self._lines): for j in range(i + 1, len(self._lines)): + check_stop_flag() + line2 = self._lines[j] distance = line1.distance(line2) if distance > 50: @@ -169,6 +174,8 @@ def build_graph(elements, preserve_order, break_up): # any direction, so we add the edge in the opposite direction too. graph.add_edge(str(end), str(start), element=element) + check_stop_flag() + return graph @@ -199,6 +206,8 @@ def path_to_elements(graph, path, trim): # noqa: C901 just_trimmed = False el = None for start, end, direction in path: + check_stop_flag() + element = graph[start][end].get('element') start_coord = graph.nodes[start]['point'] end_coord = graph.nodes[end]['point'] |
