telling a data engine to reload a source

Aaron J. Seigo aseigo at kde.org
Thu Feb 9 13:48:39 UTC 2012


On Tuesday, February 7, 2012 13:56:32 Eric Mesa wrote:
> I have a data engine that grabs some data off the web, chugs it and then
> presents it to my plasmoid.  How could my plasmoid tell the data engine
> that its data is now out of date and it should regrab its data?  Even
> better would be the ability to tell it to update only one of its 20 sources.

this is almost certainly an incorrect usage of the dataengine design.

the plasmoid (almost) never tells the engine when to reload. how can it when 
it is simply a visualization of the data? if the visualization knows such 
things, it is not longer a visualization. if the dataengine does not know such 
things then it is no longer a true manager of data.

no. the dataengine itself must know when and how to reload data. the only 
thing a visualization can do is request updates every N ms (time based 
updates).

if the plasmoid wants to reload the data after a certainly timelapse, then use 
that feature in the connectToSource call.

if the data is outdated by some event, then the DataEngine should know how to 
react to that event.

if, for some unfortunate reason, it is due only to user interaction in the 
visualization then the DataEngine needs to provide a Service (returned by 
serviceForSource in the DataEngine implementation) that can be used by the 
visualization.

however, i would strongly encourage you to first ensure that the use case is 
actually correct.

cheers ...

-- 
Aaron J. Seigo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20120209/2e7e4256/attachment.sig>


More information about the Plasma-devel mailing list