Alex,  This did not work for me.

I can run the python script from the command line and it does produce a .png output. So I know the
script is working.

But, in LyX 2.0.1 which I'm using, I get "Error converting to loadable format". I am trying to debug it. Not sure at this point why it does not convert inside LyX. I double checked the file format is defined and
also the converter is defined correctly.

I will try to turn on a log file to see if there are some other diagnostic messages.

Phil
On 6/2/2014 1:25 PM, Alex Vergara Gil wrote:
This might work!! Thanks for the suggestions, I will try it extensively and I will comments my experiences afterwards. It seems it also renders the graphic inside LyX itself! That's what I was talking about.

Regards
Alex

----- Original Message ----- From: "Rainer M Krug" <rai...@krugs.de>
To: "Alex Vergara Gil" <a...@cphr.edu.cu>
Cc: "Richard Heck" <rgh...@lyx.org>; "lyx-users Users" <lyx-users@lists.lyx.org>; <lyx-de...@lists.lyx.org>
Sent: Monday, June 02, 2014 8:31 AM
Subject: Re: [Feature Request] python binding

I just add comments inline

Let's see if I understand:

-1. You define a *file type* in LyX under
 Preferences > File Handling > File Formats
for the file type .pygr in which "Vector graphics format" is ticked!

0. You define a converter under
 Preferences > File Handling > Converters
which calls a script which executed files with the extension .pygr and
generates, as you suggest below, an svg.

1. I wrote a python script that produces the graphic I want

Exactly - and you give it a specific extension .pygr for "python
script which generates a graphic" which you defined above.

2. I insert it in LyX somehow I don't know, perhaps defining a
converter from .py to svg, but this needs to be inside a module or
every python script in LyX will try to be converted into a svg!! So a
module is also needed

Use insert graphic and select *your .pygr* file as graphic - and Lyx
will do the rest of the conversion - i.e. use your converter to convert
the .pygr to an svg and other existing converters to generate the png
for the preview and the pdf / eps / ... for the final copmpilation of
the document.

3. LyX is the one who knows the correct size of the graphic so in
principle if I produce a svg should be enough but in this way I need
to produce a new svg every time the data change

Correct - if the input data changes, you have to generate the graph again
manually, or, if the "Converter file cache" is disabled, you just have
to close the document and open it again.

Hope this helps,

Rainer



Reply via email to