report: root menu works again

This commit is contained in:
gwen 2013-06-04 17:42:21 +02:00
parent c6c422f472
commit 5a7d711d5a
2 changed files with 26 additions and 27 deletions

View file

@ -23,26 +23,28 @@ def descr_content(path, prefix, descr, root=False):
content.add(ListItem().join(Strong("name:"), Text(descr._name))) content.add(ListItem().join(Strong("name:"), Text(descr._name)))
if not root: if not root:
content.add(ListItem().join(Strong("path:"), Text(path))) content.add(ListItem().join(Strong("path:"), Text(path)))
content.add(ListItem().join(Strong("description:"), Text(descr.doc))) content.add(ListItem().join(Strong("description:"), Text(descr.impl_get_information('doc'))))
if not root: if not root:
content.add(ListItem().join(Strong("container:"), Text(prefix))) content.add(ListItem().join(Strong("container:"), Text(prefix)))
if not root: if not root:
content.add(ListItem().join(Strong("type:"), Text(descr.group_type))) content.add(ListItem().join(Strong("type:"), Text(descr.group_type)))
if not root: if not root:
content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires)))) content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires))))
content.add(ListItem().join(Strong("is hidden:"), Text(str(descr._is_hidden())))) # FIXME
content.add(ListItem().join(Strong("is disabled:"), Text(str(descr._is_disabled())))) # content.add(ListItem().join(Strong("is hidden:"), Text(str(descr._is_hidden()))))
# content.add(ListItem().join(Strong("is disabled:"), Text(str(descr._is_disabled()))))
content.add(Transition()) content.add(Transition())
content.add(Title(abovechar="", belowchar="-").join(Text("Ordered list of childrens for:"), Text(path))) content.add(Title(abovechar="", belowchar="-").join(Text("Ordered list of childrens for:"), Text(path)))
for opt in descr._children: names, options = descr._children
for opt in options:
name = opt._name name = opt._name
link = Link(name + ":", join(path + '.' + name + ".html")) link = Link(name + ":", join(path + '.' + name + ".html"))
# because of SympLink opt # because of SympLink opt
if hasattr(opt, 'doc'): if hasattr(opt, 'impl_get_information'):
doc = opt.doc doc = opt.impl_get_information('doc')
else: else:
doc = name doc = name
content.add(OrderedListItem(link, Text(opt.doc))) content.add(OrderedListItem(link, Text(opt.impl_get_information('doc'))))
content.add(Transition()) content.add(Transition())
content.add(Paragraph(Link("back to index", "index.html"))) content.add(Paragraph(Link("back to index", "index.html")))
make_rst_file(join(docdir, path + '.txt'), content) make_rst_file(join(docdir, path + '.txt'), content)
@ -77,23 +79,20 @@ def opt_rst_content(path, prefix, descr, value):
make_rst_file(join(docdir, path + '.txt'), content) make_rst_file(join(docdir, path + '.txt'), content)
def make_rest_overview(cfg, title=True): def make_rest_overview(cfg, title=True):
rootname = cfg._cfgimpl_descr._name descr = cfg._impl_descr
descr_content(rootname, rootname, cfg._cfgimpl_descr, root=True) rootname = descr._name
#cfg.cfgimpl_read_write() descr_content(rootname, rootname, descr, root=True)
cfg._cfgimpl_disabled = False # for path in cfg.getpaths(include_groups=True, allpaths=True):
cfg._cfgimpl_hidden = False # child = cfg.unwrap_from_path(path)
for path in cfg.getpaths(include_groups=True, allpaths=True): # fullpath = rootname + '.' + path
child = cfg.unwrap_from_path(path) # prefix = fullpath.rsplit(".", 1)[0]
fullpath = rootname + '.' + path # if isinstance(child, OptionDescription):
prefix = fullpath.rsplit(".", 1)[0] # descr_content(fullpath, prefix, child)
if isinstance(child, OptionDescription): # else:
descr_content(fullpath, prefix, child) # value = getattr(cfg, path)
else: # opt_rst_content(fullpath, prefix, child, value)
value = getattr(cfg, path)
opt_rst_content(fullpath, prefix, child, value)
if __name__ == '__main__': if __name__ == '__main__':
from test_config_big_example import get_example_config from sampleconfig import get_example_config
make_rest_overview(get_example_config()) make_rest_overview(get_example_config())
# ____________________________________________________________ # ____________________________________________________________

View file

@ -4,10 +4,10 @@ from tiramisu.option import *
all_modules = ['amon', 'sphynx', 'zephir'] all_modules = ['amon', 'sphynx', 'zephir']
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref') gcoption = ChoiceOption('name', 'GC name', ('ref', 'framework'), 'ref')
gcdummy = BoolOption('dummy', 'dummy', default=False) gcdummy = BoolOption('dummy', 'dummy', default=False)
objspaceoption = ChoiceOption('objspace', 'Object space', objspaceoption = ChoiceOption('objspace', 'Object space',
['std', 'thunk'], 'std') ('std', 'thunk'), 'std')
booloption = BoolOption('bool', 'Test boolean option', default=True) booloption = BoolOption('bool', 'Test boolean option', default=True)
intoption = IntOption('int', 'Test int option', default=0) intoption = IntOption('int', 'Test int option', default=0)
floatoption = FloatOption('float', 'Test float option', default=2.3) floatoption = FloatOption('float', 'Test float option', default=2.3)