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.

On Thursday, 19. February 2009 21:15:47 Aaron J. Seigo wrote:
> On Thursday 19 February 2009, Benjamin Kleiner wrote:
> >   I have played around with the python bindings for plasma, and I noticed
> > that the config dialog can't be "hijacked",
>
> so my question to you is, why do you want to do this?
>
> > since
> > plasmascript.Applet.createConfigurationInterface() won't get called, thou
> > you can use showConfiguration to completely override it. Is it supposed
> > to be this way, and if yes, why?
>
> yes, it is supposed to be this way. of course, it is up to the script
> engine itself. it can provide a way to "hijack" the config dialog, but in
> the case of native plasma widgets that's highly discouraged.
>
> ... which brings us back to the first question ;)

To answer it all at once and with your own words:
> The Right Approach: reimplement createCofigurationInterface, create your
> config dialog page(s) in there and add them to the KConfigDialog you receive
> with the addPage method
>
> The Less Right Approach: reimplement showConfigurationInterface and do it all
> from scratch. you will lose certain amounts of Plasma integration this way
> (e.g. the "for free" keyboard shortcut page) making it "less right". sometimes
> it's necessary.
I also like to quote another mail further in the linked thread:
> while i'm sure you want your dialog to be its own unique flower in the field,
> consider that consistency is far more important than anything you could ever
> hope to achieve with this approach.
Maybe you misunderstood me 'cause I used the phrase hijacking to describe what 
I wanted:
To simply add pages to the standard config dialog, so I get a consistent look 
and feel.
The code given above is, as you called it, the less right way, though it does 
the thing.
It would just be nice if this would take place in plasmascript.Applet (like the 
ruby peeps did), or, even better, a real call with the same 
KConfigDialog-Object used in C++,
so we don't have to rewrite it everytime we do a new applet. Plus newcomers 
wouldn't clutter the consistency experience with tabbed config dialogs if they 
would be forced to use 
showConfigurationInterface.

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to