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
b9f5256e
Commit
b9f5256e
authored
Oct 17, 2018
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitrepos.estec.esa.int/taste/asn1-value-editor
parents
16c39e1e
46e62889
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
asn1_value_editor/asn1_value_editor.py
asn1_value_editor/asn1_value_editor.py
+17
-12
No files found.
asn1_value_editor/asn1_value_editor.py
View file @
b9f5256e
...
...
@@ -86,12 +86,9 @@ reads the value from the editor and place it back in the model '''
def
__init__
(
self
,
oParent
=
None
):
super
(
TreeDelegate
,
self
).
__init__
(
oParent
)
def
createEditor
(
self
,
parent
,
option
,
index
):
''' Define the delegate (editor) to use for a given cell. This function
is called when the user clicks on a cell.
index.data() returns the actual value, and index.data(role) points
to some user data when role >= 32. 32 is Qt.UserRole. '''
def
update_model
(
editor
,
index
,
event
):
@
Slot
(
QWidget
,
int
)
def
update_model
(
self
,
editor
,
index
):
#def update_model(editor, index, event):
''' Trigger an immediate update of the model and therefore of the
visible elements of the gui, when user changes a value in the
editor. For example when the CHOICE index changes, this makes sure
...
...
@@ -99,8 +96,15 @@ reads the value from the editor and place it back in the model '''
for the user to click outside from the widget '''
# Do not call setModelData directly, it would segfault
# self.setModelData(editor, index.model(), index)
self
.
commitData
.
emit
(
editor
)
pass
#self.commitData.emit(editor)
def
createEditor
(
self
,
parent
,
option
,
index
):
''' Define the delegate (editor) to use for a given cell. This function
is called when the user clicks on a cell.
index.data() returns the actual value, and index.data(role) points
to some user data when role >= 32. 32 is Qt.UserRole. '''
# Check the (user-defined) type associated with the cell
asnType
=
index
.
data
(
ASN1TYPE
)
if
asnType
==
'INTEGER'
:
...
...
@@ -119,10 +123,11 @@ reads the value from the editor and place it back in the model '''
minVal
=
index
.
data
(
MIN_RANGE
)
maxVal
=
index
.
data
(
MAX_RANGE
)
editor
.
setRange
(
minVal
,
maxVal
)
editor
.
valueChanged
.
connect
(
partial
(
update_model
,
editor
,
index
))
#
editor.valueChanged.connect(partial(update_model, editor, index))
elif
asnType
in
(
'ENUMERATED'
,
'CHOICE'
):
editor
=
QComboBox
(
parent
)
editor
.
activated
.
connect
(
partial
(
update_model
,
editor
,
index
))
#editor.activated.connect(partial(update_model, editor, index))
editor
.
activated
.
connect
(
partial
(
self
.
update_model
,
editor
))
enumVal
=
index
.
data
(
CHOICE_LIST
)
for
val
in
enumVal
:
editor
.
addItem
(
val
)
...
...
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