Re: questions about using Doxygen and Python scripting
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
Re: questions about using Doxygen and Python scripting
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++. See the existing tools for examples how to configure a Python script as exporter. There is the generic "lyxserver" for sending communication between a running LyX and an external program via pipes. I wrote a Python module to get a more "pythonic" interface. It can be found at the LyX wiki. http://wiki.lyx.org/Tools/PyClient Günter
Re: questions about using Doxygen and Python scripting
Pavel Sanda wrote: > we already have working library for zipping files as a part of LyX and commit > history might even contain much more generic solution written some time back > by > Bo Peng as a part of bundled lyx format feature (and reverted later;). You can check commits around a095d0d785ca3f76f
Re: questions about using Doxygen and Python scripting
Josh Hieronymus wrote: > I was thinking of using the existing C++ routines to generate the XHTML, > and then using Python to generate the additional necessary files, which are > mostly XML files with metadata and manifest info, as well as to pack the > files. My point was just that you shouldn't use any python parsing of .lyx files as does the library published by Steve, but all document data should by fired out from our internal structures. I can't tell how much easier is using python for packing things (need for some 3rd party library for python packing would be bad for example), just note that we already have working library for zipping files as a part of LyX and commit history might even contain much more generic solution written some time back by Bo Peng as a part of bundled lyx format feature (and reverted later;). Pavel
Re: questions about using Doxygen and Python scripting
On Sun, Jul 21, 2013 at 10:19 PM, Pavel Sanda wrote: > Josh Hieronymus wrote: > > Since an ePub file is pretty much a zipped file with XHTML and a few > simple > > files, I was thinking that it might be easiest to use Python to create > > them. > > If it comes to packing you might be interested to see our lyxpak.py script. > I'm not sure what you mean by 'create'; creating actual content of the file > should be done via c++ routines we already have for xhtml export. > > Pavel > I was thinking of using the existing C++ routines to generate the XHTML, and then using Python to generate the additional necessary files, which are mostly XML files with metadata and manifest info, as well as to pack the files. Thanks for the doxygen help, by the way. That's really helping me to understand the code even more.
Re: questions about using Doxygen and Python scripting
Josh Hieronymus wrote: > Since an ePub file is pretty much a zipped file with XHTML and a few simple > files, I was thinking that it might be easiest to use Python to create > them. If it comes to packing you might be interested to see our lyxpak.py script. I'm not sure what you mean by 'create'; creating actual content of the file should be done via c++ routines we already have for xhtml export. Pavel
Re: questions about using Doxygen and Python scripting
On Sun, Jul 21, 2013 at 8:58 PM, Pavel Sanda wrote: > Josh Hieronymus wrote: > > I have two questions for everyone. First, is there a simple command to > use > > Doxygen to produce HTML documenting all of (or most of, or at least much > > of) LyX? I think it would really help me have an easier time knowing how > > make doxydoc, if you have graphviz, you will get nice pictures as well. > > > the different parts of code are all related. Second, is there a tutorial > > serves as a gentle introduction to Python scripting for LyX? I've not > > No. What do you need python for btw? > Pavel > Since an ePub file is pretty much a zipped file with XHTML and a few simple files, I was thinking that it might be easiest to use Python to create them. Steve Litt just recently posted a script to the LyX-users mailing list that does much of the necessary work, and either extending it or using it as inspiration for another script would likely make matters simpler. - Josh
Re: questions about using Doxygen and Python scripting
Josh Hieronymus wrote: > I have two questions for everyone. First, is there a simple command to use > Doxygen to produce HTML documenting all of (or most of, or at least much > of) LyX? I think it would really help me have an easier time knowing how make doxydoc, if you have graphviz, you will get nice pictures as well. > the different parts of code are all related. Second, is there a tutorial > serves as a gentle introduction to Python scripting for LyX? I've not No. What do you need python for btw? Pavel
questions about using Doxygen and Python scripting
Hi everyone, I have two questions for everyone. First, is there a simple command to use Doxygen to produce HTML documenting all of (or most of, or at least much of) LyX? I think it would really help me have an easier time knowing how the different parts of code are all related. 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. Thanks, Josh
Re: Python scripting
On Sat, Nov 27, 2010 at 11:40 PM, wrote: > Any other useful link? > http://www.lyx.org/Development Regards Liviu
RE: Python scripting
> it means untrivial ditching into the dispatch mechanism, so this is for sure not > 2.0 business. OK, then I'll just start thinking about it. Maybe a first release of the scripting support could not have such events, but just keypresses as notification in LyX server. I don't know how these things work, do you consider this a so big feature to require a tag, or a branch? BTW I'm reading the following docs to better understand and edit LyX code: http://www.lyx.org/trac/browser/lyx-devel/trunk/development/coding/Rules http://www.lyx.org/trac/browser/lyx-devel/trunk/development/coding/Recommendatio ns Any other useful link? Ale
Re: Python scripting
veno...@arcadiaclub.com wrote: > > who told you? iirc adv search and adv math macros appeared this way... > > I read somewhere on the wiki that new contributors have to stay in a corner > fixing bugs for a pair of years before they can implement new features. :D can't remember such kind of rules. we just suggest that people hang around for a while with small things to get idea about the code, otherwise big parts of their code would need rewrite... > So, my idea was to add python scripting in-process. The script should be able > to > register to an event, call LFUN and receive responses, nothing more. Maybe > we'll > things that would require "massive" modifications in the code is signaling > events like startup, quit, new document loaded, document closed and things > like > that. it means untrivial ditching into the dispatch mechanism, so this is for sure not 2.0 business. pavel
RE: Python scripting
> to give you wider overview, i have been asking about must-have new features for 2.0 each month from early spring and formally closed the gates by beta1, so little bit late... I always arrive too late in this sort of things :D Anyway it's not too urgent, maybe it could be ready for the next release. > who told you? iirc adv search and adv math macros appeared this way... I read somewhere on the wiki that new contributors have to stay in a corner fixing bugs for a pair of years before they can implement new features. :D @Guenter: your work is interesting, and will probably be helpful! So, my idea was to add python scripting in-process. The script should be able to register to an event, call LFUN and receive responses, nothing more. Maybe we'll need to add some LFUN to get the selected text, or the whole document source, because I couldn't find such functions in LyXAction.cpp [1]. I don't think there's the need to wrap commands to a more OO structure, they change too frequently IMHO, and the Python library wouldn't be up-to-date. Events should be things like specific key-press and click on a custom toolbar button, but these are things one could achieve just with an LFUN (e.g. associate Ctrl + Shift + R to execute-python-command-from-scripts nameOfTheFunction): the things that would require "massive" modifications in the code is signaling events like startup, quit, new document loaded, document closed and things like that. What do you think? Ale [1] http://www.lyx.org/trac/browser/lyx-devel/trunk/src/LyXAction.cpp
Re: Python scripting
veno...@arcadiaclub.com wrote: > Hello, LyX 2.0 is getting awesome, but I think there's just a last must-have > feature missing: support for scripting. to give you wider overview, i have been asking about must-have new features for 2.0 each month from early spring and formally closed the gates by beta1, so little bit late... > I think implementing Python scripting [1] wouldn't be that difficult, as all > the functionalities (event notification, commands, response and errors) are > already implemented in the LyX server [2]. hard to say unless one sees the code. there is often quite a gap between "something which works" and something which is accepted as a sane code included into the tree, lets see the other patch ;) > Maybe I can take care of this, if you're interested, this is a long time request for which you could even find bug number, so even if this is not part of 2.0 it has good potential to be included later. as a first step i would recommend to discuss your vision of 'scripting support' here on the list. >even if I know new users shouldn't try to implemnt new features, who told you? iirc adv search and adv math macros appeared this way... > I hope in your support because this is probably one of those features which > could attract a lot of interest in LyX. as said this has pretty good chance to get support, but for 2.0 i would like that our effort now goes mainly on fixing bugs. and dont get me wrong, you are welcomed here! not so often somebody asks for something and provides patch ;) pavel
Re: Python scripting
On 2010-11-26, wrote: > Hello, LyX 2.0 is getting awesome, but I think there's just a last > must-have feature missing: support for scripting. I wrote a Python package that provides an interface via the LyXserver pipes. It's available for download via the LyX wiki http://wiki.lyx.org/Tools/PyClient Maybe you can build on this? Günter
Re: Python scripting
On 11/26/2010 02:22 PM, veno...@arcadiaclub.com wrote: Hello, LyX 2.0 is getting awesome, but I think there's just a last must-have feature missing: support for scripting. I think implementing Python scripting [1] wouldn't be that difficult, as all the functionalities (event notification, commands, response and errors) are already implemented in the LyX server [2]. Maybe I can take care of this, if you're interested, even if I know new users shouldn't try to implemnt new features, but I've been walking around LyX code for a while and recently (today) I wrote a patch (http://www.lyx.org/trac/ticket/7042#comment:7). I hope in your support because this is probably one of those features which could attract a lot of interest in LyX. Imagine that one can be able to write a quick plugin in Python to use a specific LaTeX package? Wouldn't that be interesting? Whether such a thing could make it into 2.0, I'm doubtful, as trunk is pretty much closed to enhancements at this point (though this is ultimately up to Pavel). Still, this kind of change is not a "format change", i.e., it doesn't affect file structure, so it could in principle make it into the 2.0.x series. That said, I'm not entirely sure what you want to do here. What sort of support for scripting would you like to have that can't be implemented though the existing LyX server? I'm intending to look at your other patch, by the way, but am busy with work right now. I don't use PSTricks, etc, though, so the testing part I can't do. Richard
Python scripting
Hello, LyX 2.0 is getting awesome, but I think there's just a last must-have feature missing: support for scripting. I think implementing Python scripting [1] wouldn't be that difficult, as all the functionalities (event notification, commands, response and errors) are already implemented in the LyX server [2]. Maybe I can take care of this, if you're interested, even if I know new users shouldn't try to implemnt new features, but I've been walking around LyX code for a while and recently (today) I wrote a patch (http://www.lyx.org/trac/ticket/7042#comment:7). I hope in your support because this is probably one of those features which could attract a lot of interest in LyX. Imagine that one can be able to write a quick plugin in Python to use a specific LaTeX package? Wouldn't that be interesting? Ale [1] http://docs.python.org/extending/embedding.html [2] http://wiki.lyx.org/LyX/LyXServer