discrepancy in python bindings for plasma

Richard Dale richard.j.dale at gmail.com
Fri Feb 20 12:57:18 CET 2009


2009/2/19 Aaron J. Seigo <aseigo at kde.org>

> On Thursday 19 February 2009, Benjamin Kleiner wrote:
> > On Thursday, 19. February 2009 16:55:38 Thomas Coopman wrote:
> > > I have been running in the same problem and have looked a bit at the
> code
> > > and it looks like createConfigurationInterface is not in AppletScript
> so
> > > there are some changes needed to solve this.
> > >
> > > But if it is possible to use showConfiguration and get the same dialog
> I
> > > would like to know how too.
> >
> > Well, the following code emulates the wanted behaviour relatively well:
> >
> >       def showConfigurationInterface(self):
> >               dialog = KPageDialog()
> >               dialog.setFaceType(KPageDialog.List)
> >               dialog.setButtons( KDialog.ButtonCode(KDialog.Ok |
> KDialog.Cancel) )
> >               #The assignment of actions to the buttons happens in
> > createConfigurationInterface(), as proposed.
> > self.createConfigurationInterface(dialog)
> >               dialog.exec_()
> >
> > It works nice, but you currently have to rewrite it every time you make a
> > new applet, which is kind of annoying.
>
> ah, so this is a shortcoming of the python scriptengine ... which in turn
> is a
> limitation in AppletScriptEngine in that you can't get the "standard"
> Plasma
> config dialog from there. som
>
> ething like the attached patch which could then be used by the python
> engine
> to provide a nice method in the interpreter (e.g.
> createConfigurationInterface)

The patch doesn't look like it will work to me, in applet.cpp:

     } else if (d->script) {
         d->script->showConfigurationInterface();
     } else {
-        d->generateGenericConfigDialog();
+        d->generateGenericConfigDialog()->show();
     }

Here because 'if (d->script)' is true, it will call
showConfigurationInterface on the scripting engine which doesn\'t have the
KConfigDialog stuff in it.

Personally I would rather Simon added the python code as per Benjamin's
mail, to the python version of the showConfigurationInterface() method as
per the Ruby and C# implementations.

A few months ago I did post a mail saying that I would have prefered the
hook method in the scripting engine to be createConfigurationInterface() and
not showConfigurationInterface(), but Aaron thought that it wouldn't be
generic enough as it would be assuming all script engines would want kde
style dialogs. Which seems fair enough to me.

-- Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20090220/b0854447/attachment-0001.htm 


More information about the Plasma-devel mailing list