diff options
| author | Aaron Spike <aaron@ekips.org> | 2008-02-11 00:25:19 +0000 |
|---|---|---|
| committer | acspike <acspike@users.sourceforge.net> | 2008-02-11 00:25:19 +0000 |
| commit | d853db356f546c95f07e10e857dc02df0be5a315 (patch) | |
| tree | 66877123d15ae016a581fed1144e453f91cf7cba | |
| parent | Fix up text in illustrations so that it can wrap when too long. Generate new ... (diff) | |
| download | inkscape-d853db356f546c95f07e10e857dc02df0be5a315.tar.gz inkscape-d853db356f546c95f07e10e857dc02df0be5a315.zip | |
Update scriptfu from siod to tinyscheme
I think this is a complete fix for the script but I can't tell because inkscape crashes.
Intercepting the temporary file the script creates I get a complete layered xcf!
(bzr r4703)
| -rwxr-xr-x | share/extensions/gimp_xcf.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/share/extensions/gimp_xcf.py b/share/extensions/gimp_xcf.py index b7f0ff78f..7951ad190 100755 --- a/share/extensions/gimp_xcf.py +++ b/share/extensions/gimp_xcf.py @@ -37,7 +37,6 @@ class MyEffect(inkex.Effect): path = "/svg:svg/*[name()='g' or @style][@id]" for node in self.document.xpath(path,inkex.NSS): id = node.get('id') - inkex.debug(id) name = "%s.png" % id filename = os.path.join(tmp_dir, name) command = "inkscape -i %s -j %s -e %s %s " % (id, area, filename, svg_file) @@ -52,6 +51,7 @@ class MyEffect(inkex.Effect): namelist = '"%s"' % '" "'.join(names) xcf = os.path.join(tmp_dir, "%s.xcf" % docname) script_fu = """ +(tracing 1) (define (png-to-layer img png_filename layer_name) (let* @@ -69,14 +69,11 @@ class MyEffect(inkex.Effect): (img (car (gimp-image-new 200 200 RGB))) ) (gimp-image-undo-disable img) - (let* ((filelist '(%s))(namelist '(%s))) - (while filelist - (let* ((filename (car filelist))(layername (car namelist))) - (png-to-layer img filename layername) - ) - (set! filelist (cdr filelist)) - (set! namelist (cdr namelist)) + (for-each + (lambda (names) + (png-to-layer img (car names) (cdr names)) ) + (map cons '(%s) '(%s)) ) (gimp-image-resize-to-layers img) (gimp-image-undo-enable img) @@ -85,10 +82,14 @@ class MyEffect(inkex.Effect): """ % (filelist, namelist, xcf, xcf) junk = os.path.join(tmp_dir, 'junk_from_gimp.txt') - f = os.popen('gimp -i -b - > %s' % junk,'w') + f = os.popen('gimp -i --batch-interpreter plug-in-script-fu-eval -b - > %s 2>&1' % junk,'w') f.write(script_fu) f.close() - + # uncomment these lines to see the output from gimp + #err = open(junk, 'r') + #inkex.debug(err.read()) + #err.close() + x = open(xcf, 'r') sys.stdout.write(x.read()) x.close() |
