The new plasma engine of KDE 4.x introduced plasmoids. Plasmoids are small dialogs which are embeddable within the KDE desktop. They are used as monitoring, rss reader, quick application access dialogs and so on. I use plasmoids for the remoting monitoring of my root server. Plasmoids can be implemented in C/C++, Ruby, Python, Java, et cetera. The following example ( derived from KDE tutorial) describes an easy hello world plasmoid:
(1) First you create the plasmoid project directory and all necessary files:
helloWorld (dir)(2) metadata.desktop:
- metadata.desktop (file) - contents (dir) - code (dir) - main.py (file)
[Desktop Entry] Encoding=UTF-8 Name=Hello World Example Name[tr]=Rafael Sobek Type=Service ServiceTypes=Plasma/Applet X-Plasma-API=python X-Plasma-MainScript=code/main.py Icon=applications X-KDE-PluginInfo-Author=Rafael Sobek X-KDE-PluginInfo-Email=info@test.org X-KDE-PluginInfo-Name=helloWorld X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Website=http://developers-blog.org X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=LGPL(3) main.py:
#from PyQt4.QtCore import * from PyQt4.QtGui import * from PyKDE4.plasma import Plasma from PyKDE4 import plasmascript class HelloWorldApplet(plasmascript.Applet): def __init__(self,parent,args=None): plasmascript.Applet.__init__(self,parent) def init(self): self.resize(200, 200) self.setAspectRatioMode(Plasma.IgnoreAspectRatio) # No configuration interface supported self.setHasConfigurationInterface(False) def paintInterface(self, painter, option, rect): painter.save() painter.setPen(Qt.white) painter.drawText(rect, Qt.AlignVCenter | Qt.AlignHCenter, "Hello developers-blog.org!") painter.restore() def CreateApplet(parent): return HelloWorldApplet(parent)
After that you zip the plasmoid project directory (helloWorld.zip) and install the plasmoid with the following command.
plasmapkg -i helloWordAfter that you can test your installed plasmoid with:
# without suffix (.zip) plasmoidviewer helloWorld
Regards
Rafael Sobek
Technorati Tags: KDE Plasmoid Monitoring Python

Quick note, it should be "plasmapkg -i helloWord.zip" instead of "plasmapkg -i helloWord" (i.e. you just give the filename to plasmapkg).
Installed plasmoids can also be found in the "add widget" dialog screen.