Changeset 817


Ignore:
Timestamp:
02/01/10 16:20:49 (12 years ago)
Author:
joergs
Message:

added program to dump all KDE resource types

Location:
kde/kreadconfig
Files:
4 added
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • kde/kreadconfig/kread-desktopfile-test.sh

    r816 r817  
    1111
    1212#echo $KDEDIRS
    13 kde4-config --path config
     13#kde4-config --path config
     14kde4-config --path apps
    1415
    1516echo
    1617
    17 ./kreadconfig.py testconfig
     18#./kreadconfig.py testconfig
    1819
     20# OK
     21#./kread-desktopfile.py /usr/share/applications/xmag.desktop
     22
     23# NOK
     24#./kread-desktopfile.py test.desktop
     25
     26# OK
     27#./kread-desktopfile.py testdir/test.desktop
     28
     29# OK
     30#./kread-desktopfile.py test2.desktop
     31
     32#./kread-desktopfile.py /usr/share/applications/xmag.desktop
     33
     34FILE=testdir/test.desktop
     35
     36./kread-desktopfile.py $FILE
  • kde/kreadconfig/kread-desktopfile.py

    r816 r817  
    1919
    2020import sys
    21 from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs, KCmdLineOptions, KConfig
     21from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs, KCmdLineOptions, KConfig, KDesktopFile
    2222from PyKDE4.kdeui import KApplication
    2323 
     
    4949    print getFullName( config )
    5050    #print dir(config)
    51     for i in config.entryMap():
     51    #for i in config.entryMap():
     52    for i in config.keyList():
    5253      immutaleString = ''
    5354      if config.isEntryImmutable( i ):
     
    109110#print configfilename
    110111
    111 config = KConfig(configfilename, KConfig.NoGlobals)
     112if not KDesktopFile.isDesktopFile(configfilename):
     113    print "failed: no desktop file '", configfilename, "' found"
     114    exit(1)
    112115
     116#config = KConfig(configfilename, KConfig.NoGlobals)
     117config = KDesktopFile(configfilename)
     118
     119
     120print "filename:  ", config.fileName()
     121print "name:      ", config.readName()
     122print "icon:      ", config.readIcon()
     123print "nodisplay: ", config.noDisplay()
     124
     125print
     126print "dump:"
    113127
    114128# only show the sub-groups.
  • 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
  • kde/kreadconfig/kreadconfig-test.sh

    r796 r817  
    1212#echo $KDEDIRS
    1313kde4-config --path config
     14kde4-config --path apps
    1415
    1516echo
  • kde/kreadconfig/kreadconfig.py

    r796 r817  
    4949    print getFullName( config )
    5050    #print dir(config)
    51     for i in config.entryMap():
     51    #for i in config.entryMap():
     52    for i in config.keyList():
    5253      immutaleString = ''
    5354      if config.isEntryImmutable( i ):
Note: See TracChangeset for help on using the changeset viewer.