Ignore:
Timestamp:
Feb 1, 2010, 4:20:49 PM (14 years ago)
Author:
joergs
Message:

added program to dump all KDE resource types

File:
1 copied

Legend:

Unmodified
Added
Removed
  • kde/kreadconfig/kread-ressource.py

    r816 r817  
    33
    44"""
    5 kreadconfig.py dumps KDE configuration files.
     5kread-ressource.py dumps a KDE configuration file.
    66It is usefull for debugging KDE Kiosks settings,
    77where multiple config files are merged into the final configuration. 
     
    1919
    2020import sys
     21import os
    2122from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs, KCmdLineOptions, KConfig
    2223from PyKDE4.kdeui import KApplication
     
    4950    print getFullName( config )
    5051    #print dir(config)
    51     for i in config.entryMap():
     52    #for i in config.entryMap():
     53    for i in config.keyList():
    5254      immutaleString = ''
    5355      if config.isEntryImmutable( i ):
     
    7678
    7779
    78 appName     = "kreadconfig.py"
     80appName     = "kread-resource.py"
    7981catalog     = ""
    80 programName = ki18n ("kreadconfig.py")
     82programName = ki18n ("kread-resource.py")
    8183version     = "$Rev$"
    82 description = ki18n ("show KDE configuration files")
     84description = ki18n ("dump KDE resource/configuration files")
    8385license     = KAboutData.License_GPL
    84 copyright   = ki18n ("(c) 2009 Jörg Steffens")
     86copyright   = ki18n ("(c) 2010 Jörg Steffens")
    8587text        = ki18n ("none")
    8688homePage    = "www.dass-it.de"
     
    9294# command line argument handling
    9395options = KCmdLineOptions()
    94 options.add("+configfile", ki18n("KDE config file name"))
    95  
     96options.add("type <kde-res-type>", ki18n("common types are: apps, config, xdgconf-autostart, xdgdata-apps. Default is"), "config")
     97options.add("types", ki18n("list all available types"))
     98options.add("+resourcename", ki18n("KDE ressource name (file name)"))
     99
    96100KCmdLineArgs.init(sys.argv, aboutData)
    97101# Register the supported options
    98102KCmdLineArgs.addCmdLineOptions( options )
    99103
    100 app = KApplication ()
     104app = KApplication()
    101105
    102106args = KCmdLineArgs.parsedArgs();
     107
     108if args.isSet("types"):
     109    os.system( "kde4-config --types" )
     110    exit()
     111
    103112
    104113# TODO: why is this not detected automatically?
     
    106115  args.usage()
    107116
     117# TODO: check valid resource types (otherwise, this application starts a crash report
     118type = args.getOption("type");
     119
    108120configfilename = args.arg(0)
    109121#print configfilename
    110122
    111 config = KConfig(configfilename, KConfig.NoGlobals)
     123#try:
     124config = KConfig(configfilename, KConfig.NoGlobals, type)
     125#except:
     126    #print "Unexpected error:", sys.exc_info()[0]
     127    #exit(1)
    112128
    113129
Note: See TracChangeset for help on using the changeset viewer.