diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2021-03-04 18:40:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-04 18:40:53 +0100 |
| commit | e84a86d4ac0caf29d6074728376ff0a594243fec (patch) | |
| tree | 888c79ed0094ba2916a1d329861a85515959913c /inkstitch.py | |
| parent | b39575a50191307b3b56eab6455626398eec6397 (diff) | |
Update for Inkscape 1.0 (#880)
* update for inkscape 1.0
* add about extension
* Build improvements for the inkscape1.0 branch (#985)
* zip: export real svg not stitch plan
* #411 and #726
* Tools for Font Creators (#1018)
* ignore very small holes in fills
* remove embroider (#1026)
* auto_fill: ignore shrink_or_grow if result is empty (#589)
* break apart: do not ignore small fills
Co-authored-by: Hagen Fritsch <rumpeltux-github@irgendwo.org>
Co-authored-by: Lex Neva <github.com@lexneva.name>
Diffstat (limited to 'inkstitch.py')
| -rw-r--r-- | inkstitch.py | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/inkstitch.py b/inkstitch.py index 58d0f434..13eab809 100644 --- a/inkstitch.py +++ b/inkstitch.py @@ -3,12 +3,15 @@ import os import sys import traceback from argparse import ArgumentParser -from cStringIO import StringIO +from io import StringIO + +from inkex import errormsg +from lxml.etree import XMLSyntaxError import lib.debug as debug from lib import extensions from lib.i18n import _ -from lib.utils import restore_stderr, save_stderr +from lib.utils import restore_stderr, save_stderr, version logger = logging.getLogger('shapely.geos') logger.setLevel(logging.DEBUG) @@ -36,28 +39,35 @@ extension_class = getattr(extensions, extension_class_name) extension = extension_class() if hasattr(sys, 'gettrace') and sys.gettrace(): - extension.affect(args=remaining_args) + extension.run(args=remaining_args) else: save_stderr() exception = None try: - extension.affect(args=remaining_args) + extension.run(args=remaining_args) except (SystemExit, KeyboardInterrupt): raise + except XMLSyntaxError: + msg = _("Ink/Stitch cannot read your SVG file. " + "This is often the case when you use a file which has been created with Adobe Illustrator.") + msg += "\n\n" + msg += _("Try to import the file into Inkscape through 'File > Import...' (Ctrl+I)") + errormsg(msg) except Exception: exception = traceback.format_exc() finally: restore_stderr() if shapely_errors.tell(): - print >> sys.stderr, shapely_errors.getvalue() + errormsg(shapely_errors.getvalue()) if exception: - print >> sys.stderr, _("Ink/Stitch experienced an unexpected error.").encode("UTF-8") - print >> sys.stderr, _("If you'd like to help, please file an issue at " - "https://github.com/inkstitch/inkstitch/issues " - "and include the entire error description below:").encode("UTF-8"), "\n" - print >> sys.stderr, exception + errormsg(_("Ink/Stitch experienced an unexpected error.") + "\n") + errormsg(_("If you'd like to help, please file an issue at " + "https://github.com/inkstitch/inkstitch/issues " + "and include the entire error description below:") + "\n") + errormsg(version.get_inkstitch_version() + "\n") + errormsg(exception) sys.exit(1) else: sys.exit(0) |
