On 22/07/2013 4:10 AM, Guenter Milde wrote:
On 2013-07-22, Josh Hieronymus wrote:

....

Second, is there a tutorial
serves as a gentle introduction to Python scripting for LyX? I've not
worked with Python and C++ in the same project before, so I'm not really
sure how to get them to work together, especially when you consider issues
like type checking, namespaces, header files, and so on.

The Python scripts that come with LyX are all separate tools and pure
Python. There is no LyX Python module in C or C++.


Exactly, we just call the python interpreter on our scripts (or external scripts). They are run as separate processes, nothing tricky.

See the existing tools for examples how to configure a Python script as
exporter.


What Günter refers to is lib/configure.py where target export formats are defined, converters are being detected whther they are installed or not, etc. So e.g. ePub could be added as format, and configure could check if the lyx2epub.py converter (or whatever) is installed and define it as a converter. Then when LyX is requested to export to ePub, we call the python interpreter to run the python script ina temporary folder and move its output file(s) to the export folder.

Cheers,
Julien

Reply via email to