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

Test asn1_value_editor

parent ca025faa
......@@ -324,24 +324,26 @@ class asn1Editor(QTreeView):
seqOf = True
destState = dest.GetState()
def parseRow(root, i, dest, choice=False):
def parseRow(root, i, dest, choice=False, seqOf=False):
name = root.child(i, 0).text()
asnType = root.child(i, 1).text()
# Value appears with underscore in the GUI but keys use ASN.1
value = root.child(i, 3).text().replace('_', '-')
if not choice:
dest.Reset(destState)
ptr = getattr(dest, name)
ptr = getattr(dest, name) if not seqOf else dest
if seqOf:
ptr = ptr[i]
if asnType in ('SEQUENCE', 'SET'):
state = ptr.GetState()
ptr = getattr(ptr, name.replace('-', '_'))
if not seqOf:
ptr = getattr(ptr, name.replace('-', '_'))
self.parseModel(root.child(i), dest=ptr)
ptr.Reset(state)
elif asnType == 'SEQOF':
state = ptr.GetState()
ptr = getattr(ptr, name.replace('-', '_'))
#if not seqOf:
# ptr = getattr(ptr, name.replace('-', '_'))
self.parseModel(root.child(i), nbRows=int(value), dest=ptr)
ptr.Reset(state)
elif asnType == 'CHOICE':
......@@ -375,7 +377,7 @@ class asn1Editor(QTreeView):
else: # Strings
ptr.SetFromPyString(value)
for i in xrange(nbRows): # for each child row
parseRow(root, i, dest)
parseRow(root, i, dest, seqOf=seqOf)
dest.Reset(destState)
else: # single elements (all but SeqOf, Choice, Sequence)
row = root.row()
......
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