[790] | 1 | #!/usr/bin/env python
|
---|
| 2 | # -*- coding: utf-8 -*-
|
---|
| 3 |
|
---|
[791] | 4 | """
|
---|
| 5 | kreadconfig.py dumps KDE configuration files.
|
---|
| 6 | It is usefull for debugging KDE Kiosks settings,
|
---|
| 7 | where multiple config files are merged into the final configuration.
|
---|
| 8 |
|
---|
| 9 | The directory hierarchie for config files
|
---|
| 10 | is based on the KDEDIRS environment variable
|
---|
| 11 | and can be made visible by the command
|
---|
| 12 | kde4-config --path config
|
---|
| 13 |
|
---|
| 14 | kreadconfig has a similiar purpose,
|
---|
| 15 | but is limited to a single value
|
---|
| 16 | """
|
---|
| 17 |
|
---|
| 18 | # $Id: kreadconfig.py 791 2009-09-02 13:37:29Z joergs $
|
---|
| 19 |
|
---|
[790] | 20 | import sys
|
---|
| 21 | from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs, KConfig
|
---|
| 22 | from PyKDE4.kdeui import KApplication
|
---|
| 23 |
|
---|
| 24 | #import pprint
|
---|
| 25 | #pp = pprint.PrettyPrinter(indent=4)
|
---|
| 26 |
|
---|
| 27 | def getFullName( config ):
|
---|
| 28 | if config.name() == "<default>":
|
---|
| 29 | return ""
|
---|
| 30 | else:
|
---|
| 31 | if config.parent():
|
---|
| 32 | parentsNames = getFullName( config.parent() )
|
---|
| 33 | return parentsNames + "[" + config.name() + "]"
|
---|
| 34 |
|
---|
| 35 | def dumpGroup( config ):
|
---|
| 36 | print getFullName( config )
|
---|
| 37 | for i in config.entryMap():
|
---|
| 38 | print i + ": " + config.readEntry( i )
|
---|
| 39 | print
|
---|
| 40 |
|
---|
| 41 | def dumpSubGroups( config ):
|
---|
| 42 | dumpGroup( config )
|
---|
| 43 | #print dir( config )
|
---|
| 44 | for i in config.groupList():
|
---|
| 45 | configGroup=config.group(str(i))
|
---|
| 46 | dumpSubGroups( configGroup )
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | appName = "KApplication"
|
---|
| 50 | catalog = ""
|
---|
| 51 | programName = ki18n ("KApplication")
|
---|
| 52 | version = "1.0"
|
---|
| 53 | description = ki18n ("KApplication/KMainWindow/KAboutData example")
|
---|
| 54 | license = KAboutData.License_GPL
|
---|
| 55 | copyright = ki18n ("(c) 2009 Jörg Steffens")
|
---|
| 56 | text = ki18n ("none")
|
---|
| 57 | homePage = "www.dass-it.de"
|
---|
| 58 | bugEmail = "rt@dass-it.de"
|
---|
| 59 |
|
---|
| 60 | aboutData = KAboutData (appName, catalog, programName, version, description,
|
---|
| 61 | license, copyright, text, homePage, bugEmail)
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | KCmdLineArgs.init (sys.argv, aboutData)
|
---|
| 65 | app = KApplication ()
|
---|
| 66 |
|
---|
| 67 | config = KConfig("plasma-desktoprc")
|
---|
| 68 |
|
---|
| 69 | for i in config.groupList():
|
---|
| 70 | configGroup=config.groupImpl(str(i))
|
---|
| 71 | dumpSubGroups( configGroup )
|
---|