Commit 84622160 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Improve Undo

parent cd26d2b3
......@@ -321,7 +321,6 @@ def gui():
sdl = sdlHandler(myWidget)
sdl.dll = dll
sdl.msc.connect(msc.addToMsc)
sdl.state_change.connect(msc.addCondition)
sdl.allowed_messages.connect(myWidget.allowed_editors)
except IOError:
log.info('SDL viewer not available')
......
......@@ -64,7 +64,7 @@ class AddToMsc(QUndoCommand):
# Condition: single word with no space
self.item = handler.msc_scene.addCondition(handler.taste_instance,
y=handler.next_y,
label=condition)
label=message)
self.increase_factor = 40
self.item.hide()
# This is how to add a comment on the graph:
......
......@@ -78,8 +78,6 @@ class sdlHandler(QObject):
'''
# signal sent whenever a paramless TM or TC event happens
msc = Signal(unicode, unicode, QUndoStack)
# Signal sent when the state of the SDL model changes
state_change = Signal(unicode)
allowed_messages = Signal(list)
def __init__(self, parent):
''' Startup: check if there are some SDL files in
......@@ -195,8 +193,7 @@ class sdlHandler(QObject):
self.sdl_scene.clear_highlight()
for each in self.sdl_scene.find_text(u'\\b{}\\b'.format(state)):
self.sdl_scene.highlight(each)
# Propagate event for other updates (e.g. MSC)
self.state_change.emit(state)
self.add_to_msc('condition', state)
self.log_area.addItem('New state: {}'.format(state))
def reset_simulation(self):
......@@ -236,8 +233,9 @@ class sdlHandler(QObject):
state_value = target_state[idx+1]
set_state = getattr(self.dll, "_set_state")
set_state(ctypes.c_char_p(state_value))
self.check_state()
self.on_event()
self.current_sdl_state = state_value
#self.check_state()
#self.on_event()
def on_event(self, tc_name=None, param=None):
''' Update the list of global states and GUI after a TC has been sent
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment