On 5/10/11 19:49, Nikita Kitaev wrote:
On Mon, Oct 3, 2011 at 2:17 PM, ~suv <suv-sf@...58...> wrote:
On 3/10/11 21:27, Nikita Kitaev wrote:
I've finished working on the first iteration of the SVG Synfig exporter. The essential features are there and a lot of bugs are fixed, so I think now would be a good time to consider including a copy with Inkscape. I committed the files into a personal branch of inkscape: "lp:~nikitakit/inkscape/svg2sif". (Disclaimer: I'm a git advocate and don't know much about bzr)
My work was all done on Ubuntu natty with Python version "2.7.1+", testing against Inkscape 0.48.1, Inkscape trunk build, and a large collection of OpenClipArt files made with various (older) versions of Inkscape. It would be good if someone could test it on Windows and Mac (especially if the python versions are different).
- (Legacy) Mac OS X 10.5.8 Leopard (i386)
Quick test with two small SVG files (some basic shapes, and a text converted to path), exported *.sif verified with Synfigstudio 0.63.00 (installed with MacPorts):
a) Inkscape 0.48.2 (official package), Python 2.5.1 (Apple, default) Both sample files fail to export to *.sif:
File "synfig_output.py", line 1340 except MalformedSVGError as e: ^ SyntaxError: invalid syntax
b) Inkscape 0.48.2 (local build), Python 2.6.7 (MacPorts) Both sample files export ok to *.sif
c) Inkscape 0.48+devel r10660 (GTK+/Quartz), Python 2.7.2 (MacPorts) Both sample files export ok to *.sif
- For current versions of OS X (not personally verified):
a) Mac OS X 10.6 Snow Leopard: The extension should work fine with the prebuilt package (0.48.2-1) on Snow Leopard which has Python 2.6 installed as default system version.
b) OS X 10.7 Lion: None of Inkscape's python-based extensions currently work out-of-the-box with the prebuilt package (0.48.2-1) on Lion, see Bug #819209 "Extensions do not work with Mac OS X Lion" https://bugs.launchpad.net/inkscape/+bug/819209. This will also affect svg2sif. The workaound/fix described in the bug report has been confirmed (enforce the use of Python 2.6 (32bit)), but there is no updated package of Inkscape 0.48.2 available for download.
If you need additional tests, maybe you could provide details or files? (I'm not familiar with Synfig yet, and can only compare visually whether the converted file looks the same in Synfigstudio as it does in Inkscape on-canvas).
Besides python versions the only other feature I worry about is launching an Inkscape subprocess to do some conversions. A simple test would be to draw a rectangle and export the file. Correct behavior is to launch another Inkscape window that converts the rectangle to a path. Incorrect behavior includes failing to run the "inkscape" command.
Launching another instance of Inkscape from the python script in a subprocess does work with the osx-packaged application bundle - other extensions, (e.g. 'Arrange > Restack') use it too, though without gui because they don't need to use verbs.
The Mac OS X Lion problem isn't something I can fix. I'll worry about that system once the bug is resolved.
Leopard is another question. Does the code run if all the "except ExceptionName as e" statements are replaced with "except ExceptionName, e"? If syntax is the only problem I can fix it.
AFAICT it's simply a syntax error in Python 2.5.1 - export and preparing for export works without failure in the osx-packaged Inkscape.app (0.48.2) and Python 2.5.1 after applying the small change as you described (see attached diff). The diff also includes a fix for the vim modeline (else current vim complains when opening the the script).
hth, ~suv
--- synfig_output.py-orig 2011-10-03 21:49:48.000000000 +0200 +++ synfig_output.py 2011-10-05 20:21:13.000000000 +0200 @@ -1337,7 +1337,7 @@ try: e = SynfigExport() e.affect(output=False) - except MalformedSVGError as e: + except MalformedSVGError, e: errormsg(e)
-# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 --- synfig_prepare.py-orig 2011-10-03 21:49:48.000000000 +0200 +++ synfig_prepare.py 2011-10-05 20:21:16.000000000 +0200 @@ -487,8 +487,8 @@ try: e = SynfigPrep() e.affect() - except MalformedSVGError as e: + except MalformedSVGError, e: errormsg(e)
-# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99