On Wed, Nov 21, 2018 at 7:40 PM Bryce Harrington <bryce@...961...> wrote:
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).
I always forget that it is not trivial to create Python binding for a C++ program. There had been several attempts over the past decade, but I lost track of them. The only project that I know is used in production is https://wiki.qt.io/Qt_for_Python/Shiboken for Qt bindings.
If Python people are able to use at least something from Python and there is a catchy tutorial about how port you favorite missing functions from C++ API to Python, then I am sure more people will follow. I mean I would definitely try this given a lil bit more free time. =)
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.
Thanks. The C++ guiding process will definitely help, The code I do and read nowadays daily involves Bash, Go and Python scripting, and wrapping my head around C++ is just too sloooow to fix some problems with my SVG workflow.
At the very least I'd like `inkview` to automatically scale the output of "systemd-analyze plot" to available screen space, and with --debug option tell me how it selects coordinate systems and maps them together. SVG coordinates in HTML really really needs a good 3D visualization to understand how all this translation and scaling and clipping works with all these abstractions. If inkview could provide more simple output to see how it works, it could become a part of coordinate tutorial itself.
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.
I tried to find some lib like this, but it is hard without knowing the name. There are a few hits on PYthon Package Index - https://pypi.org/search/?q=librsvg and I would give it a try. Basically the long term idea is a "debugging canvas" - processing like surface for SVG graphics. While filling my issue, I stumbled on the feature request to add reading multiple SVG data chunks from stdin - https://bugs.launchpad.net/inkscape/+bug/1009711 which if implemented would give a simple ability to control the contents of inkview canvas from any program that can run it with an open pipe. -- anatoly t.