Problems with configuration of Plasmoid (Python)

Alexander Fischer alexanderfischer at o2online.de
Fri Jul 3 09:46:55 CEST 2009


Hello everybody,


i am new to the list, so I won't hope, this was asked before. I am  
currently writing a Python-based plasmoid (my first one) and I'm  
struggling a lot with the configuration interface of the  
plasmascript.Applet.

I am using the KConfig XT Interface of the plasmascript.Applet and created  
the required files
   content/code/main.py
   content/ui/config.ui
   content/conf/main.xml

The configuration dialog of the plasmoid appears when calling it but the  
apply-Button is disabled and i get these error messages:

plasmoidviewer(30748)/libplasma Plasma::AppletPrivate::mainConfigGroup:  
requesting config for "FontSizer" without a containment!
plasmoidviewer(30748)/kdecore (KConfigDialogManager)  
KConfigDialogManager::parseChildren: A widget named ' "kcfg_reduzeFont" '  
was found but there is no setting named ' "reduzeFont" '
plasmoidviewer(30748)/kdecore (KConfigDialogManager)  
KConfigDialogManager::parseChildren: A widget named ' "kcfg_increaseFont"  
' was found but there is no setting named ' "increaseFont" '
plasmoidviewer(30748)/kdecore (KConfigDialogManager)  
KConfigDialogManager::parseChildren: A widget named ' "kcfg_smallSize" '  
was found but there is no setting named ' "smallSize" '



The content/ui/main.xml file looks as follows.

<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
                            http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"

     <kcfgfile />
     <group name="General">
         <entry name="increaseFont" key="increaseFont" type="Int">
             <label>Step size while increasing font size</label>
             <default>1</default>
             <min>1</min>
             <max>99</max>
         </entry>
         <entry name="reduzeFont" key="reduzeFont" type="Int">
             <label>Step size while reduzing font size</label>
             <default>1</default>
             <min>1</min>
             <max>99</max>
         </entry>
         <entry name="smallSize" key="smallSize" type="Int">
             <label>Smallest font size</label>
             <default>3</default>
             <min>1</min>
             <max>99</max>
         </entry>
     </group>
</kcfg>

I have no idea what's going on here and what I am doing wrong. As I  
understand the situation, the required settings are there.

Another point is, that I don't know, how to call the entries from inside  
the KConfigGroup config() of the plasmascript.Applet correctly. My derived  
class looks like this.

class fontSizer(plasmascript.Applet):
   def __init__(self, parent, args=None):
     plasmascript.Applet.__init__(self, parent)
     ...

   def init(self):
     self.doConfig()
     ...

   def doConfig(self):
     self.setHasConfigurationInterface(True)
     QObject.connect(self.configScheme(), SIGNAL('configChanged()'),  
self.readConfig)
     self.readConfig()

   def readConfig(self):
     smallSize = self.fontHandler.smallSize
     tmp = self.config('General').readEntry('smallSize')
     if tmp.isEmpty():
       tmp = smallSize
     self.fontHandler.smallSize = int(tmp)
     ....



But I don't know, if this is correct or the correct way to access the  
configuration data.

Are there any suggestions, examples, lyrics or tutorials on this?

Thanks a lot! Plasma is impressive.



With best regards
Alexander Fischer


More information about the Plasma-devel mailing list