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

Fix state update in MSC

parent 6f029b3d
......@@ -186,15 +186,17 @@ class sdlHandler(QObject):
self.dock.hide()
def check_state(self):
''' Highlight the current state on the statechart diagram '''
''' Highlight the current state on the statechart diagram
Return True if the state has changed '''
state = self.get_sdl_state()
if state != self.current_sdl_state:
self.current_sdl_state = state
self.sdl_scene.clear_highlight()
for each in self.sdl_scene.find_text(u'\\b{}\\b'.format(state)):
self.sdl_scene.highlight(each)
self.add_to_msc('condition', state)
self.log_area.addItem('New state: {}'.format(state))
return True
return False
def reset_simulation(self):
''' Jump to the first step of simulation '''
......@@ -236,7 +238,7 @@ class sdlHandler(QObject):
set_state = getattr(self.dll, "_set_state")
set_state(ctypes.c_char_p(state_value))
#self.current_sdl_state = state_value
#self.check_state()
self.check_state()
#self.on_event()
def on_event(self, tc_name=None, param=None):
......@@ -349,7 +351,9 @@ class sdlHandler(QObject):
else:
tc_func_ptr()
self.check_state()
if self.check_state():
# If state changed, update the MSC
self.add_to_msc('condition', self.current_sdl_state)
# Update windows, highlight state, enable/disable buttons, etc.
self.current_hash = self.on_event(tc_name=name,
param=param.GSER() if param
......
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