File indexing completed on 2024-05-05 10:03:33
0001 #!/usr/bin/env python 0002 0003 # A small script that validates the structure of systemsettings. 0004 # 0005 # Copyright (c) 2010 Trever Fischer <tdfischer@fedoraproject.org> 0006 # 0007 # You are free to modify and distribute this script under 0008 # the terms of the GPLv2 or later 0009 from PyKDE4.kdecore import KServiceTypeTrader 0010 from PyQt4.QtCore import QVariant 0011 0012 VALID_CATEGORIES = ( 0013 "application-appearance-and-behavior", 0014 "application-appearance", 0015 "shortcuts-and-gestures", 0016 "account-details", 0017 "locale", 0018 "application-and-system-notifications", 0019 "personal-information", 0020 "workspace-appearance-and-behavior", 0021 "desktop-appearance", 0022 "window-behaviour", 0023 "hardware", 0024 "display", 0025 "audio-and-video", 0026 "main-input-devices", 0027 "other-input-devices", 0028 "removable-devices", 0029 "network-and-connectivity", 0030 "sharing", 0031 "network-settings", 0032 "bluetooth", 0033 "system-administration", 0034 "permissions", 0035 "security", 0036 "startup-and-shutdown" 0037 ) 0038 0039 def printLevel(category, depth=0): 0040 results = KServiceTypeTrader.self().query('KCModule', "([X-KDE-System-Settings-Parent-Category] == '%s')"%(category)) 0041 for result in results: 0042 print (" "*depth)+'%s [%s]' % (result.property('Name', QVariant.String).toString(), result.desktopEntryPath()) 0043 if result.property('Comment', QVariant.String).toString().isEmpty(): 0044 print(" "*depth)+"***No comment!***" 0045 categories = KServiceTypeTrader.self().query('SystemSettingsCategory', "([X-KDE-System-Settings-Parent-Category] == '%s')"%(category)) 0046 for subcategory in categories: 0047 print (" "*depth)+'%s [%s]' % (subcategory.property('Name', QVariant.String).toString(), subcategory.desktopEntryPath()) 0048 printLevel(subcategory.property('X-KDE-System-Settings-Category', QVariant.String).toString(), depth+1) 0049 0050 print "*** Current organization:" 0051 printLevel('') 0052 0053 print "\n" 0054 print "*** Searching for invalid categories:" 0055 print "**** KCModules:" 0056 results = KServiceTypeTrader.self().query('KCModule') 0057 for result in results: 0058 if (not (result.property('X-KDE-System-Settings-Parent-Category', QVariant.String).toString() in VALID_CATEGORIES)): 0059 print "%s [%s]: %s"%(result.property('Name', QVariant.String).toString(), result.desktopEntryPath(), result.property('X-KDE-System-Settings-Parent-Category', QVariant.String).toString()) 0060 print "**** Categories:" 0061 results = KServiceTypeTrader.self().query('SystemSettingsCategory') 0062 for result in results: 0063 if (not (result.property('X-KDE-System-Settings-Parent-Category', QVariant.String).toString() in VALID_CATEGORIES)): 0064 print "%s [%s]: %s"%(result.property('Name', QVariant.String).toString(), result.desktopEntryPath(), result.property('X-KDE-System-Settings-Parent-Category', QVariant.String).toString())