helpful error message for empty path "d" attribute (fixes #220)

also internationalizes "error:" string
pull/301/head
Lex Neva 2018-08-24 21:20:59 -04:00
rodzic ff86bff9ed
commit 7bf8c2d871
2 zmienionych plików z 24 dodań i 4 usunięć

Wyświetl plik

@ -197,7 +197,11 @@ class EmbroideryElement(object):
# In a path, each element in the 3-tuple is itself a tuple of (x, y).
# Tuples all the way down. Hasn't anyone heard of using classes?
return cubicsuperpath.parsePath(self.node.get("d"))
d = self.node.get("d", "")
if not d:
self.fatal(_("Object %(id)s has an empty 'd' attribute. Please delete this object from your document.") % dict(id=self.node.get("id")))
return cubicsuperpath.parsePath(d)
@cache
def parse_path(self):
@ -264,5 +268,7 @@ class EmbroideryElement(object):
return patches
def fatal(self, message):
print >> sys.stderr, "error:", message
# L10N used when showing an error message to the user such as "satin column: One or more of the rungs doesn't
# intersect both rails."
print >> sys.stderr, _("error:"), message
sys.exit(1)

Wyświetl plik

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2018-08-24 20:56-0400\n"
"POT-Creation-Date: 2018-08-24 21:20-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -178,11 +178,25 @@ msgid ""
"shapes."
msgstr ""
#: lib/elements/element.py:230
#: lib/elements/element.py:202
#, python-format
msgid ""
"Object %(id)s has an empty 'd' attribute. Please delete this object from"
" your document."
msgstr ""
#: lib/elements/element.py:234
#, python-format
msgid "%(id)s has more than one command of type '%(command)s' linked to it"
msgstr ""
#. used when showing an error message to the user such as "satin column: One or
#. more of the rungs doesn't
#. intersect both rails."
#: lib/elements/element.py:273
msgid "error:"
msgstr ""
#: lib/elements/fill.py:12
msgid "Fill"
msgstr ""