Commit 5f8ce0e9 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Progress in supporting state composition

parent 9bb9706c
......@@ -622,11 +622,31 @@ class sdlHandler(QObject):
for sending TCs '''
# Find the list of allowed TC based on the current state
st = self.current_sdl_state.split(UNICODE_SEP)
st = st[0] # TODO: Replace with proper support of composite states
inputs = self.proc.mapping[st.lower()]
allowed_tc = []
for each in inputs:
allowed_tc.extend(each.inputlist)
st_iter = st.pop(0)
context = self.proc
def find_allowed_tc(context, statename):
print context.mapping.keys()
inputs = context.mapping[statename.lower()]
for each in inputs:
for inp in each.inputlist:
yield inp
allowed_tc = list(find_allowed_tc(context, st_iter))
while len(st):
# Handle state composition (without flattening)
next_st = st.pop(0)
for each in context.composite_states:
if each.statename.lower() == st_iter.lower():
context = each
break
allowed_tc.extend(list(find_allowed_tc(context, next_st)))
# inputs = self.proc.mapping[st.lower()]
# allowed_tc = []
# for each in inputs:
# allowed_tc.extend(each.inputlist)
# Remove timers from the list
allowed_tc = set(allowed_tc) - set(self.proc.timers)
# Enable/disable the parameterless TC buttons accordingly
......
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