2005/11/19, Joerg Budischewski <[EMAIL PROTECTED]>:
Sure I have already looked in the scripting framework chapter in the SDK dev guide, with no luck.
OK, I'll try this if I cannot figure my problem.
That's what I have done. In fact, my problem is that whatever the "invoke" method returns (when called for a deletion at file or dir level, which is the simplest case), OOo shows an error message telling the action could not be performed.
In the scripting sources, I have found an example code (in java, namely $SRC/scripting/examples/java/selector/ScriptSelector.java) that implement the script organizer (I cannot figure if it is the actual code that implement tha Python scripts Organizer or not). It does the "invoke" method call, and the waited result is what I guessed : a boolean for deletion and rename of a script, a XBrowseNode instance for a creation.
I do return a python 'True' , which is not enought to make it work happily!
I'am afraid I will really habe to compile (at least some part of) OOo with debug turned on.
But I would really like to avoid this (my laptop on which I do this pyuno hacking is not a monster). But as I have to idea of what happen after the "return True" statement occur...
thanks,
David
> Hi,
> I am also working on the pythonscript.py file. There are several things I
> find... let's say strange in it, thus I am trying to make it more usable (and
> more pythonic).
>
> My main goal for now it to provide the standard create/rename/delete/edit
> functions so it is much more easy to create python scripts from OOo.
> My problem for now is I cannot find info on what the "invoke" method should
> return, and what should it actually do when called with "Creatable" for
> example.
I am also not very familar with these things, but you should have a look at
http://framework.openoffice.org/scripting/ScriptingFrameworkChapter.pdf
where some explanation can be found (but I think won't help you in your
concrete case). The document is linked from the scripting framework
homepage:
http://framework.openoffice.org/scripting/index.html
Sure I have already looked in the scripting framework chapter in the SDK dev guide, with no luck.
You should post questions on the scripting framework API itself
separately ( e.g. in the [email protected] or
[email protected] group ), don't know whether they follow
"pure" pyuno threads in this list.
OK, I'll try this if I cannot figure my problem.
> In case I am right (the invoke method should return a XBrowseNode
> capable
> object), can I just return a python instance of the FileBrowseNode
> class ?
Note that there is a 3 Level hierarchy in the pythonscript.py
PythonScriptProvider->DirBrowseNodes->FileBrowseNode->ScriptBrowseNode
(0...n) (0...n) (0...n)
So on the event Creatable you must either create
- a Directory (in PythonScriptProvider)
- a File in a directory (in DirBrowseNode)
- a Script in a file (in FileBrowseNode)
. Note that as far as I understand it does not make sense to implement
Creatable in a ScriptBrowseNode, I guess this is your problem ? Because
the above three do not yet support XInvocation and XPropertySet, you'll
need to add support for them before.
That's what I have done. In fact, my problem is that whatever the "invoke" method returns (when called for a deletion at file or dir level, which is the simplest case), OOo shows an error message telling the action could not be performed.
In the scripting sources, I have found an example code (in java, namely $SRC/scripting/examples/java/selector/ScriptSelector.java) that implement the script organizer (I cannot figure if it is the actual code that implement tha Python scripts Organizer or not). It does the "invoke" method call, and the waited result is what I guessed : a boolean for deletion and rename of a script, a XBrowseNode instance for a creation.
> ShouldI explicitely make it a Any object before returning it ?
no, at 99% you must completely ignore anys, just return an instance of
XBrowseNode.
> I also noticed that with "Deletable" as parameter value, the invoke method
> returns a "True", but I cannot make it work either.
What do you return ? A python True should do it, a simple 1 won't.
I do return a python 'True' , which is not enought to make it work happily!
But I would really like to avoid this (my laptop on which I do this pyuno hacking is not a monster). But as I have to idea of what happen after the "return True" statement occur...
Bye,
Joerg
thanks,
David
