On Wed, Nov 21, 2018 at 05:16:30PM +0300, anatoly techtonik wrote:
Hi.
It is not that I have a lot of time to do that, but I though that being able to use Inkscape as a library from Python could be an awesome feature to play with. Then one day somebody can come up with alternative SVG viewer.
There are problems with current `inkview` from 0.92.3:
- it lacks command line help
- it doesn't respond to --version
- if doesn't render attached file
- there is no scaling option
- there is no debug option for troubleshooting my content
The attached file is rendered correctly in Inkscape, although initial view is too small.
-- anatoly t.
At the Hackfest in Germany there were discussions about splitting Inkscape's frontend and backend, and having a defined API in between. This is a big task, but efforts are underway towards that eventual goal. Once that is done, then a python implementation of inkview should theoretically be pretty trivial (and we're hoping it'll spark a number of other similar narrow use case tools and toys).
Until then, I think it might be a lot of work to try and interface python with Inkscape's internals, the way inkview does.
However, changing the command line options to inkview should be fairly straightforward - inkview itself is not a large codebase, and its C++ use is reasonably basic. And there's a lot of folks here who can lend advice. Or, if you really don't want to code it, if you write up in detail what command line options should be, what they should do, and what the help text should say, perhaps another new Inkscaper would be interested in doing the implementation, and could partner with you.
Another option, if you just want to display SVG's and don't care about using Inkscape's actual internals, would be to to make a python wrapper around one of the other SVG renderers, such as librsvg (if they don't have a commandline viewer already). In theory there should not be any rendering discrepancies, but in practice there may well be some flaws, so YMMV.
Bryce