Code

prevent multiple processing of the same gradient if it is used by more than one selec...
authorbuliabyak <buliabyak@users.sourceforge.net>
Fri, 17 Nov 2006 08:10:27 +0000 (08:10 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Fri, 17 Nov 2006 08:10:27 +0000 (08:10 +0000)
share/extensions/coloreffect.py

index 2144955023a1c13bd727ba1cbf89df0cfff8ab29..c1ed150659f5345a97c4c8782b4e317474fb27f0 100644 (file)
@@ -27,6 +27,7 @@ color_props = color_props_fill + color_props_stroke
 class ColorEffect(inkex.Effect):\r
   def __init__(self):\r
     inkex.Effect.__init__(self,use_minidom=True)\r
+    self.visited = []\r
 \r
   def effect(self):\r
     if len(self.selected)==0:\r
@@ -81,6 +82,14 @@ class ColorEffect(inkex.Effect):
     return col\r
 \r
   def process_gradient(self, node):\r
+    if node.hasAttributes():                           \r
+       this_id=node.getAttribute('id')\r
+       if this_id in self.visited:\r
+         # prevent multiple processing of the same gradient if it is used by more than one selected object\r
+         #inkex.debug("already had: " + this_id)\r
+         return\r
+       self.visited.append(this_id)\r
+       #inkex.debug("visited: " + str(self.visited))\r
     self.changeStyle(node)\r
     if node.hasChildNodes():\r
       for child in node.childNodes:\r