Commit 37ddae41 authored by Maxime Perrotin's avatar Maxime Perrotin

Update Pyside B mapper with alwaysPresent/Absent

parent 64bda05e
......@@ -547,7 +547,9 @@ def WriteCodeForGUIControls(prefixes: List[str], # pylint: disable=invalid-sequ
leafTypeDict: AST_Leaftypes,
names: AST_Lookup,
nodeTypename: str = '',
isOptional: bool = False) -> None:
isOptional: bool = False,
alwaysPresent: bool = False,
alwaysAbsent: bool = False) -> None:
global g_firstElem
global g_onceOnly
global g_asnId
......@@ -582,36 +584,37 @@ def WriteCodeForGUIControls(prefixes: List[str], # pylint: disable=invalid-sequ
if isinstance(node, AsnInt):
if g_onceOnly:
g_PyDataModel.write(
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'minR': %d, 'maxR': %d}''' % (
nodeTypename, node._name, txtPrefix, isOptional,
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'alwaysPresent': %s, 'alwaysAbsent': %s, 'minR': %d, 'maxR': %d}''' % (
nodeTypename, node._name, txtPrefix, isOptional, alwaysPresent, alwaysAbsent,
node._range[0], node._range[1]))
elif isinstance(node, AsnReal):
if g_onceOnly:
g_PyDataModel.write(
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'minR': %20.20f, 'maxR': %20.20f}''' % (
nodeTypename, node._name, txtPrefix, isOptional,
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'alwaysPresent': %s, 'alwaysAbsent': %s, 'minR': %20.20f, 'maxR': %20.20f}''' % (
nodeTypename, node._name, txtPrefix, isOptional, alwaysPresent, alwaysAbsent,
node._range[0], node._range[1]))
elif isinstance(node, AsnOctetString):
if g_onceOnly:
g_PyDataModel.write(
'''{'nodeTypename': '%s', 'type': 'STRING', 'id': '%s', 'isOptional': %s, 'minSize': %d, 'maxSize': %d}''' % (
nodeTypename, txtPrefix, isOptional, node._range[0], node._range[1]))
'''{'nodeTypename': '%s', 'type': 'STRING', 'id': '%s', 'isOptional': %s, 'alwaysPresent': %s, 'alwaysAbsent': %s, 'minSize': %d, 'maxSize': %d}''' % (
nodeTypename, txtPrefix, isOptional, alwaysPresent, alwaysAbsent,
node._range[0], node._range[1]))
elif isinstance(node, AsnBool):
if g_onceOnly:
g_PyDataModel.write(
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'default': 'False'}''' % (
nodeTypename, node._name, txtPrefix, isOptional))
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'alwaysPresent': %s, 'alwaysAbsent': %s, 'default': 'False'}''' % (
nodeTypename, node._name, txtPrefix, isOptional, alwaysPresent, alwaysAbsent))
elif isinstance(node, AsnEnumerated):
if g_onceOnly:
global g_needsComa
g_needsComa = False
g_PyDataModel.write(
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'values':[''' % (
nodeTypename, node._name, txtPrefix, isOptional))
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'alwaysPresent': %s, 'alwaysAbsent': %s, 'values':[''' % (
nodeTypename, node._name, txtPrefix, isOptional, alwaysPresent, alwaysAbsent))
values = []
valuesmap = []
for enum_value in node._members:
......@@ -624,8 +627,8 @@ def WriteCodeForGUIControls(prefixes: List[str], # pylint: disable=invalid-sequ
elif isinstance(node, (AsnSequence, AsnChoice, AsnSet)):
if g_onceOnly:
g_PyDataModel.write(
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, ''' % (
nodeTypename, node._name, txtPrefix, isOptional))
'''{'nodeTypename': '%s', 'type': '%s', 'id': '%s', 'isOptional': %s, 'alwaysPresent': %s, 'alwaysAbsent': %s, ''' % (
nodeTypename, node._name, txtPrefix, isOptional, alwaysPresent,alwaysAbsent))
if isinstance(node, AsnChoice):
g_PyDataModel.write('''"choices":[''')
elif isinstance(node, (AsnSequence, AsnSet)):
......@@ -641,9 +644,14 @@ def WriteCodeForGUIControls(prefixes: List[str], # pylint: disable=invalid-sequ
# child[0] is the name of the field
# child[2] is the string "field_PRESENT" used for choice indexes
# child[3] is the field optionality status
# child[4] is the "alwaysPresent" status (when child[3] is True)
# child[5] is the "alwaysAbsent" status (when child[3] is True)
CleanChild = CleanName(child[0])
childType = child[1]
isOptional = child[3]
alwaysPresent = child[4]
alwaysAbsent = child[5]
# print(CleanChild + " optional: "+ str(isOptional) + " always Present: " + str(alwaysPresent) + " always absent: " + str(alwaysAbsent))
if isinstance(childType, AsnMetaMember):
childType = names[childType._containedType]
seqPrefix = prefixes[-1]
......@@ -651,7 +659,9 @@ def WriteCodeForGUIControls(prefixes: List[str], # pylint: disable=invalid-sequ
WriteCodeForGUIControls(prefixes, parentControl, childType,
subProgram, subProgramImplementation,
param, leafTypeDict, names,
isOptional=isOptional)
isOptional=isOptional,
alwaysPresent=alwaysPresent,
alwaysAbsent=alwaysAbsent)
prefixes[-1] = seqPrefix
if g_onceOnly:
if isinstance(node, AsnChoice):
......@@ -668,8 +678,8 @@ def WriteCodeForGUIControls(prefixes: List[str], # pylint: disable=invalid-sequ
elif isinstance(node, (AsnSequenceOf, AsnSetOf)):
if g_onceOnly:
g_PyDataModel.write(
"{'nodeTypename': '%s', 'type': 'SEQOF', 'id': '%s', 'isOptional': %s, 'minSize': %d, 'maxSize': %d, 'seqoftype':" % (
nodeTypename, txtPrefix, isOptional, node._range[0], node._range[1]))
"{'nodeTypename': '%s', 'type': 'SEQOF', 'id': '%s', 'isOptional': %s, 'alwaysPresent': %s, 'alwaysAbsent': %s, 'minSize': %d, 'maxSize': %d, 'seqoftype':" % (
nodeTypename, txtPrefix, isOptional, alwaysPresent, alwaysAbsent, node._range[0], node._range[1]))
containedNode = node._containedType
if isinstance(containedNode, str):
containedNode = names[containedNode]
......
......@@ -11,7 +11,7 @@ from setuptools import setup, find_packages
setup(
name='dmt',
version="2.1.26",
version="2.1.27",
packages=find_packages(),
author='Thanassis Tsiodras',
author_email='Thanassis.Tsiodras@esa.int',
......
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