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

Caolán McNamara caolanm at redhat.com
Wed Aug 17 08:41:28 PDT 2011


On Wed, 2011-08-17 at 09:06 +0100, Caolán McNamara wrote:
> 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.

Seeing as this is a bit tricky to get up and running, attached is a
rough-and-ready patch to turn wizards->letter into "hello world" in
python.

i.e.

a) add a "hello_world.component" (which gets run through the usual xslt
script via the local makefile.mk to tweak it to give the right location
where the .py will finally get installed) that describes a
hello_world.py component. The .component has the implementation name,
e.g. org.openoffice.comp.pyuno.demo.HelloWorld in it and the services it
implements, e.g. com.sun.star.task.Job

b) I added a hello_world.py that implements that, see its
g_ImplementationHelper.addImplementation for the matching implementation
name and services

c) add that hello_world.component to "postprocess" where it will be
basically added as an entry into the services.rdb in the final install
sets install/program/services.rdb (which is an xml file these days. That
should end up having "<component loader="com.sun.star.loader.Python"
uri="vnd.openoffice.pymodule:hello_world"><implementation
name="org.openoffice.comp.pyuno.demo.HelloWorld"><service
name="com.sun.star.task.Job"/></implementation></component></components>" in it).

d) change the wizards->letter line in officecfg to call it

e) modify scp2 to install it

f) I haven't a clue what the entry in instsetoo_native does anymore, I
think I used to know :-)

hope this helps.

C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello.world.patch
Type: text/x-patch
Size: 8375 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110817/d76116d6/attachment.bin>


More information about the LibreOffice mailing list