Python Plasmoids - 2 Questions

Michael Zimmermann mz at incunabulum.de
Thu May 19 13:30:04 CEST 2011


Hi there,

well, I am not exactly shure that I am on the right list here, yet
somewhere Aron's words about heading over to plasma-devel for any
qestions still ring in my head. If I am wrong, where should I ask instead?

So, currently I am working on a python plasmoid (first time plasmoid
development for me) and am currently struggling with two issues, namely:

1) dbus calls:

How do I write the following C++ call in python?
QDBusInterface("org.kde.krunner", "/App",
"org.kde.krunner.App").call(QDBus.NoBlock, "showTaskManager");

QDBusInterface is not wrapped by PyQT so that I should propably use the
dbus module. And then? How?

2) Implement toolTipAboutToShow():
In my plasmoid and to save cpu cycles I want to do some actions only
before / while showing a tooltip. For this purpose, the
toolTipAboutToShow() function can be used, I think. Unfortunatly, the
following snippet shows a working tooltip, yet the toolTipAboutToShow()
function of my class is never called but the following error / warning
is shown:
QMetaObject::invokeMethod: No such method
Plasma::Applet::toolTipAboutToShow()

So, how do I override toolTipAboutToShow with my own implementation?



class SimpleCpuMeter(plasmascript.Applet):

        def __init__(self,parent,args=None):
                plasmascript.Applet.__init__(self,parent)

        def init(self):
            ...
            self.setHasConfigurationInterface(False)
            self.initToolTip()


        def initToolTip(self):
            self.tooltipdata = Plasma.ToolTipContent()
            self.tooltipdata.setMainText("System Information")
            self.tooltipdata.setImage(KIcon('view-statistics'))
            Plasma.ToolTipManager.self().registerWidget(self.applet)
            self.updateToolTip()


        def toolTipAboutToShow(self):
            print("toolTipAboutToShow")


Thanks, Michael


More information about the Plasma-devel mailing list