Plasma.ToolTipManager and Plasma.Applet

Thomas Olsen tanghus at gmail.com
Thu Oct 14 13:17:35 CEST 2010


I have no idea if this belongs to kde-bindings or plasma-devel, so I'll have to do
the unmentionable thing and crosspost. Sorry.

I finally got a working python PopupApplet and now I want it to show the fancy
tool tip when hovering over it in the panel.

So reading about it in [1] and [2] it seems rather straight forward. [2] states 
that "... since a Plasma::Applet is a QGraphicsWidget, you can use 
Plasma::ToolTipManager::self()->setContent(this, data); in the applet's init()
method to set a tooltip for the whole applet."

After failing at first attempts I made a simplified Applet which basically is this:

class PyPopupApplet(Applet):

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

  def init(self):
    self._widget = PyPopup(self) # A QGraphicsWidget
    self._widget.init()
    
    self.setGraphicsWidget(self._widget)
    self.setPopupIcon('text-x-python')
    # for some odd reason this has to be called twice..?
    self.setGraphicsWidget(self._widget)

    # Tool tip for panel
    self.metadata = self.package().metadata()
    data = Plasma.ToolTipContent()
    data.mainText = self.metadata.name()
    data.subText = self.metadata.description()
    data.image = KIcon(self.metadata.pluginName())
    Plasma.ToolTipManager.self().setContent(self, data)

But it fails miserably with:
"TypeError: ToolTipManager.setContent(): argument 1 has unexpected type 'PyPopupApplet'"
and the plasmoidviewer crashes.

Have I again misunderstood something or should I file a bugreport against the python bindings?

[1] http://api.kde.org/pykde-4.5-api/plasma/Plasma.ToolTipManager.html
[2] http://api.kde.org/4.5-api/kdelibs-apidocs/plasma/html/classPlasma_1_1ToolTipManager.html

-- 
Best regards / med venlig hilsen

Thomas Olsen

Dropbox and my thumb drive had an epic battle. Dropbox won. http://db.tt/T0p6d6L
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20101014/366ffab8/attachment.sig 


More information about the Plasma-devel mailing list