Commit c6863cad authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Make roundtrip work with Demo_HugeMsg

parent c8730fdc
......@@ -425,20 +425,17 @@ class asn1Editor(QTreeView):
def updateModel(self, root, ptr, nbRows=-1):
''' Recursive update of the values in the GUI from ASN.1 instance '''
if root.hasChildren():
seqOf = False
if nbRows == -1:
seqOf = True if nbRows != -1 else False
if not seqOf:
nbRows = root.rowCount()
else:
seqOf = True
destState = ptr.GetState()
def fillRow(root, i, dest, choice=False):
name = root.child(i, 0).text()
def fillRow(root, i, dest, choice=False, seqOf=False):
name = root.child(i, 0).text()
asnType = root.child(i, 1).text()
child = root.child(i, 3)
if not choice:
dest.Reset(destState)
ptr = getattr(dest, name)
child = root.child(i, 3)
#if not choice:
# dest.Reset(destState)
ptr = getattr(dest, name) if not seqOf else dest
if seqOf:
ptr = ptr[i]
if asnType in ('INTEGER', 'REAL', 'SEQOF'):
......@@ -465,7 +462,9 @@ class asn1Editor(QTreeView):
elif asnType in ('SEQUENCE', 'SET'):
self.updateModel(root.child(i), ptr)
elif asnType == 'CHOICE':
state = ptr.GetState()
value = ptr.kind.Get()
ptr.Reset(state)
intMappings = child.data(INTMAP)
for enumerant, num in intMappings.viewitems():
if num == value:
......@@ -473,13 +472,18 @@ class asn1Editor(QTreeView):
# is num really the row of this choice ? XXX
fillRow(root.child(i), num, dest=ptr, choice=True)
break
#ptr.Reset(state)
elif asnType == 'SEQOF':
state = ptr.GetState()
size = ptr.GetLength()
ptr.Reset(state)
child.setText(str(size))
self.updateModel(root.child(i), ptr, nbRows=size)
for i in xrange(nbRows):
fillRow(root, i, ptr)
stateBefore = ptr.GetState()
fillRow(root, i, ptr, seqOf=seqOf)
ptr.Reset(stateBefore)
def updateVariable(self, root=None):
''' Update the variable value (when loading a TC or receiving a TM) '''
......
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