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 /lib/extensions/import_threadlist.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 'lib/extensions/import_threadlist.py')
| -rw-r--r-- | lib/extensions/import_threadlist.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/extensions/import_threadlist.py b/lib/extensions/import_threadlist.py index d31c0d69..029043c2 100644 --- a/lib/extensions/import_threadlist.py +++ b/lib/extensions/import_threadlist.py @@ -12,20 +12,23 @@ from .base import InkstitchExtension class ImportThreadlist(InkstitchExtension): def __init__(self, *args, **kwargs): InkstitchExtension.__init__(self, *args, **kwargs) - self.OptionParser.add_option("-f", "--filepath", type="str", default="", dest="filepath") - self.OptionParser.add_option("-m", "--method", type="int", default=1, dest="method") - self.OptionParser.add_option("-t", "--palette", type="str", default=None, dest="palette") + self.arg_parser.add_argument("-f", "--filepath", type=str, default="", dest="filepath") + self.arg_parser.add_argument("-m", "--method", type=int, default=1, dest="method") + self.arg_parser.add_argument("-t", "--palette", type=str, default=None, dest="palette") def effect(self): # Remove selection, we want all the elements in the document - self.selected = {} + self.svg.selected.clear() if not self.get_elements(): return path = self.options.filepath if not os.path.exists(path): - print >> sys.stderr, _("File not found.") + inkex.errormsg(_("File not found.")) + sys.exit(1) + if os.path.isdir(path): + inkex.errormsg(_("The filepath specified is not a file but a dictionary.\nPlease choose a threadlist file to import.")) sys.exit(1) method = self.options.method @@ -35,11 +38,11 @@ class ImportThreadlist(InkstitchExtension): colors = self.parse_threadlist_by_catalog_number(path) if all(c is None for c in colors): - print >>sys.stderr, _("Couldn't find any matching colors in the file.") + inkex.errormsg(_("Couldn't find any matching colors in the file.")) if method == 1: - print >>sys.stderr, _('Please try to import as "other threadlist" and specify a color palette below.') + inkex.errormsg(_('Please try to import as "other threadlist" and specify a color palette below.')) else: - print >>sys.stderr, _("Please chose an other color palette for your design.") + inkex.errormsg(_("Please chose an other color palette for your design.")) sys.exit(1) # Iterate through the color blocks to apply colors |
