Python plasmoid works in plasmoidviewer but not in Plasma

Sebastian Kügler sebas at kde.org
Tue Apr 3 12:25:58 UTC 2012


On Sunday, April 01, 2012 17:58:31 Alex Dancu wrote:
> Thanks, it worked.
> 
> Is there a variable or something that I can check at runtime to see if 
> my plasmoid is running in plasmoidviewer or not?

That's definitely not recommended. You'll want to make your code work if there 
are sources already present *and* if they still have to appear. The rest is 
entirely transparant to the app.

> if in_plasmoidviewer:
>       self.connect(self.lmSensorsEngine, SIGNAL('sourceAdded(const 
> QString &)'), self, SLOT('addSource(const QString &)'))
> else:
>      for sourceName in self.lmSensorsEngine.sources():
>              self.addSource(sourceName)
> 
> Thanks,
> Alex
> 
> On 03/31/2012 09:45 PM, Shaun Reich wrote:
> > because when it's in plasma-desktop, all of the sources are already
> > created. but in plasmoidviewer, it's starting everything from scratch.
> > i'm guessing that's the problem, so you just need to iterate over
> > dataengine::sources() on init.
-- 
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9


More information about the Plasma-devel mailing list