From eada4bed7eb5cf8671eed8e208889db88552815b Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Wed, 20 Mar 2019 22:43:54 -0400 Subject: don't let simulator preview thread crash --- lib/gui/simulator.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/gui/simulator.py') diff --git a/lib/gui/simulator.py b/lib/gui/simulator.py index e0d78983..c601ab66 100644 --- a/lib/gui/simulator.py +++ b/lib/gui/simulator.py @@ -699,7 +699,14 @@ class SimulatorPreview(Thread): self.update_patches() def update_patches(self): - patches = self.parent.generate_patches(self.refresh_needed) + try: + patches = self.parent.generate_patches(self.refresh_needed) + except: + # If something goes wrong when rendering patches, it's not great, + # but we don't really want the simulator thread to crash. Instead, + # just swallow the exception and abort. It'll show up when they + # try to actually embroider the shape. + return if patches and not self.refresh_needed.is_set(): stitch_plan = patches_to_stitch_plan(patches) -- cgit v1.2.3 From af6588a4426c0998fa51daf29d9b8f8f983bb0dd Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 24 Mar 2019 14:50:49 -0400 Subject: 'fix' style --- lib/gui/simulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/gui/simulator.py') diff --git a/lib/gui/simulator.py b/lib/gui/simulator.py index c601ab66..6a2a08a9 100644 --- a/lib/gui/simulator.py +++ b/lib/gui/simulator.py @@ -701,7 +701,7 @@ class SimulatorPreview(Thread): def update_patches(self): try: patches = self.parent.generate_patches(self.refresh_needed) - except: + except: # noqa: E722 # If something goes wrong when rendering patches, it's not great, # but we don't really want the simulator thread to crash. Instead, # just swallow the exception and abort. It'll show up when they -- cgit v1.2.3