Commit 20430b14 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Start supporting nested states in simulator

parent 336012a8
......@@ -5,7 +5,12 @@
"""
TASTE GUI - SDL Statechart handler
Connect to OpenGEODE and display the statechart during the simulation
Connect to OpenGEODE to drive a simulation using the ASN.1 Editor
Display the statechart during the simulation
View and allow user to modify any SDL internal variable
Send events to the MSC handler in order to display messages and timers
Manage context - enable buttons for sending TCs only if the SDL model is
in a state where they are expected.
Copyright (c) 2012-2015 European Space Agency
......@@ -206,15 +211,16 @@ 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()
state = state.decode('latin1') # Recover the unicode chars
for each in self.sdl_scene.find_text(u'\\b{}\\b'.format(state)):
self.sdl_scene.highlight(each)
self.log_area.addItem('New state: {}'.format(state))
self.log_area.addItem('New state: {}'.format(CleanName(state)))
return True
return False
......@@ -338,7 +344,8 @@ class sdlHandler(QObject):
''' Depending on the current SDL state, enable or disable the buttons
for sending TCs '''
# Find the list of allowed TC based on the current state
inputs = self.proc.mapping[self.current_sdl_state.lower()]
st = unicode(self.current_sdl_state.decode('latin1'))
inputs = self.proc.mapping[st.replace(UNICODE_SEP, '_').lower()]
allowed_tc = []
for each in inputs:
allowed_tc.extend(each.inputlist)
......
Markdown is supported
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