[referencer] Preliminary medline support (first python plugin)

John Spray jcspray at icculus.org
Wed Jan 2 17:51:47 EST 2008


On Wed, 2008-01-02 at 23:03 +0100, Aurélien Naldi wrote:
> I have been playing with extending the plugin system to allow plugins to
> add actions. It is nowhere near finished nor clean as I have been
> learning C++ in the meanwhile, but here is a short patch, to avoid
> duplicate work, start discussion and to force me to finish it later!

This looks like a reasonable place to start.  Suggestions:
      * RUN should be something like DOCUMENT_ACTION.  There also needs
        to be a way to express whether the action can be applied to just
        one document or to multiple documents at the same time, perhaps
        with another capability called DOCUMENT_MULTIACTION.  There is
        probably a better way.
      * shortName is a one-word thing like "arxiv", while longName is a
        description.  This means that for things in menus one needs
        something else like actionName to be, for example, "Cite in
        LyX", set in referencer_plugin_info.  However, that field would
        be absent/meaningless in metadata plugins, which could get a bit
        messy.
      * There need to be hooks for updating sensitivity of the action,
        not just on whether any documents selected, but also on (for
        example) whether lyx is running.  It will be interesting to see
        what  performance consequences there are associated with jumping
        into a python plugin everytime updating status UI.

> Remaining work:
> * actually call some python code in PythonPlugin.C
> * give it the list of selected documents, so that it can do something.

How you give the Document to python is the interesting part.  I guess
you could just do it as a dictionary of Document->getFields, (plus the
document filename, key and type, which aren't included there).  It would
be nicer to pass a full-fledged object to python, but I don't know how
easy/hard this is.

> * write 5 more lines of python to push a lyx citation

Don't forget to deal with referencer giving you utf-8 that lyx won't
understand.

> Is it going in the right direction for you ?

Sure, I look forward to seeing what you come up with.

Cheers,
John






More information about the referencer mailing list