Am 2018-08-23 16:52, schrieb c.holterm...@gmx.de:
Am 2018-08-06 16:14, schrieb John Ralls:
On Aug 6, 2018, at 5:19 AM, c.holterm...@gmx.de wrote:
Am 2018-08-06 11:35, schrieb Geert Janssens:
Op maandag 6 augustus 2018 05:32:27 CEST schreef John Ralls:
> On Aug 5, 2018, at 5:17 PM, c.holterm...@gmx.de wrote:
>
> Hello,
>
> after some time I get back to the gnucash python bindings.
>
> I worked on a str method for GncNumeric. It's in the example_script
> dir
> (https://github.com/Gnucash/gnucash/blob/maint/bindings/python/example_sc
> ripts/str_methods.py) I changed it to python3.
I read at the beginning of this file you chose to implement it as an
example
script which - if found useful - could be added to gnucash_core.
You have my blessing to include it in gnucash_core :)
> Well I found it interesting to think these things through. Maybe someone
> can tell me about the mysterious "later on" in the cited comment. At this
> point I find it useful to have a way from the instance to the wrapping
> object through some kind of link as I suggested in the patch to
> function_class.
Christoph,
The person who wrote the first two lines of that, Mark Jenkins, was
the
original source of the Python bindings. He was never a regular dev,
he just
got 16 patches committed between 2007 and 2012, 10 of which touched
the
python bindings. Your history with them is almost as long as
his--in fact
you have *12* commits--and pretty much no one else has done
anything
serious with them.
Hopefully Mark is still around on the list to clarify.
In other words, if anyone knows, it’s you!
True :)
Just to add some more confusion, there’s now a C++ class GncNumeric
that
handles the actual implementation of many of the gnc_numeric.*
functions. I
believe that SWIG can’t see it, only the C wrapper functions are
exposed to
SWIG.
It would be a very useful experiment to wrap the C++ GncNumeric
class directly
rather than it's c wrapper gnc_numeric_xxx. Python doesn't need the
c
compatibility layer it represents.
Geert
Geert,
unfortunately your mail went to my spam folder for whatever reason.
Trying to
do C++ bindings for python sounds very interesting. I'd like to try
that when
I find the time for a simple example type. I don't know if GncNumeric
would
be a good candidate. I'll have a look at it. Thanks for the blessing
:-)
Python has its own rational numbers so the only thing the Python
bindings need is a way to convert to-and-from that to GncNumeric for
communicating with the rest of the GnuCash API.
I suggest QofSession as the first C++ class to play with SWIGing. It’s
fairly simple and using it is the first step in using the bindings.
Regards,
John Ralls
Hello,
I've created an experimental branch in my fork of gnucash to create
swig python
bindings for c++ files. As suggested I started with QofSessionImpl for
which I
have created an example file to create a file and an account. I also
included
GncNumeric. There's no example for that yet. It's very raw. I disabled
some errors.
It's more of a proof of concept but it's a step on the way.
https://github.com/c-holtermann/gnucash/tree/ch-python
regards,
Christoph Holtermann
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel
Hello,
I've moved the python c++ specifics to a separate branch in my fork. It
is https://github.com/c-holtermann/gnucash/tree/python-c%2B%2B.
regards,
Christoph Holtermann
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel