You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
1.9 KiB

  1. #!/usr/bin/python2
  2. DOMAIN = "cinnamon"
  3. PATH = "/usr/share/locale"
  4. import os, gettext, sys
  5. sys.path.append('/usr/lib/linuxmint/common')
  6. import additionalfiles
  7. os.environ['LANGUAGE'] = "en_US.UTF-8"
  8. gettext.install(DOMAIN, PATH)
  9. import os
  10. import glob
  11. import polib
  12. import sys
  13. from gi.repository import GLib
  14. try:
  15. sys.path.append('files/usr/share/cinnamon/cinnamon-settings/modules')
  16. sys.path.append('files/usr/share/cinnamon/cinnamon-settings/bin')
  17. mod_files = glob.glob('files/usr/share/cinnamon/cinnamon-settings/modules/*.py')
  18. mod_files.sort()
  19. if len(mod_files) is 0:
  20. raise Exception("No settings modules found!!")
  21. for i in range(len(mod_files)):
  22. mod_files[i] = mod_files[i].split('/')[-1]
  23. mod_files[i] = mod_files[i].split('.')[0]
  24. if mod_files[i][0:3] != "cs_":
  25. raise Exception("Settings modules must have a prefix of 'cs_' !!")
  26. modules = map(__import__, mod_files)
  27. except Exception, detail:
  28. print detail
  29. sys.exit(1)
  30. for i in range(len(modules)):
  31. try:
  32. mod = modules[i].Module(None)
  33. if mod.category in ("admin"):
  34. category = "Settings;System;"
  35. else:
  36. category = "Settings;"
  37. formatted_keywords = mod.sidePage.keywords.replace(",", ";")
  38. formatted_keywords = formatted_keywords.replace(", ", ";")
  39. prefix = """[Desktop Entry]
  40. Icon=%(icon)s
  41. Exec=cinnamon-settings %(module)s
  42. Type=Application
  43. OnlyShowIn=X-Cinnamon;
  44. Categories=Settings;
  45. """ % {'module': mod.name, 'category': category, 'icon': mod.sidePage.icon}
  46. additionalfiles.generate(DOMAIN, PATH, "files/usr/share/applications/cinnamon-settings-%s.desktop" % mod.name, prefix, mod.sidePage.name, mod.comment, "", None, mod.sidePage.keywords)
  47. except:
  48. print "Failed to load module %s" % modules[i]
  49. import traceback
  50. traceback.print_exc()