some fixes in pathops (copied from gitlab)

This commit is contained in:
leyghisbb 2021-04-09 16:31:33 +02:00
parent a9adc3d322
commit bb53681a4f

View File

@ -206,7 +206,7 @@ class PathOps(inkex.Effect):
def get_selected_ids(self): def get_selected_ids(self):
"""Return a list of valid ids for inkscape path operations.""" """Return a list of valid ids for inkscape path operations."""
id_list = [] id_list = []
if not len(self.svg.selected): if len(self.svg.selected) == 0:
pass pass
else: else:
# level = 0: unlimited recursion into groups # level = 0: unlimited recursion into groups
@ -346,14 +346,14 @@ class PathOps(inkex.Effect):
defs = get_defs(self.document.getroot()) defs = get_defs(self.document.getroot())
inkscape_tagrefs = defs.findall( inkscape_tagrefs = defs.findall(
"inkscape:tag/inkscape:tagref", namespaces=inkex.NSS) "inkscape:tag/inkscape:tagref", namespaces=inkex.NSS)
return True if len(inkscape_tagrefs) else False return len(inkscape_tagrefs) > 0
def update_tagrefs(self, mode='purge'): def update_tagrefs(self, mode='purge'):
"""Check tagrefs for deleted objects.""" """Check tagrefs for deleted objects."""
defs = get_defs(self.document.getroot()) defs = get_defs(self.document.getroot())
inkscape_tagrefs = defs.findall( inkscape_tagrefs = defs.findall(
"inkscape:tag/inkscape:tagref", namespaces=inkex.NSS) "inkscape:tag/inkscape:tagref", namespaces=inkex.NSS)
if len(inkscape_tagrefs): if len(inkscape_tagrefs) > 0:
for tagref in inkscape_tagrefs: for tagref in inkscape_tagrefs:
href = tagref.get(inkex.addNS('href', 'xlink'))[1:] href = tagref.get(inkex.addNS('href', 'xlink'))[1:]
if self.svg.getElementById(href) is None: if self.svg.getElementById(href) is None: