Code

fix effect to work after the lxml conversion
authoracspike <acspike@users.sourceforge.net>
Tue, 26 Jun 2007 02:41:30 +0000 (02:41 +0000)
committeracspike <acspike@users.sourceforge.net>
Tue, 26 Jun 2007 02:41:30 +0000 (02:41 +0000)
share/extensions/pathalongpath.py
share/extensions/pathmodifier.py

index 3901069c9089976c00f7c429ee1fe54235758db8..e49aadeb46ed1d43b62e259928533f8ecea4fdc2 100644 (file)
@@ -212,7 +212,7 @@ class PathAlongPath(pathmodifier.Diffeo):
         dx=width+self.options.space\r
 \r
         for id, node in self.patterns.iteritems():\r
-            if node.tag == inkex.addNS('path','svg'):\r
+            if node.tag == inkex.addNS('path','svg') or node.tag=='path':\r
                 d = node.get('d')\r
                 p0 = cubicsuperpath.parsePath(d)\r
                 if self.options.vertical:\r
index f10a86b494d251e77304c253de5580d6c16e201f..245665588b3e886e641f316eb730fb144f4a766a 100644 (file)
@@ -106,7 +106,7 @@ def fuseTransform(node):
             for pt in ctl:\r
                 applyTransformToPoint(m,pt)\r
     node.set('d', cubicsuperpath.formatPath(p))\r
-    del node.attribs["transform"]\r
+    del node.attrib["transform"]\r
 \r
 \r
 def boxunion(b1,b2):\r
@@ -151,7 +151,8 @@ class PathModifier(inkex.Effect):
             clone=inkex.etree.fromstring(inkex.etree.tostring(node))\r
             #!!!--> should it be given an id?\r
             #seems to work without this!?!\r
-            clone.set("id", self.uniqueId(node.tag))\r
+            myid = node.tag.split('}')[-1]\r
+            clone.set("id", self.uniqueId(myid))\r
             node.getparent().append(clone)\r
             clones[clone.get("id")]=clone\r
         return(clones)\r
@@ -164,25 +165,25 @@ class PathModifier(inkex.Effect):
 \r
     def expandGroups(self,aList,transferTransform=True):\r
         for id, node in aList.items():      \r
-            if node.tag == inkex.addNS('g','svg'):\r
+            if node.tag == inkex.addNS('g','svg') or node.tag=='g':\r
                 mat=parseTransform(node.get("transform"))\r
                 for child in node:\r
                     if transferTransform:\r
                         applyTransformToNode(mat,child)\r
                     aList.update(self.expandGroups({child.get('id'):child}))\r
                 if transferTransform:\r
-                    del node.attribs["transform"]\r
+                    del node.attrib["transform"]\r
                 del aList[id]\r
         return(aList)\r
 \r
     def expandGroupsUnlinkClones(self,aList,transferTransform=True,doReplace=True):\r
         for id in aList.keys()[:]:     \r
             node=aList[id]\r
-            if node.tag == inkex.addNS('g','svg'):\r
+            if node.tag == inkex.addNS('g','svg') or node.tag=='g':\r
                 self.expandGroups(aList,transferTransform)\r
                 self.expandGroupsUnlinkClones(aList,transferTransform,doReplace)\r
                 #Hum... not very efficient if there are many clones of groups...\r
-            elif node.tag == inkex.addNS('use','svg'):\r
+            elif node.tag == inkex.addNS('use','svg') or node.tag=='use':\r
                 refid=node.get(inkex.addNS('href','xlink'))\r
                 path = '//*[@id="%s"]' % refid[1:]\r
                 refnode = self.document.getroot().xpath(path,inkex.NSS)\r
@@ -299,7 +300,7 @@ class PathModifier(inkex.Effect):
                     uri = uri[1:]\r
                 if uri in [inkex.NSS[u'sodipodi'],inkex.NSS[u'inkscape']]:\r
                     #if attName not in ["d","id","style","transform"]:\r
-                    del node.attribs[inkex.addNS(attName,uri)]\r
+                    del node.attrib[inkex.addNS(attName,uri)]\r
             fuseTransform(node)\r
             return node\r
         else:\r
@@ -370,7 +371,7 @@ class Diffeo(PathModifier):
         self.objectsToPaths(self.selected, True)\r
         self.bbox=self.computeBBox(self.selected)\r
         for id, node in self.selected.iteritems():\r
-            if node.tag == inkex.addNS('path','svg'):\r
+            if node.tag == inkex.addNS('path','svg') or node.tag=='path':\r
                 d = node.get('d')\r
                 p = cubicsuperpath.parsePath(d)\r
 \r