[Libreoffice] [GSOC] how to call python code from the menu

Caolán McNamara caolanm at redhat.com
Wed Aug 17 01:06:50 PDT 2011


On Tue, 2011-08-16 at 19:29 +0200, Xisco Faulí wrote:
> Thank you for pointing out this file but I don't really understand how
> it works.
> The wizard is called here :
> http://opengrok.libreoffice.org/xref/core/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu#441 where MailMergeWizard is the service register in Writer.xcu ( http://opengrok.libreoffice.org/xref/core/officecfg/registry/data/org/openoffice/Office/Writer.xcu#30 ) but then 

I the case of mailmerge the thing that the menus calls then goes on to
call the mailmerge service, so the menus don't call it directly.

I imagine your example to call a python service directly from the menus
is correct, except that the service you want to call needs to be
registered first.

> how libo knows that this service refers to mailmerge.py ?

http://opengrok.libreoffice.org/xref/core/scripting/source/pyprov/mailmerge.component
is the magic bit which connects uses of the
"com.sun.star.mail.MailServiceProvider" service to the mailmerge.py
implementation. With these .component files 

I imagine that if you basically opengrok for mailmerge.py and
mailmerge.component and follow the same pattern for your one that it'll
get you a lot closer.

Your current code is in a feature branch ?, which one ?

C.




More information about the LibreOffice mailing list