[Libreoffice] [GSOC] Java > Python, problem with uno.invoke

Xisco Faulí anistenis at gmail.com
Fri May 27 17:11:59 PDT 2011


Hello,

I have converted the method setControlProperty in  UnoDialog:
http://opengrok.libreoffice.org/xref/components/wizards/com/sun/star/wizards/ui/UnoDialog.java#149
as follow:

    def setControlProperty(self, ControlName, PropertyName, PropertyValue):
        try:
            if PropertyValue:

                if self.xDialogModel.hasByName(ControlName) == False:
                    return
                xPSet = self.xDialogModel.getByName(ControlName)
                if isinstance(PropertyValue,tuple):
                    uno.invoke(xPSet, "setPropertyValue", (PropertyName,
uno.Any( \
                        "com.sun.star.beans.PropertyValue",PropertyValue)))
                else:
                    xPSet.setPropertyValue(PropertyName, PropertyValue)

        except Exception, exception:
            traceback.print_exc()

but I get this Exception:

  File "/usr/lib/python2.6/dist-packages/uno.py", line 249, in invoke
    return pyuno.invoke( object, methodname, argTuple )
com.sun.star.uno.RuntimeException: value is not of same or derived type!

as vmiklos told me in IRC the third parameter of invoke should be a tuple of
PropertyValue but in the Java code the variable PropertyValue  is a Bool or
a list of strings.

Anybody knows can I solve it ?

Greetings
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110528/2a4224b8/attachment.html>


More information about the LibreOffice mailing list