[Libreoffice] [GSOC] Java > Python, problem with uno.invoke
anistenis at gmail.com
Sat May 28 05:57:57 PDT 2011
It's funny how close I was to the solution and the time it took me to find
uno.invoke(xPSet, "setPropertyValue", (PropertyName,
Thank you John for your answer.
2011/5/28 John LeMoyne Castle <jlc at mail2lee.com>
> Hi Xisco,
> I think your Java->Python porting project is awesome. My experience is
> on many counts here: Java, Python, pyuno and LibreOffice, but I have been
> curious about them all, so I dove in a little on your question.
> My short answer of encouragement: Yes, you can solve it!
> One question is how are you treating PropertyValue?
> If PropertyValue can still be either boolean or a list of strings (in your
> Python as in the Java) then your initial test "If PropertyValue:" may
> prevent setting *any* property to false. I think this safety check is moot
> anyway: Python will complain and quit before calling the setControlProperty
> function with nothing as the third argument object.
> I see that the invoke call is new - nice to see the setControlProperty
> function actually setting the property on the control ;-) I think the path
> that call takes is through the extern C static invoke at:
> through PYUNO_invoke at:
> where it seems that the Any wrapper is optional (!!). If you do pass
> PYUNO_invoke a tuple of Anys it just unpacks them before making a call
> object.name(tuple of args)
> I see that the Any wrapper is required to make calls through the
> Adapter::invoke here:
> --- but I'm sure you are not calling that invoke as it has a very different
> signature. The extern C static invoke function requires the third arg to
> a tuple, so I think it is sufficient to test for tuple type and then make
> the singletons a tuple of 1 before the invoke call.
> Finally, from the way PYUNO_invoke turns the ControlName and PropertyName
> into the callable function object, I think that passing the PropertyName as
> the second argument is sufficient - it doesn't need to go in the tuple as
> My understanding is that Java needs the Any foo to pass both simple types
> and objects as generic objects whereas everything in Python is an object so
> ... your Python glue code may often be simpler than the original Java.
> Please remember I'm no expert -- I just spent a few hours on this to start
> to dig into pyuno while doing a full LibreOffice build ...
> Hope This Helps,
> View this message in context:
> Sent from the Dev mailing list archive at Nabble.com.
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the LibreOffice