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

Add function to list active TC

Useful to build up a random simulator
parent 458b857b
......@@ -16,7 +16,7 @@
__author__ = "Maxime Perrotin"
__license__ = "LGPLv3"
__version__ = "1.0.5"
__version__ = "1.0.6"
__url__ = "http://taste.tuxfamily.org"
import sys
......
......@@ -241,6 +241,19 @@ class sdlHandler(QObject):
# VDM handler instance, when needed for external procedures calls
self.vdm = None
@property
def active_tc(self):
''' Yield list of TCs that can be sent (including timeouts) '''
# Find the list of allowed TC based on the current state
st = unicode(self.current_sdl_state.decode('latin1'))
inputs = self.proc.mapping[st.replace(UNICODE_SEP, '_').lower()]
allowed_tc = (tc for each in inputs for tc in each.inputlist)
for each in allowed_tc:
if each in self.timers and not self.buttons[each].isEnabled():
# Timers: check if button is active
continue
yield each
@property
def dll(self):
return self._dll
......@@ -301,8 +314,8 @@ class sdlHandler(QObject):
# Initialization: set current state and internal variables
self.current_sdl_state = ''
self.check_state()
self.init_state = self.current_hash = self.on_event()
self.init_timers()
self.init_state = self.current_hash = self.on_event()
def load_properties(self, prop_file=None):
''' Try loading a shared object with properties to verify
......
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