[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: [PATCH] Support for arbitrary main script names in Python
From:       Luca Beltrame <einar () heavensinferno ! net>
Date:       2010-02-11 18:48:33
Message-ID: 201002111948.36887.einar () heavensinferno ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


In data giovedì 11 febbraio 2010 19:37:55, Richard Dale ha scritto:

> __dict__, but simply derives the main class name from the main script
> name. So I wasn't sure is you should specifiy a main *class* name in

This is what is done with my change, at the moment (I used __dict__ because I 
thought it was the best solution - suggestions welcome in case as I'm not that 
experienced). Earlier, the main script name was forced to be called "main" or 
it would cause errors. 

> For Python, what if there are several classes in the the python main
> script file - how do you tell which one is for the applet you want to
> instantiate?

You use the one that's called by CreateApplet, which needs to be put in the 
main script file:

class FooApplet(plasmascript.Applet):
    ...

def CreateApplet(parent):
    return FooApplet(parent)

and the relevant bit is then called in the initialization:

self.pyapplet = self.module.__dict__[basename].CreateApplet(None)

so CreateApplet should *always* return the right applet and must be in the 
main script file.


["signature.asc" (application/pgp-signature)]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic