Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
c6863cad
Commit
c6863cad
authored
Jul 10, 2016
by
Maxime Perrotin
Browse files
Make roundtrip work with Demo_HugeMsg
parent
c8730fdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/asn1_value_editor.py
View file @
c6863cad
...
...
@@ -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
n
bRows
==
-
1
:
seqOf
=
True
if
nbRows
!=
-
1
else
False
if
n
ot
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) '''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment