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
bffd2567
Commit
bffd2567
authored
May 16, 2019
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workaround pyside bug
parent
f0ce3c84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
README.md
README.md
+1
-0
asn1_value_editor/asn1_value_editor.py
asn1_value_editor/asn1_value_editor.py
+11
-6
No files found.
README.md
View file @
bffd2567
...
@@ -34,6 +34,7 @@ LICENSE: LGPL - see LICENSE file
...
@@ -34,6 +34,7 @@ LICENSE: LGPL - see LICENSE file
CHANGELOG:
CHANGELOG:
1.
7.7 - Workaround pyside bug raising Overflow error for 64 bits numbers
1.
7.5 - Better compatibility with old versions of DMT not supporting Optional fields
1.
7.5 - Better compatibility with old versions of DMT not supporting Optional fields
1.
7.4 - Bugfix for opengeode simulator
1.
7.4 - Bugfix for opengeode simulator
1.
7.3 - Support optionality in standalone editor too
1.
7.3 - Support optionality in standalone editor too
...
...
asn1_value_editor/asn1_value_editor.py
View file @
bffd2567
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
__author__
=
"Maxime Perrotin"
__author__
=
"Maxime Perrotin"
__license__
=
"LGPLv3"
__license__
=
"LGPLv3"
__version__
=
"1.7.
6
"
__version__
=
"1.7.
7
"
__url__
=
"https://taste.tools"
__url__
=
"https://taste.tools"
import
sys
import
sys
...
@@ -403,7 +403,7 @@ class asn1Editor(QTreeView):
...
@@ -403,7 +403,7 @@ class asn1Editor(QTreeView):
intMappings
=
root
.
child
(
i
,
3
).
data
(
INTMAP
)
intMappings
=
root
.
child
(
i
,
3
).
data
(
INTMAP
)
for
enumerant
,
num
in
intMappings
.
viewitems
():
for
enumerant
,
num
in
intMappings
.
viewitems
():
if
enumerant
==
value
:
if
enumerant
==
value
:
ptr
.
Set
(
num
)
ptr
.
Set
(
int
(
num
)
)
break
break
else
:
else
:
raise
TypeError
(
'ENUMERATED value not found'
)
raise
TypeError
(
'ENUMERATED value not found'
)
...
@@ -462,7 +462,7 @@ class asn1Editor(QTreeView):
...
@@ -462,7 +462,7 @@ class asn1Editor(QTreeView):
intMappings
=
self
.
model
.
item
(
row
,
3
).
data
(
INTMAP
)
intMappings
=
self
.
model
.
item
(
row
,
3
).
data
(
INTMAP
)
for
enumerant
,
num
in
intMappings
.
viewitems
():
for
enumerant
,
num
in
intMappings
.
viewitems
():
if
enumerant
==
value
:
if
enumerant
==
value
:
dest
.
Set
(
num
)
dest
.
Set
(
int
(
num
)
)
break
break
else
:
else
:
self
.
log
.
error
(
'Missing enumerted or bug - please report'
)
self
.
log
.
error
(
'Missing enumerted or bug - please report'
)
...
@@ -525,7 +525,7 @@ class asn1Editor(QTreeView):
...
@@ -525,7 +525,7 @@ class asn1Editor(QTreeView):
value
=
ptr
.
Get
()
value
=
ptr
.
Get
()
intMappings
=
child
.
data
(
INTMAP
)
intMappings
=
child
.
data
(
INTMAP
)
for
enumerant
,
num
in
intMappings
.
viewitems
():
for
enumerant
,
num
in
intMappings
.
viewitems
():
if
num
==
value
:
if
int
(
num
)
==
value
:
child
.
setText
(
enumerant
)
child
.
setText
(
enumerant
)
break
break
else
:
else
:
...
@@ -646,7 +646,7 @@ class asn1Editor(QTreeView):
...
@@ -646,7 +646,7 @@ class asn1Editor(QTreeView):
for
enumerant
,
num
in
intMappings
.
viewitems
():
for
enumerant
,
num
in
intMappings
.
viewitems
():
# XXX if value is not initialized and no enum has value 0
# XXX if value is not initialized and no enum has value 0
# an error will be raised
# an error will be raised
if
num
==
value
:
if
int
(
num
)
==
value
:
self
.
model
.
item
(
row
,
3
).
setText
(
enumerant
)
self
.
model
.
item
(
row
,
3
).
setText
(
enumerant
)
break
break
else
:
else
:
...
@@ -955,7 +955,12 @@ class asn1Editor(QTreeView):
...
@@ -955,7 +955,12 @@ class asn1Editor(QTreeView):
# Define type attributes, later used to define the proper cell editor
# Define type attributes, later used to define the proper cell editor
val
.
setData
(
elem
[
"type"
],
ASN1TYPE
)
# type (ENUMERATED)
val
.
setData
(
elem
[
"type"
],
ASN1TYPE
)
# type (ENUMERATED)
val
.
setData
(
elem
[
"values"
],
CHOICE_LIST
)
# enum values
val
.
setData
(
elem
[
"values"
],
CHOICE_LIST
)
# enum values
val
.
setData
(
elem
[
"valuesInt"
],
INTMAP
)
# mapping name - value
# Due to a bug in Pyside, there can be an OverflowError raised if the
# enumerated value cannot fit in 32 bits storage. To workaround, the
# value is tranformed o a string.
workaround
=
{
a
:
str
(
b
)
for
a
,
b
in
elem
[
'valuesInt'
].
viewitems
()}
val
.
setData
(
workaround
,
INTMAP
)
# mapping name - value
#val.setData(elem["valuesInt"], INTMAP) # mapping name - value
constraint
=
QStandardItem
()
constraint
=
QStandardItem
()
present
=
QStandardItem
()
present
=
QStandardItem
()
...
...
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