fixed some deprecation in offset paths

This commit is contained in:
leyghisbb 2021-04-06 17:00:57 +02:00
parent 745d533574
commit 788e3cc4fb

View File

@ -9,7 +9,7 @@ import pyclipper
class ofsplot(inkex.Effect): class ofsplot(inkex.Effect):
def __init__(self): def __init__(self):
inkex.Effect.__init__(self) inkex.Effect.__init__(self)
self.arg_parser.add_argument("--count", type=int, default=10, help="Number of offset operations") self.arg_parser.add_argument("--count", type=int, default=10, help="Number of offset paths")
self.arg_parser.add_argument("--offset", type=float, default=2.0, help="Offset amount") self.arg_parser.add_argument("--offset", type=float, default=2.0, help="Offset amount")
self.arg_parser.add_argument("--init_offset", type=float, default=2.0, help="Initial Offset Amount") self.arg_parser.add_argument("--init_offset", type=float, default=2.0, help="Initial Offset Amount")
self.arg_parser.add_argument("--copy_org", type=inkex.Boolean, default=True, help="copy original path") self.arg_parser.add_argument("--copy_org", type=inkex.Boolean, default=True, help="copy original path")
@ -19,9 +19,9 @@ class ofsplot(inkex.Effect):
self.arg_parser.add_argument("--clipperscale", type=float, default=1024.0, help="Scaling factor") self.arg_parser.add_argument("--clipperscale", type=float, default=1024.0, help="Scaling factor")
def effect(self): def effect(self):
paths = self.svg.get_selected(inkex.PathElement) paths = self.svg.selection.filter(inkex.PathElement).values()
count = sum(1 for path in paths) count = sum(1 for path in paths)
paths = self.svg.get_selected(inkex.PathElement) #we need to call this twice because the sum function consumes the generator paths = self.svg.selection.filter(inkex.PathElement).values() #we need to call this twice because the sum function consumes the generator
if count == 0: if count == 0:
inkex.errormsg("No paths selected.") inkex.errormsg("No paths selected.")
exit() exit()