Commit 492d05ac authored by Maxime Perrotin's avatar Maxime Perrotin

Complete support preparation for optional fields

Pending on support in Stubs.py / Python mappers
parent 2a890b0e
......@@ -410,6 +410,23 @@ class asn1Editor(QTreeView):
stateBefore = dest.GetState()
parseRow(root, i, dest, seqOf=seqOf)
dest.Reset(stateBefore)
# Check if field is optional and set the .exist.field
# accordingly
field_root = root.child(i)
field_name = \
root.child(i, 0).text().replace('-', '_')
field_optionality = root.child(i, 4)
if field_optionality.data(OPTIONAL) \
and field_optionality.isCheckable():
present = field_optionality.checkState() == Qt.Checked
print field_name, "SET" if present else "UNSET"
# Uncomment the following when Stubs.py supports it:
#ptr = getattr(dest, "exist")
#ptr = getattr(ptr, field_name)
#ptr.Set (1 if present else 0)
dest.Reset(stateBefore)
else: # single elements (all but SeqOf, Choice, Sequence)
row = root.row()
try:
......
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