[Libreoffice-bugs] [Bug 129437] New: [PYUNO] "setPropertyValue" method does not accept particular Enum value

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Dec 16 21:12:08 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=129437

            Bug ID: 129437
           Summary: [PYUNO] "setPropertyValue" method does not accept
                    particular Enum value
           Product: LibreOffice
           Version: Inherited From OOo
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: minor
          Priority: medium
         Component: framework
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: jeanmarczambon at gmail.com

Description:
Given the following python code:

import uno
from com.sun.star.awt.PushButtonType import OK
def enum_error():
    ctx = uno.getComponentContext()
    button_model =
ctx.ServiceManager.createInstance("com.sun.star.awt.UnoControlButtonModel")
    button_model.PushButtonType = OK
    button_model.setPropertyValue("PushButtonType", OK)

The penultimate line passes, while the last one raises the following error:

<class 'uno.com.sun.star.lang.IllegalArgumentException'>: Unable to convert the
given value for the property PushButtonType.
Expected type: short
Found type: com.sun.star.awt.PushButtonType


The workaround is obvious with "setPropertyValue" method, but the convenient
and more efficient "setPropertyValues" raises the same error without as
efficient alternative, as far as I understand.



Steps to Reproduce:
1. Copy and run the small python script above from within a LibreOffice
session.


Actual Results:
Error raised at last line (see error message in above description)

Expected Results:
Last line should pass without error, as per the penultimate line.


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: fr
Module: TextDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20191216/c2a8291e/attachment.htm>


More information about the Libreoffice-bugs mailing list