Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asn1-value-editor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TASTE
asn1-value-editor
Commits
dd074fea
Commit
dd074fea
authored
Oct 19, 2018
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work on the support of optional fields
parent
b9f5256e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
README.md
README.md
+1
-0
asn1_value_editor/asn1_value_editor.py
asn1_value_editor/asn1_value_editor.py
+22
-6
No files found.
README.md
View file @
dd074fea
...
@@ -34,6 +34,7 @@ LICENSE: LGPL - see LICENSE file
...
@@ -34,6 +34,7 @@ LICENSE: LGPL - see LICENSE file
CHANGELOG:
CHANGELOG:
1.
7.1 - Enable support for optional fields
1.
7.0 - Optional fields and fix segfaults when updating CHOICE fields
1.
7.0 - Optional fields and fix segfaults when updating CHOICE fields
1.
6.9 - Add basic support for optional fields
1.
6.9 - Add basic support for optional fields
1.
6.7 - Fix CPU usage of polling thread
1.
6.7 - Fix CPU usage of polling thread
...
...
asn1_value_editor/asn1_value_editor.py
View file @
dd074fea
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
__author__
=
"Maxime Perrotin"
__author__
=
"Maxime Perrotin"
__license__
=
"LGPLv3"
__license__
=
"LGPLv3"
__version__
=
"1.7.
0
"
__version__
=
"1.7.
1
"
__url__
=
"https://taste.tools"
__url__
=
"https://taste.tools"
import
sys
import
sys
...
@@ -420,7 +420,7 @@ class asn1Editor(QTreeView):
...
@@ -420,7 +420,7 @@ class asn1Editor(QTreeView):
dest
.
Reset
(
stateBefore
)
dest
.
Reset
(
stateBefore
)
# Check if field is optional and set the .exist.field
# Check if field is optional and set the .exist.field
# accordingly
# accordingly
field_root
=
root
.
child
(
i
)
#
field_root = root.child(i)
field_name
=
\
field_name
=
\
root
.
child
(
i
,
0
).
text
().
replace
(
'-'
,
'_'
)
root
.
child
(
i
,
0
).
text
().
replace
(
'-'
,
'_'
)
field_optionality
=
root
.
child
(
i
,
4
)
field_optionality
=
root
.
child
(
i
,
4
)
...
@@ -428,10 +428,10 @@ class asn1Editor(QTreeView):
...
@@ -428,10 +428,10 @@ class asn1Editor(QTreeView):
and
field_optionality
.
isCheckable
():
and
field_optionality
.
isCheckable
():
present
=
field_optionality
.
checkState
()
==
Qt
.
Checked
present
=
field_optionality
.
checkState
()
==
Qt
.
Checked
print
field_name
,
"SET"
if
present
else
"UNSET"
print
field_name
,
"SET"
if
present
else
"UNSET"
#
Uncomment the following when Stubs.py supports it:
#
Set the "exist" value for optional fields
#
ptr = getattr(dest, "exist")
ptr
=
getattr
(
dest
,
"exist"
)
#
ptr = getattr(ptr, field_name)
ptr
=
getattr
(
ptr
,
field_name
)
#
ptr.Set (1 if present else 0)
ptr
.
Set
(
1
if
present
else
0
)
dest
.
Reset
(
stateBefore
)
dest
.
Reset
(
stateBefore
)
...
@@ -574,6 +574,22 @@ class asn1Editor(QTreeView):
...
@@ -574,6 +574,22 @@ class asn1Editor(QTreeView):
fillRow
(
root
,
i
,
ptr
,
seqOf
=
seqOf
)
fillRow
(
root
,
i
,
ptr
,
seqOf
=
seqOf
)
ptr
.
Reset
(
stateBefore
)
ptr
.
Reset
(
stateBefore
)
# check if field is optional and set checkbox from value
field_name
=
\
root
.
child
(
i
,
0
).
text
().
replace
(
'-'
,
'_'
)
field_optionality
=
root
.
child
(
i
,
4
)
if
field_optionality
.
data
(
OPTIONAL
)
\
and
field_optionality
.
isCheckable
():
# Set the "exist" value for optional fields
ptr
=
getattr
(
ptr
,
"exist"
)
ptr
=
getattr
(
ptr
,
field_name
)
present
=
ptr
.
Get
()
print
field_name
,
field_optionality
.
data
(
OPTIONAL
),
present
field_optionality
.
setCheckState
(
Qt
.
Checked
if
present
else
Qt
.
Unchecked
)
ptr
.
Reset
(
stateBefore
)
def
updateVariable
(
self
,
root
=
None
,
asn1Var
=
None
):
def
updateVariable
(
self
,
root
=
None
,
asn1Var
=
None
):
''' Update the variable value (when loading a TC or receiving a TM) '''
''' Update the variable value (when loading a TC or receiving a TM) '''
root
=
root
or
self
.
treeItem
root
=
root
or
self
.
treeItem
...
...
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