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

            Bug ID: 171122
           Summary: pyuno should support service constructors and
                    singletons
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: sdk
          Assignee: [email protected]
          Reporter: [email protected]

Description:
The “new-style” services have named constructors with a specific set of typed
parameters. You can use these in C++, Basic, .net, Java etc but currently not
in Python. Instead you have to use the “createInstanceWithArgumentsAndContext”
method of the service manager which takes the arguments as an array. These are
than validated ad-hoc in the implementation of the service.

For example, instead of this:

    xModuleAccelCfg = self.xContext.ServiceManager.createInstanceWithArguments(
        'com.sun.star.ui.ModuleAcceleratorConfiguration',
        ('com.sun.star.text.TextDocument',))

you could do this:

    from com.sun.star.ui import ModuleAcceleratorConfiguration
    xModulAccelCfg = ModuleAcceleratorConfiguration.createWithModuleIdentifier(
        self.xContext, 'com.sun.star.text.TextDocument)

The same goes for accessing singletons. Instead of this:

    desktop = ctx.getValueByName(
        "/singletons/com.sun.star.frame.theDesktop")

it would be nice to be able to do this:

    from com.sun.star.frame import theDesktop
    desktop = theDesktop.get(ctx)


Actual Results:


Expected Results:



Reproducible: Always


User Profile Reset: No

Additional Info:
See also tdf#169229

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to