Fixed doc tool to order menus.

This commit is contained in:
Karl MacMillan 2005-06-09 21:05:33 +00:00
parent 5d9417870c
commit d6b0f3712f

View File

@ -75,15 +75,23 @@ def gen_module_conf(doc, file):
file.write("# %s\n" % line) file.write("# %s\n" % line)
file.write("#\n#%s\n\n" % mod_name) file.write("#\n#%s\n\n" % mod_name)
def stupid_cmp(a, b):
return cmp(a[0], b[0])
def gen_doc_menu(mod_layer, module_list): def gen_doc_menu(mod_layer, module_list):
menu = {} menu = []
for name, value in module_list.iteritems(): for layer, value in module_list.iteritems():
if not menu.has_key(name): cur_menu = (layer, [])
menu[name] = {} menu.append(cur_menu)
if name == mod_layer or mod_layer == None: if layer != mod_layer and mod_layer != None:
continue
#we are in our layer so fill in the other modules or we want them all #we are in our layer so fill in the other modules or we want them all
for mod, desc in value.iteritems(): for mod, desc in value.iteritems():
menu[name][mod] = desc cur_menu[1].append((mod, desc))
menu.sort(stupid_cmp)
for x in menu:
x[1].sort(stupid_cmp)
return menu return menu
def gen_docs(doc, dir, templatedir): def gen_docs(doc, dir, templatedir):