Python plasmoid - can't read value from config

Alex Dancu alex.dancu at gmail.com
Mon Apr 9 19:01:08 UTC 2012


Hi,

I have this problem with a python plasmoid.

I'm trying to persist and then get back from the configuration the 
plasmoid settings. I have tried to persist first a single String 
property with no success at all in getting it back. I tried to cast -  
config.readEntry(QString('k123sensors')) but still no success.

      def writeConfig(self):
         self.config().writeEntry('k123sensors', 'bla')

     def readConfig(self):
         config = self.config()
         val = config.readEntry('k123sensors')
         if type(val) == QVariant:
             print str(val.toString())
         else:
             print val

No matter what I've tried, it seems I can't read the value back from 
configuration.

There are 2 config files in ~/.kde/share/config, and the value is 
persisted in both of them:

plasmoidviewerrc:
-------------------------
[StoredApplets][MySensorsDev]
Share=false
k123sensors=bla


plasmoidviewer-appletsrc:
----------------------------------
[Containments][1][Applets][2]
geometry=0,0,210,200
immutability=1
plugin=MySensorsDev
zvalue=0

[Containments][1][Applets][2][Configuration]
Share=false
k123sensors=bla

Am I doing something wrong?

Thanks,
Alex


More information about the Plasma-devel mailing list