summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2019-02-15 20:51:10 -0500
committerLex Neva <github.com@lexneva.name>2019-02-16 16:53:38 -0500
commitbe7d0af82da95d64261351b6281153db1944c0b4 (patch)
tree3ef502baf31583bbda92841291105443d659c532 /lib/elements
parent4c7f8f32fd13cb41680efe9b9d478fab23dacfa0 (diff)
improve error message when trying to autofill tiny shapes
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/auto_fill.py56
1 files changed, 36 insertions, 20 deletions
diff --git a/lib/elements/auto_fill.py b/lib/elements/auto_fill.py
index 486243ea..55292212 100644
--- a/lib/elements/auto_fill.py
+++ b/lib/elements/auto_fill.py
@@ -1,7 +1,9 @@
import math
+import traceback
from shapely import geometry as shgeo
+from ..exceptions import InkstitchException
from ..i18n import _
from ..stitches import auto_fill
from ..utils import cache
@@ -156,27 +158,41 @@ class AutoFill(Fill):
starting_point = self.get_starting_point(last_patch)
ending_point = self.get_ending_point()
- if self.fill_underlay:
- stitches.extend(auto_fill(self.underlay_shape,
- self.fill_underlay_angle,
- self.fill_underlay_row_spacing,
- self.fill_underlay_row_spacing,
- self.fill_underlay_max_stitch_length,
+ try:
+ if self.fill_underlay:
+ stitches.extend(auto_fill(self.underlay_shape,
+ self.fill_underlay_angle,
+ self.fill_underlay_row_spacing,
+ self.fill_underlay_row_spacing,
+ self.fill_underlay_max_stitch_length,
+ self.running_stitch_length,
+ self.staggers,
+ self.fill_underlay_skip_last,
+ starting_point))
+ starting_point = stitches[-1]
+
+ stitches.extend(auto_fill(self.fill_shape,
+ self.angle,
+ self.row_spacing,
+ self.end_row_spacing,
+ self.max_stitch_length,
self.running_stitch_length,
self.staggers,
- self.fill_underlay_skip_last,
- starting_point))
- starting_point = stitches[-1]
-
- stitches.extend(auto_fill(self.fill_shape,
- self.angle,
- self.row_spacing,
- self.end_row_spacing,
- self.max_stitch_length,
- self.running_stitch_length,
- self.staggers,
- self.skip_last,
- starting_point,
- ending_point))
+ self.skip_last,
+ starting_point,
+ ending_point))
+ except InkstitchException, exc:
+ # for one of our exceptions, just print the message
+ self.fatal(_("Unable to autofill: ") + str(exc))
+ except Exception, exc:
+ # for an uncaught exception, give a little more info so that they can create a bug report
+ message = ""
+ message += _("Error during autofill! This means that there is a problem with Ink/Stitch.")
+ message += "\n\n"
+ message += _("If you'd like to help us make Ink/Stitch better, please paste this whole message into a new issue at: https://github.com/inkstitch/inkstitch/issues/new")
+ message += "\n\n"
+ message += traceback.format_exc()
+
+ self.fatal(message)
return [Patch(stitches=stitches, color=self.color)]