report: root menu works again
This commit is contained in:
parent
c6c422f472
commit
5a7d711d5a
2 changed files with 26 additions and 27 deletions
|
@ -23,32 +23,34 @@ def descr_content(path, prefix, descr, root=False):
|
|||
content.add(ListItem().join(Strong("name:"), Text(descr._name)))
|
||||
if not root:
|
||||
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:
|
||||
content.add(ListItem().join(Strong("container:"), Text(prefix)))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("type:"), Text(descr.group_type)))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires))))
|
||||
content.add(ListItem().join(Strong("is hidden:"), Text(str(descr._is_hidden()))))
|
||||
content.add(ListItem().join(Strong("is disabled:"), Text(str(descr._is_disabled()))))
|
||||
# FIXME
|
||||
# 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(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
|
||||
link = Link(name + ":", join(path + '.' + name + ".html"))
|
||||
# because of SympLink opt
|
||||
if hasattr(opt, 'doc'):
|
||||
doc = opt.doc
|
||||
if hasattr(opt, 'impl_get_information'):
|
||||
doc = opt.impl_get_information('doc')
|
||||
else:
|
||||
doc = name
|
||||
content.add(OrderedListItem(link, Text(opt.doc)))
|
||||
content.add(OrderedListItem(link, Text(opt.impl_get_information('doc'))))
|
||||
content.add(Transition())
|
||||
content.add(Paragraph(Link("back to index", "index.html")))
|
||||
make_rst_file(join(docdir, path + '.txt'), content)
|
||||
if root:
|
||||
make_rst_file(join(docdir, 'index.txt'), content)
|
||||
|
||||
|
||||
def opt_rst_content(path, prefix, descr, value):
|
||||
content = Rest()
|
||||
title = Title(abovechar="", belowchar="=")
|
||||
|
@ -75,25 +77,22 @@ def opt_rst_content(path, prefix, descr, value):
|
|||
content.add(Transition())
|
||||
content.add(Paragraph(Link("back to container", join(prefix + ".html"))))
|
||||
make_rst_file(join(docdir, path + '.txt'), content)
|
||||
|
||||
|
||||
def make_rest_overview(cfg, title=True):
|
||||
rootname = cfg._cfgimpl_descr._name
|
||||
descr_content(rootname, rootname, cfg._cfgimpl_descr, root=True)
|
||||
#cfg.cfgimpl_read_write()
|
||||
cfg._cfgimpl_disabled = False
|
||||
cfg._cfgimpl_hidden = False
|
||||
for path in cfg.getpaths(include_groups=True, allpaths=True):
|
||||
child = cfg.unwrap_from_path(path)
|
||||
fullpath = rootname + '.' + path
|
||||
prefix = fullpath.rsplit(".", 1)[0]
|
||||
if isinstance(child, OptionDescription):
|
||||
descr_content(fullpath, prefix, child)
|
||||
else:
|
||||
value = getattr(cfg, path)
|
||||
opt_rst_content(fullpath, prefix, child, value)
|
||||
descr = cfg._impl_descr
|
||||
rootname = descr._name
|
||||
descr_content(rootname, rootname, descr, root=True)
|
||||
# for path in cfg.getpaths(include_groups=True, allpaths=True):
|
||||
# child = cfg.unwrap_from_path(path)
|
||||
# fullpath = rootname + '.' + path
|
||||
# prefix = fullpath.rsplit(".", 1)[0]
|
||||
# if isinstance(child, OptionDescription):
|
||||
# descr_content(fullpath, prefix, child)
|
||||
# else:
|
||||
# value = getattr(cfg, path)
|
||||
# opt_rst_content(fullpath, prefix, child, value)
|
||||
|
||||
if __name__ == '__main__':
|
||||
from test_config_big_example import get_example_config
|
||||
from sampleconfig import get_example_config
|
||||
make_rest_overview(get_example_config())
|
||||
# ____________________________________________________________
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ from tiramisu.option import *
|
|||
|
||||
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)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
('std', 'thunk'), 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
Loading…
Reference in a new issue