This forum has been archived. All content is frozen. Please use KDE Discuss instead.

no access to extender() from python applet

Tags: None
(comma "," separated)
screamnAbdab
Registered Member
Posts
5
Karma
0
Ive built myself a nice little plasmoid to stream sirius radio but I've had to workaround a few issues that I'd like to learn a bit more about.

For starters, I was unable to call self.extender() from my python applet. I was hoping to use an extender to display my favorite channels. For now, I've just embedded the list of favorites in the applet.

In my init() method, if I call self.extender(), I get the following error:

Code: Select all
  File "//usr/share/apps/plasma_scriptengine_python/pyappletscript.py", line 55, in init                                                                                 
    self.pyapplet.init()                                                             
  File "/home/ben/.kde4/share/apps/plasma/plasmoids/knine-radio/contents/code/main.py", line 40, in init                                                                 
    self.extender()                                                                 
RuntimeError: no access to protected functions or signals for objects not created from Python                             


So, why would I be getting this error?

Thanks
Ben (newbie)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Please see: http://api.kde.org/4.x-api/kdelibs-apid ... pplet.html
Only the Class and its Subclasses are able to access Protected functions, therefore you are not subclassing your applet correctly.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
screamnAbdab
Registered Member
Posts
5
Karma
0
I followed the python plasma tutorial when creating this applet. Here is the code of interest...

Code: Select all
class KnineRadio(plasmascript.Applet):

    def __init__(self, parent, args=None):
        plasmascript.Applet.__init__(self, parent)
       
    def init(self):
   self.theme = Plasma.Theme.defaultTheme()
        self.layout = QGraphicsLinearLayout(Qt.Vertical, self.applet)
   self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
   self.initHeader()
   self.initPlayer()
   self.initBody()
        self.initTimer()
   self.resize(250, 200)
   self.setLayout(self.layout)
        # call self.extender() here will throw the exception
        self.extender()


Is this not right? Thanks.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Sorry, I do not know Python....


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
nik3nt3
Registered Member
Posts
5
Karma
0
OS
Hy, did you find a solution for that problem? I would really like to add extenders to my new plasmiod...

/thx


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]