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/cleanup.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/cleanup.py')
| -rw-r--r-- | lib/extensions/cleanup.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/extensions/cleanup.py b/lib/extensions/cleanup.py index e06b4bea..f1965aba 100644 --- a/lib/extensions/cleanup.py +++ b/lib/extensions/cleanup.py @@ -1,6 +1,4 @@ -import sys - -from inkex import NSS +from inkex import NSS, Boolean, errormsg from ..elements import Fill, Stroke from ..i18n import _ @@ -10,10 +8,10 @@ from .base import InkstitchExtension class Cleanup(InkstitchExtension): def __init__(self, *args, **kwargs): InkstitchExtension.__init__(self, *args, **kwargs) - self.OptionParser.add_option("-f", "--rm_fill", dest="rm_fill", type="inkbool", default=True) - self.OptionParser.add_option("-s", "--rm_stroke", dest="rm_stroke", type="inkbool", default=True) - self.OptionParser.add_option("-a", "--fill_threshold", dest="fill_threshold", type="int", default=20) - self.OptionParser.add_option("-l", "--stroke_threshold", dest="stroke_threshold", type="int", default=5) + self.arg_parser.add_argument("-f", "--rm_fill", dest="rm_fill", type=Boolean, default=True) + self.arg_parser.add_argument("-s", "--rm_stroke", dest="rm_stroke", type=Boolean, default=True) + self.arg_parser.add_argument("-a", "--fill_threshold", dest="fill_threshold", type=int, default=20) + self.arg_parser.add_argument("-l", "--stroke_threshold", dest="stroke_threshold", type=int, default=5) def effect(self): self.rm_fill = self.options.rm_fill @@ -21,8 +19,7 @@ class Cleanup(InkstitchExtension): self.fill_threshold = self.options.fill_threshold self.stroke_threshold = self.options.stroke_threshold - # Remove selection, we want every element in the document - self.selected = {} + self.svg.selected.clear() count = 0 svg = self.document.getroot() @@ -32,7 +29,7 @@ class Cleanup(InkstitchExtension): count += 1 if not self.get_elements(): - print >> sys.stderr, _("%s elements removed" % count) + errormsg(_("%s elements removed" % count)) return for element in self.elements: @@ -44,4 +41,4 @@ class Cleanup(InkstitchExtension): element.node.getparent().remove(element.node) count += 1 - print >> sys.stderr, _("%s elements removed" % count) + errormsg(_("%s elements removed" % count)) |
