USER = os.getenv("USER") PWD = os.getenv("PWD") if not os.path.exists("/usr/bin/alan-show-extension"): execu = "/home/g7/semplice/emily/alan/alan/alan-show-extension.py" else: execu = "/usr/bin/alan-show-extension" ### THIS IS THE *MAIN* DYNAMIC MENU TREE FOR ALAN. ### This makes the menu when right-clicking on the desktop. ### YAY. # Read configuration conf = cfg.load_config() ## Begin with menu creation. Should read from tree.cfg categories = conf.printv("categories","Alan").split(" ") # Should enable icons? icons = conf.printv("enable_icons","Alan") if icons: os.environ["ALANICONS"] = "True" # What's the header? head = conf.printv("header", "Alan") if head == False: head = "__username__" # Should use cache? use_cache = conf.printv("use_cache","Alan")
menu.end() print menu.final_menu # Load module by reading sys.argv[1] if len(sys.argv) < 2: error(_("Module not found!")) sys.exit() name = sys.argv[1] # Read configuration file, and search for name cfg = cfg.load_config("ext:%s" % name) # Get extension name: ext = cfg.printv("ext") # Should use icons? if cfg.printv("enable_icons","Alan"): os.environ["ALANICONS"] = "True" # Load module try: module = mod.Extension(ext) loaded = module.load(cfg) # Print menu print loaded.menu.final_menu