- # TODO
- music.wait_end()
-
- def command_print(self, command = "", **kwargs):
- return "running command {}".format(command)
-
- def pause_print(self, music = None, **kwargs):
- if music is not None:
- return "pausing « {} »".format(music.name)
- else:
- return "pausing all musics"
-
- def unpause_print(self, music = None, **kwargs):
- if music is not None:
- return "unpausing « {} »".format(music.name)
- else:
- return "unpausing all musics"
-
- def play_print(self, music = None, fade_in = 0, start_at = 0,
- restart_if_running = False, volume = 100, **kwargs):
- message = "starting "
- if music is not None:
- message += "« {} »".format(music.name)
- else:
- message += "music"
-
- if start_at != 0:
- message += " at {}s".format(start_at)
-
- if fade_in != 0:
- message += " with {}s fade_in".format(fade_in)
-
- message += " at volume {}%".format(volume)
-
- if restart_if_running:
- message += " (restarting if already running)"
-
- return message
-
- def stop_print(self, music = None, fade_out = 0, **kwargs):
+ error_print("Unknown action {}".format(self.action))
+ self.fail()
+
+ def on_enter_loaded_running(self, key_start_time):
+ debug_print(self.description())
+ if hasattr(actions, self.action):
+ getattr(actions, self.action).run(self,
+ key_start_time=key_start_time, **self.arguments)
+
+ def poll_loaded(self):
+ self.key.callback_action_ready(self,
+ self.is_loaded(allow_substates=True))
+
+ # This one cannot be in the Machine state since it would be queued to run
+ # *after* the wait is ended...
+ def interrupt(self):
+ if getattr(actions, self.action, None) and\
+ hasattr(getattr(actions, self.action), 'interrupt'):
+ return getattr(getattr(actions, self.action), 'interrupt')(
+ self, **self.arguments)
+
+ # Helpers
+ def music_list(self, music):