diff options
| author | Aaron Spike <aaron@ekips.org> | 2006-07-20 04:23:59 +0000 |
|---|---|---|
| committer | acspike <acspike@users.sourceforge.net> | 2006-07-20 04:23:59 +0000 |
| commit | 79aed7f36f9494f3d66ed45bb52f442c118988ec (patch) | |
| tree | 0234f0620e711e441c0b998689eac642abfa6e47 | |
| parent | marker refactoring work (diff) | |
| download | inkscape-79aed7f36f9494f3d66ed45bb52f442c118988ec.tar.gz inkscape-79aed7f36f9494f3d66ed45bb52f442c118988ec.zip | |
fix an old bug in the style splitting routine and add to the makefile
(bzr r1442)
| -rw-r--r-- | share/extensions/Makefile.am | 6 | ||||
| -rw-r--r-- | share/extensions/markers_strokepaint.py | 7 | ||||
| -rwxr-xr-x | share/extensions/simplestyle.py | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 1195266b1..fc4297abc 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -52,7 +52,8 @@ extensions = \ flatten.py \ measure.py \ gimp_xcf.py \ - eqtexsvg.py + eqtexsvg.py \ + markers_strokepaint.py otherstuff = \ aisvg.xslt @@ -103,7 +104,8 @@ modules = \ gimp_xcf.inx \ randompnt.inx \ randompos.inx \ - eqtexsvg.inx + eqtexsvg.inx \ + markers_strokepaint.inx extension_SCRIPTS = \ $(extensions) diff --git a/share/extensions/markers_strokepaint.py b/share/extensions/markers_strokepaint.py index f49a37a77..163767f1a 100644 --- a/share/extensions/markers_strokepaint.py +++ b/share/extensions/markers_strokepaint.py @@ -32,7 +32,7 @@ class MyEffect(inkex.Effect): self.ctx = inkex.xml.xpath.Context.Context(self.document,processorNss=inkex.NSS)
defs = self.xpathSingle('/svg/defs')
for id, node in self.selected.iteritems():
- mprops = ['marker-start','marker-mid','marker-end']
+ mprops = ['marker','marker-start','marker-mid','marker-end']
style = simplestyle.parseStyle(node.attributes.getNamedItem('style').value)
try:
@@ -43,15 +43,16 @@ class MyEffect(inkex.Effect): for mprop in mprops:
if style.has_key(mprop) and style[mprop] != 'none'and style[mprop][:5] == 'url(#':
marker_id = style[mprop][5:-1]
- old_mnode = self.xpathSingle('/svg/defs/marker[@id="%s"]' % marker_id)
+ old_mnode = self.xpathSingle('/svg//marker[@id="%s"]' % marker_id)
mnode = old_mnode.cloneNode(True)
new_id = "%s%s" % (marker_id,2)
style[mprop] = "url(#%s)" % new_id
mnode.attributes.getNamedItem('id').value = new_id
defs.appendChild(mnode)
- children = inkex.xml.xpath.Evaluate('/svg/defs/marker[@id="%s"]//*[@style]' % new_id,self.document,context=self.ctx)
+ children = inkex.xml.xpath.Evaluate('/svg//marker[@id="%s"]//*[@style]' % new_id,self.document,context=self.ctx)
for child in children:
+ inkex.debug(child.attributes.getNamedItem('style').value)
cstyle = simplestyle.parseStyle(child.attributes.getNamedItem('style').value)
if (cstyle.has_key('stroke') and cstyle['stroke'] != 'none') or not cstyle.has_key('stroke'):
cstyle['stroke'] = stroke
diff --git a/share/extensions/simplestyle.py b/share/extensions/simplestyle.py index 22b4c3e8b..e11f91ae0 100755 --- a/share/extensions/simplestyle.py +++ b/share/extensions/simplestyle.py @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ def parseStyle(s): """Create a dictionary from the value of an inline style attribute""" - return dict([i.split(":") for i in s.split(";")]) + return dict([i.split(":") for i in s.split(";") if len(i)]) def formatStyle(a): """Format an inline style attribute from a dictionary""" return ";".join([":".join(i) for i in a.iteritems()]) |
