]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - helpers/action.py
Fix threading problems with ipython
[perso/Immae/Projets/Python/MusicSampler.git] / helpers / action.py
index 8a69fae3a967f4dd020f7d037e89415a7de072e3..5afe43763c2f303ca8f6351ff14cf44e51287619 100644 (file)
@@ -28,9 +28,12 @@ class Action:
             return True
 
     def run(self):
-        print(getattr(self, self.action + "_print")(**self.arguments))
+        print(self.description())
         return getattr(self, self.action)(**self.arguments)
 
+    def description(self):
+        return getattr(self, self.action + "_print")(**self.arguments)
+
     def command(self, command = "", **kwargs):
         pass
 
@@ -71,10 +74,14 @@ class Action:
         else:
             pass
 
-    def wait(self, duration = 0, **kwargs):
+    def wait(self, duration = 0, music = None, **kwargs):
         # FIXME: Make it stoppable
         # http://stackoverflow.com/questions/29082268/python-time-sleep-vs-event-wait
-        time.sleep(duration)
+        if music is None:
+            time.sleep(duration)
+        else:
+            # TODO
+            music.wait_end()
 
     def command_print(self, command = "", **kwargs):
         return "running command {}".format(command)