Development/Tutorials/Plasma4/Python/Writing DataEngines

< Development‎ | Tutorials‎ | Plasma4
Revision as of 08:48, 24 January 2009 by Einar (Talk | contribs)

Jump to: navigation, search


As you have seen in the using DataEngines tutorial, Plasma applets can make use of DataEngines to visualize data of many different kinds. In fact, the already available DataEngines offer many options for your applets. But what if you have a specific need, not covered by those?

The problem is easily solved by writing your own Plasma DataEngine, and this tutorial will show you how to create one.


As with applets, DataEngines need the same directory structure (see the Getting Started tutorial), so the first step is to create the appropriate directories. The difference with respect to applets lies in the metadata.desktop file:

[Desktop Entry] Name=Python Date and Time Comment=Python Time data for Plasmoids Type=Service Icon=preferences-system-time ServiceTypes=Plasma/DataEngine X-Plasma-API=python

X-KDE-PluginInfo-Author=Simon Edwards X-KDE-PluginInfo-Name=plasma-dataengine-pytime X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-Website= X-KDE-PluginInfo-Category=Python Date and Time X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=LGPL X-KDE-PluginInfo-EnabledByDefault=true

Take a look at the ServiceType line. When using applets, it was "Plasma/Applet", but since now we're dealing with DataEngines, its value is "Plasma/DataEngine".

Main script

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal