error_print("Unknown action {}".format(self.action))
self.fail()
- def on_enter_loaded_running(self):
+ def on_enter_loaded_running(self, key_start_time):
debug_print(self.description())
if hasattr(actions, self.action):
- getattr(actions, self.action).run(self, **self.arguments)
+ getattr(actions, self.action).run(self,
+ key_start_time=key_start_time, **self.arguments)
def poll_loaded(self):
self.key.callback_action_ready(self,
-def run(action, **kwargs):
- action.mapping.stop_all_running()
+def run(action, key_start_time=0, other_only=False, **kwargs):
+ if other_only:
+ action.mapping.stop_all_running(
+ except_key=action.key,
+ key_start_time=key_start_time)
+ else:
+ action.mapping.stop_all_running()
-def description(action, **kwargs):
- return "stopping all actions"
+def description(action, other_only=False, **kwargs):
+ message = "stopping all actions"
+ if other_only:
+ message += " except this key"
+
+ return message
for self.current_action in self.actions:
if self.parent.keep_running(self, start_time):
self.list_actions()
- self.current_action.run()
+ self.current_action.run(start_time)
self.list_actions(last_action_finished=True)
self.parent.finished_running(self, start_time)
self.ready_color = [1, 165/255, 0, 1]
## Some global actions
- def stop_all_running(self):
+ def stop_all_running(self, except_key=None, key_start_time=0):
running = self.running
- self.running = []
+ self.running = [r for r in running\
+ if r[0] == except_key and r[1] == key_start_time]
for (key, start_time) in running:
- key.interrupt()
+ if (key, start_time) != (except_key, key_start_time):
+ key.interrupt()
# Master volume methods
@property