Re: [Libreoffice] [GSOC] how to call python code from the menu
Hello, I've tried your patch and it works perfectly. What i'm trying now is to import from CallWizard.py another file. Let's imagine I have a file in fax/ called Test.py that looks like this: class Test(): def __init__(self): print it works I add it to Pyuno_fax.mk $(eval $(call gb_Pyuno_add_files,fax,\ CallWizard.py \ Test.py \ )) and then I import it in CallWizard.py like: from Test import Test but it doesn't work ( I've also tried from com.sun.star.wizards.fax.Test import Test ) any idea ? 2011/9/7 Caolán McNamara caol...@redhat.com On Wed, 2011-09-07 at 11:24 +0100, Caolán McNamara wrote: On Tue, 2011-09-06 at 19:49 +0200, Xisco Faulí wrote: Hello, I've tried to follow your steps but placing the code in wizards/com/sun/star/wizards/fax/CallWizard.py. So far I haven't been able to build it successfully. It complains and says: ERROR: File not found: CallWizard.py I see that wizards has been converted to gmake in the meantime, so it no longer uses dmake makefile.mk stuff, we need some gbuild support for copying .py files into their final locations with some form of pyuno .component file support support. dtardon was good enough to put together the gmake stuff needed to get this bootstrapped, which are now committed to master. So here's your patch back again, except gbuildified so this should work to make wizards-fax stick hello world into writer. There's still a lot of nasty things, dumping the .py directly into program as opposed to making some sort of subdir into which they can go, but maybe it'll help C. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [GSOC] how to call python code from the menu
On Tue, 2011-09-06 at 19:49 +0200, Xisco Faulí wrote: Hello, I've tried to follow your steps but placing the code in wizards/com/sun/star/wizards/fax/CallWizard.py. So far I haven't been able to build it successfully. It complains and says: ERROR: File not found: CallWizard.py I see that wizards has been converted to gmake in the meantime, so it no longer uses dmake makefile.mk stuff, we need some gbuild support for copying .py files into their final locations with some form of pyuno .component file support support. C. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [GSOC] how to call python code from the menu
On Wed, 2011-09-07 at 11:24 +0100, Caolán McNamara wrote: On Tue, 2011-09-06 at 19:49 +0200, Xisco Faulí wrote: Hello, I've tried to follow your steps but placing the code in wizards/com/sun/star/wizards/fax/CallWizard.py. So far I haven't been able to build it successfully. It complains and says: ERROR: File not found: CallWizard.py I see that wizards has been converted to gmake in the meantime, so it no longer uses dmake makefile.mk stuff, we need some gbuild support for copying .py files into their final locations with some form of pyuno .component file support support. dtardon was good enough to put together the gmake stuff needed to get this bootstrapped, which are now committed to master. So here's your patch back again, except gbuildified so this should work to make wizards-fax stick hello world into writer. There's still a lot of nasty things, dumping the .py directly into program as opposed to making some sort of subdir into which they can go, but maybe it'll help C. From 9e5fa73cecb5ce2676bde611e4ab38611c9533d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= caol...@redhat.com Date: Wed, 7 Sep 2011 17:15:52 +0100 Subject: [PATCH] demo, for the purposes of saying hello world --- instsetoo_native/util/makefile.mk |1 + .../registry/data/org/openoffice/Office/Common.xcu |2 +- postprocess/packcomponents/makefile.mk |2 +- scp2/source/ooo/file_ooo.scp | 12 ++ scp2/source/ooo/module_hidden_ooo.scp |2 +- scripting/prj/d.lst|1 + wizards/Module_wizards.mk |2 +- wizards/Pyuno_fax.mk | 34 wizards/com/sun/star/wizards/fax/CallWizard.py | 175 wizards/com/sun/star/wizards/fax/fax.component |6 +- 11 files changed, 87 insertions(+), 152 deletions(-) create mode 100644 wizards/Pyuno_fax.mk diff --git a/instsetoo_native/util/makefile.mk b/instsetoo_native/util/makefile.mk index 6880750..fc1cc61 100644 --- a/instsetoo_native/util/makefile.mk +++ b/instsetoo_native/util/makefile.mk @@ -74,6 +74,7 @@ LOCALPYFILES= \ $(BIN)$/pythonloader.py \ $(BIN)$/officehelper.py \ $(BIN)$/mailmerge.py \ +$(BIN)$/CallWizard.py \ $(BIN)$/msgbox.py .ENDIF diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 998ab38..85d4480 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -400,7 +400,7 @@ /node node oor:name=m1 oor:op=replace install:module=writer prop oor:name=URL oor:type=xs:string - value service:com.sun.star.wizards.fax.CallWizard?start/value + value service:com.sun.star.wizards.fax.CallWizard?insert/value /prop prop oor:name=Title value xml:lang=en-US~Fax.../value diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk index 33f0f01..05bf897 100644 --- a/postprocess/packcomponents/makefile.mk +++ b/postprocess/packcomponents/makefile.mk @@ -370,7 +370,7 @@ my_components += evoab my_components += component/avmedia/source/gstreamer/avmediagstreamer .END -my_ooo_components = mailmerge +my_ooo_components = mailmerge component/wizards/com/sun/star/wizards/fax/fax .INCLUDE: target.mk diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index 61589b6..4583dec 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -472,6 +472,18 @@ STD_JAR_FILE( gid_File_Jar_Saxon, saxon9 ) #endif #endif +#ifndef AIX +#ifndef DISABLE_PYUNO +File gid_File_PyFax +TXT_FILE_BODY; +Dir = gid_Dir_Program; +Name = CallWizard.py; +Styles = (PACKED); +End +#endif +#endif + + #ifndef SYSTEM_LIBTEXTCAT_DATA // fingerprint files (lm) diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index 273f802..c25c87b 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -139,7 +139,7 @@ Module gid_Module_Root_Files_3 gid_File_Jar_Table, gid_File_Jar_Letter, gid_File_Jar_Form, - gid_File_Jar_Fax, + gid_File_PyFax, gid_File_Jar_Agenda, gid_File_Jar_Web, gid_File_Jar_Query, diff --git a/scripting/prj/d.lst b/scripting/prj/d.lst index f1caf45..5deedbe 100644 --- a/scripting/prj/d.lst +++ b/scripting/prj/d.lst @@ -16,6 +16,7 @@ mkdir: %_DEST%\bin\pyuno ..\%__SRC%\lib\lib*static*.dylib %_DEST%\lib\lib*static*.dylib ..\%__SRC%\misc\mailmerge.component %_DEST%\xml\mailmerge.component +..\%__SRC%\misc\fax.component %_DEST%\xml\fax.component ..\%__SRC%\misc\ScriptFramework.component %_DEST%\xml\ScriptFramework.component ..\%__SRC%\misc\ScriptProviderForJava.component %_DEST%\xml\ScriptProviderForJava.component
Re: [Libreoffice] [GSOC] how to call python code from the menu
Hello, I've tried to follow your steps but placing the code in wizards/com/sun/star/wizards/fax/CallWizard.py. So far I haven't been able to build it successfully. It complains and says: ERROR: File not found: CallWizard.py I attach a file with the changes I've done. Greetings 2011/8/17 Caolán McNamara caol...@redhat.com 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_worldimplementation name=org.openoffice.comp.pyuno.demo.HelloWorldservice 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. From ac490d5f468ad36041ecd03e2761481be281c56a Mon Sep 17 00:00:00 2001 From: Xisco Fauli aniste...@gmail.com Date: Tue, 6 Sep 2011 19:39:20 +0200 Subject: [PATCH] call callwizard --- .../registry/data/org/openoffice/Office/Common.xcu |2 +- postprocess/packcomponents/makefile.mk |2 +- scp2/source/ooo/file_ooo.scp | 12 ++ scp2/source/ooo/module_hidden_ooo.scp |1 + scripting/prj/d.lst|1 + wizards/com/sun/star/wizards/fax/CallWizard.py | 175 wizards/com/sun/star/wizards/fax/fax.component |6 +- wizards/com/sun/star/wizards/fax/makefile.mk |8 +- 8 files changed, 56 insertions(+), 151 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 998ab38..85d4480 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -400,7 +400,7 @@ /node node oor:name=m1 oor:op=replace install:module=writer prop oor:name=URL oor:type=xs:string - value service:com.sun.star.wizards.fax.CallWizard?start/value + value service:com.sun.star.wizards.fax.CallWizard?insert/value /prop prop oor:name=Title value xml:lang=en-US~Fax.../value diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk index addc3a2..ff264c8 100644 --- a/postprocess/packcomponents/makefile.mk +++ b/postprocess/packcomponents/makefile.mk @@ -364,7 +364,7 @@ my_components += evoab my_components += component/avmedia/source/gstreamer/avmediagstreamer .END -my_ooo_components = mailmerge +my_ooo_components = mailmerge component/wizards/com/sun/star/wizards/fax/fax .INCLUDE: target.mk diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index e77bdcf..3bc1eee 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -471,6 +471,18 @@ STD_JAR_FILE( gid_File_Jar_Saxon, saxon9 ) #endif #endif +#ifndef AIX +#ifndef DISABLE_PYUNO +File gid_File_PyFax +TXT_FILE_BODY; +Dir = gid_Dir_Program; +Name = CallWizard.py; +Styles = (PACKED); +End +#endif +#endif + + #ifndef SYSTEM_LIBTEXTCAT_DATA // fingerprint files (lm) diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index 9dd3ab1..287e277 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -139,6 +139,7 @@ Module gid_Module_Root_Files_3 gid_File_Jar_Table, gid_File_Jar_Letter, gid_File_Jar_Form, + gid_File_PyFax, gid_File_Jar_Agenda, gid_File_Jar_Web, gid_File_Jar_Query, diff --git a/scripting/prj/d.lst b/scripting/prj/d.lst index f1caf45..5deedbe 100644 --- a/scripting/prj/d.lst +++ b/scripting/prj/d.lst @@ -16,6 +16,7 @@ mkdir: %_DEST%\bin\pyuno ..\%__SRC%\lib\lib*static*.dylib %_DEST%\lib\lib*static*.dylib ..\%__SRC%\misc\mailmerge.component
Re: [Libreoffice] [GSOC] how to call python code from the menu
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. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [GSOC] how to call python code from the menu
On Mon, 2011-08-15 at 19:02 +0200, Xisco Faulí wrote: Hello everybody, before I merge the gsoc branch into master I'd like to integrate the python code into libo and get rid of the java code. I know i have to edit this file http://opengrok.libreoffice.org/xref/core/officecfg/registry/data/org/openoffice/Office/Common.xcu but i can't figure out how to call the python code. I've tried to call this file http://opengrok.libreoffice.org/xref/core/pyuno/demo/hello_world_comp.py using this value: valueservice:org.openoffice.comp.pyuno.demo.HelloWorld?insert/value but it doesn't work. Any idea ? Perhaps hello_world_comp.py isn't registered as a service ? Did you look at how the mailmerge.py example is installed ?, i.e. http://opengrok.libreoffice.org/search?q=mailmerge.py for a python component which is bundled into LibreOffice. You may have to do pretty much the same thing for it be available via service:...?foo out-of-the-box. There's some preamble at the top of mailmerge.py about how to manually register that component for testing purposes, which is probably the archaic way to do it these-days, but probably still works. C. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [GSOC] how to call python code from the menu
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 how libo knows that this service refers to mailmerge.py ? Greetings 2011/8/16 Caolán McNamara caol...@redhat.com On Mon, 2011-08-15 at 19:02 +0200, Xisco Faulí wrote: Hello everybody, before I merge the gsoc branch into master I'd like to integrate the python code into libo and get rid of the java code. I know i have to edit this file http://opengrok.libreoffice.org/xref/core/officecfg/registry/data/org/openoffice/Office/Common.xcubut i can't figure out how to call the python code. I've tried to call this file http://opengrok.libreoffice.org/xref/core/pyuno/demo/hello_world_comp.pyusing this value: valueservice:org.openoffice.comp.pyuno.demo.HelloWorld?insert/value but it doesn't work. Any idea ? Perhaps hello_world_comp.py isn't registered as a service ? Did you look at how the mailmerge.py example is installed ?, i.e. http://opengrok.libreoffice.org/search?q=mailmerge.py for a python component which is bundled into LibreOffice. You may have to do pretty much the same thing for it be available via service:...?foo out-of-the-box. There's some preamble at the top of mailmerge.py about how to manually register that component for testing purposes, which is probably the archaic way to do it these-days, but probably still works. C. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice] [GSOC] how to call python code from the menu
Hello everybody, before I merge the gsoc branch into master I'd like to integrate the python code into libo and get rid of the java code. I know i have to edit this file http://opengrok.libreoffice.org/xref/core/officecfg/registry/data/org/openoffice/Office/Common.xcu but i can't figure out how to call the python code. I've tried to call this file http://opengrok.libreoffice.org/xref/core/pyuno/demo/hello_world_comp.py using this value: valueservice:org.openoffice.comp.pyuno.demo.HelloWorld?insert/value but it doesn't work. Any idea ? ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice