.. very basic API as we develop out, it just returns a dict
for now. Need to expand to enable returning a list if
compare mode is active (like R).
.. implemented in a new source file Resources/python/library.py
which is loaded directly after the interpreter is loaded at
startup.
.. also updated src.pro to add library.py and goldencheetah.sip
to OTHER_FILES so they can be edited easily in QtCreator.
Basic proof of concept for CPP binding using SIP but with
our own type conversion (to avoid overhead of SIP lib/deploy).
Its far from perfect but will serve as a starting point.
.. needed to fixup type conversion in goldencheetah.sip to
convert returning QString as PyUnicode
.. needed to fixup passing context when multi-threaded
.. needed to fixup Bindings.h/cpp to offer new API
.. Using SIP thats used in PyQt et al we have a module
called `goldencheetah' which includes bindings.
Currently there is only a single method `getValue()'
that returns 1. It's to get the basic plumbing in place.
src/Python/SIP contains all the files related to the
module. The cpp files are generated by the `sip' utility
which will need to be available if you want to work on the
bindings. Run make -f Makefile.hack to regenerate the cpp
files if you edit them.
I prefer to distribute the generated files at this point
whilst development occurs. We may change that at a later
date.
.. Please note that the gcconfig.pri.in file has changed as
we now include the python include path rather than set a
macro for the include directive (See PYTHONINCLUDES in
gcconfig.pri.in)
.. lastly, to test this is working in a python chart console:
> print(GC.getValue())
1
>
.. runs in thread to avoid blocking GUI actions but GUI
will still wait for script to complete. ESC is trapped,
but mechanism to stop script not implemented yet.
.. added a python chart type, it doesn't execute code
yet. Just a reimplementation of the RChart UX
.. next we need to trap output and run code on selection
before proceeding to setting an API for Data and Charting
.. just bootstrapping, so Python is loaded and version
number made available in the about box.
.. see gcconfig.pri.in and src.pro for settings needed
.. not considering threading etc at this point