Commit 277978cd authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[code gen] Generate data structure containing tooltips content

Introduce in views/uicfg.py a new data structure providing XSD element name and
documentation indexed by entity type, relation type and role.

Related to #17106808
parent 94862fecbcfd
This diff is collapsed.
......@@ -114,6 +114,13 @@ class UICFGGenerator(CodeGenerator):
for etype, attributes in self._callback('order_for', mapping_element):
stream.write("affk.set_fields_order('{0}', {1})\n".format(etype, attributes))
stream.write("pvds.set_fields_order('{0}', {1})\n".format(etype, attributes))
# fields documentation
stream.write('\nETYPE_ATTR_DOC = {}\n')
template = "ETYPE_ATTR_DOC[('{etype}', '{rtype}', '{role}')] = ('{element}', {doc})\n"
for mapping_element in mapping.ordered:
for etype, rtype, role, element, doc in self._callback('doc_for', mapping_element):
stream.write(template.format(etype=etype, rtype=rtype, role=role,
element=element, doc=doc))
def etypes_for_e_type_mapping(self, mapping):
yield mapping.etype
......@@ -197,6 +204,13 @@ class UICFGGenerator(CodeGenerator):
if len(attributes) > 1:
yield mapping.etype, attributes
def doc_for_rdef_mapping(self, mapping):
if mapping.element_name or mapping.desc:
rtype = mapping.rtype
yield mapping.subjtype, rtype, 'subject', mapping.element_name, mapping.desc
for etype in mapping.objtypes:
yield etype, rtype, 'object', mapping.element_name, mapping.desc
class Code(text_type):
"""Special string subclass whose repr() doesn't add quotes, for insertion of python code in a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment