I've made some concrete progress now for improving command-line scriptability of Inkscape. I've made some fairly significant changes to the verb interface, so that now it's possible to execute certain verbs (and make selections via --select) in command-line mode (-z or --without-gui flag). This work involved:
- factoring out the layer model from SPDesktop into a new class (Inkscape::LayerModel)
- allowing an Inkscape::Selection to take one of these new LayerModels in its constructor, and removing the need for an SPDesktop in Inkscape::Selection (although it's still in the class when in GUI mode due to so many parts of the app using it to get access to the desktop)
- editing main.cpp to run the selections / verbs when taking the command-line code path
- changing the interface to Verb and SPAction so that a new ActionContext object is provided, rather than just an Inkscape::UI::View::View, providing access to document, selection model and (only in GUI mode) the Inkscape::UI::View::View of old
- changing the Boolean operations to work without a SPDesktop, i.e. in command-line mode, although if a GUI is available they will still show error messages in dialog boxes (in console mode, they will print to stderr).
- printing error messages on stderr when all other verbs are called from the command line (old behaviour was silent failure)
This now means that you can run Inkscape on the command line with e.g. "inkscape file.svg --select Path1 --select Path2 --verb SelectionDiff -z", and Inkscape will subtract the uppermost path from the lowermost path, and overwrite file.svg with the result, all without ever creating any GUI. This is obviously much faster than before (where the verbs didn't work with -z) and opens the way for other suitable verbs to be modified for console-mode (e.g. server-side) usage, as required.
I'd like to integrate my work with trunk, if you think that my changes are valuable - I'm currently on a branch on my Launchpad account. I was up to date with trunk a few days ago - is it good practice to trunk-track (i.e. merge all changes from trunk to my branch since my branch started) before clicking "propose for merging", or is this not necessary?
Next step: trying to use the DBus interface when running Inkscape in console mode...