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
091d4227
Commit
091d4227
authored
Jan 04, 2015
by
Maxime Perrotin
Browse files
Test undo/redo
parent
ae300714
Changes
2
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/mscHandler.py
View file @
091d4227
...
...
@@ -234,6 +234,7 @@ inst {fv};'''.format(fv=fv_name)]
@
Slot
(
unicode
)
def
addCondition
(
self
,
condition
):
''' Add a "Condition" box to the MSC (single word with no spaces) '''
# TODO REMOVE THIS CODE
condbox
=
self
.
msc_scene
.
addCondition
(
self
.
taste_instance
,
y
=
self
.
next_y
,
label
=
condition
)
...
...
asn1_value_editor/sdlHandler.py
View file @
091d4227
...
...
@@ -126,6 +126,8 @@ class sdlHandler(QObject):
redo_button
=
widget
.
findChild
(
QToolButton
,
'redoButton'
)
reset_button
=
widget
.
findChild
(
QToolButton
,
'resetButton'
)
reset_button
.
clicked
.
connect
(
self
.
reset_simulation
)
undo_button
.
clicked
.
connect
(
self
.
undo
)
redo_button
.
clicked
.
connect
(
self
.
redo
)
@
property
def
dll
(
self
):
...
...
@@ -202,6 +204,18 @@ class sdlHandler(QObject):
self
.
restore_global_state
(
self
.
init_state
)
# TODO: clean log, clean MSC, rewind undo stack
def
undo
(
self
):
''' Called when the undo button is pressed '''
self
.
undo_stack
.
undo
()
self
.
check_state
()
self
.
current_hash
=
self
.
on_event
()
def
redo
(
self
):
''' Called when the redo button is pressed '''
self
.
undo_stack
.
redo
()
self
.
check_state
()
self
.
current_hash
=
self
.
on_event
()
def
restore_global_state
(
self
,
statehash
):
''' From a hashcode, restore a global state in the DLL (state +
all internal variables '''
...
...
@@ -272,7 +286,7 @@ class sdlHandler(QObject):
continue
button
.
setEnabled
(
tc
in
allowed_tc
)
if
tc_name
in
self
.
timers
:
self
.
buttons
[
name
].
setEnabled
(
False
)
self
.
buttons
[
tc_
name
].
setEnabled
(
False
)
# Emit the list of allowed TC for the GUI to update other buttons
self
.
allowed_messages
.
emit
(
allowed_tc
)
if
tc_name
:
...
...
@@ -311,7 +325,7 @@ class sdlHandler(QObject):
''' Send a TC - Used either locally (parameterless TCs) or via
a signal sent by the B-mapper-generated backends '''
if
name
in
self
.
timers
:
self
.
buttons
[
name
].
setEnabled
(
False
)
#
self.buttons[name].setEnabled(False)
self
.
add_to_msc
(
'timeout'
,
name
)
elif
not
param
:
msg
=
'{tc}{arg}'
.
format
(
tc
=
name
,
...
...
Write
Preview
Supports
Markdown
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