
On Sun, Sep 25, 2005 at 04:16:40PM +0800, Craig Ringer wrote:
On Sat, 2005-09-24 at 23:26 -0700, Bryce Harrington wrote:
However it occurs to me that another solution would be to simply give scribus some commandline options for doing import/export. E.g.
scribus -i filename.eps -e filename.svg
This has been desired for a long time. See http://bugs.scribus.net/view.php?id=238 . We're still not at the point where that's quite practical, though we're certainly getting there.
Being able to do it without an X-server and with a low startup time may well be post-Qt4-migration stuff though (Riku will know much more than me about this).
I was thinking about this too. With Inkscape when we first started doing intensive commandline stuff, we had some branches of code that relied on X for error dialogs and such, but did it anyway, and sorted out the X issues later. They're annoying, but straightforward to solve. A converter that requires X to run is certainly superior to no converter at all...
For purposes of conversion, startup time is really a secondary issue; it probably isn't worth it as a driver for you.
I looked into the scribus code a bit to see how this could be implemented. I wasn't sure how to call the import/export plugins
As chance would have it, that's something I'm going to be working on soon. There's just a pile of university stuff to deal with first.
Cool.
For importers/exporters that already have plugins, you can use the plugin manager to call them. There's code in fileloader.cpp for that, but it might be a bit tricky to follow.
The general approach you could take is:
#include "scplugin.h" #include "pluginmanager.h"
ScActionPlugin* plug = dynamic_cast<ScActionPlugin*>(PluginManager::instance().getPlugin("importps")); if (plug) { bool result = plug->run("/path/to/PS-file-to-import"); // Act on result code } else { // Inform the user that you couldn't do what they asked because // you couldn't access the required plugin. }
Okay, if I get time I'll investigate this.
There is currently no good way to enumerate supported formats, etc, automatically. That's planned, though, and should hopefully happen during 1.3.2cvs development.
Once that's done, your TODO should simply become a call into FileLoader.
Thanks, Bryce