getting started with plasmoid development

Aaron J. Seigo aseigo at kde.org
Mon Dec 15 23:42:06 CET 2008


On Monday 15 December 2008, D. R. Evans wrote:
> Aaron J. Seigo said the following at 12/15/2008 03:04 PM :
> > On Monday 15 December 2008, D. R. Evans wrote:
> >> I want to write some plasmoids. However, it looks incredibly complicated
> >> compared to (say) writing a superkaramba theme.
> >
> > what sort of plasmoid(s) are you thinking of taking a crack at?
>
> Probably graphs of solar flux and/or geomagnetic activity; something simple
> to start with :-)

cool.

> > with SK, you'd most commonly use the provided widgets and hook them up to
> > sensors. in plasma, it's very similar, though instead of "sensors" we use
> > "DataEngines".
>
> That makes me feel a lot easier about the process. As is often the case
> with trying to do something completely new, the hard part is just trying to
> figure out exactly how to start. Documentation and examples are invaluable,
> so when one doesn't have them, it can all be very intimidating.

yes; we really need to work on our dev docs in 4.3 .. and someday get that dev 
studio app going =)

> > if you can describe what you'd like to do, i can probably give you some
> > starting points at least =)
>
> The simplest starting case I can think of:
>
> every N minutes:
>   download datafile from NOAA
>   parse the file for the desired data (i.e., what the user wants to be
> plotted) plot the data for the last H hours
>   display the plot

so, the "Plasma Way" to do this would be to create a DataEngine that handles 
the NOAA part. it would download and parse the data for the Applet. the Applet 
would connect to it by doing something like (assuming you called your 
dataengine "noaa", probably a better name for it ;):

int updateInterval = 5 * 60 * 1000; // update every 5 minutes
dataEngine("noaa")->connectSource("solarflux", this, updateInterval);

every updateInterval, the engine will get an updateSourceEvent("solarflux") to 
start a new data download.

in the Applet part, for plotting we have Plasma::SignalPlotter ... it's a bit 
of a beast, but rather powerful.

you'd make a dataUpdated(const QString &sourceName, const 
Plasma::DataEngine::Data &data) method in your applet (or whatever you connect 
the source to) .. sourceName would be "solarflux" in this example, and the data 
would contain whatever the engine sends your way.

the updateInterval, engine loading, etc is all handled automagically for you.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20081215/ab7c8c8c/attachment.sig 


More information about the Plasma-devel mailing list