source: kde/kreadconfig/kreadconfig.py@ 792

Last change on this file since 792 was 792, checked in by joergs, on Sep 2, 2009 at 3:48:54 PM

more comments

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