]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - helpers/action.py
Put time duration in playlist
[perso/Immae/Projets/Python/MusicSampler.git] / helpers / action.py
index aff61e701f76ecc72721436e5bb315aab7cf557c..327d42fe3a2f3e6df02617630922d980e4cfc476 100644 (file)
@@ -31,7 +31,6 @@ class Action:
     def run(self):
         print(self.description())
         getattr(self, self.action)(**self.arguments)
-        #pygame.event.post(pygame.event.Event(pygame.USEREVENT))
 
     def description(self):
         return getattr(self, self.action + "_print")(**self.arguments)
@@ -43,13 +42,17 @@ class Action:
         if music is not None:
             music.pause()
         else:
-            pygame.mixer.pause()
+            for music in self.key.parent.open_files.values():
+                if music.is_playing() and not music.is_paused():
+                    music.pause()
 
     def unpause(self, music = None, **kwargs):
         if music is not None:
             music.unpause()
         else:
-            pygame.mixer.unpause()
+            for music in self.key.parent.open_files.values():
+                if music.is_playing() and music.is_paused():
+                    music.unpause()
 
     def play(self, music = None, fade_in = 0, start_at = 0,
             restart_if_running = False, volume = 100, **kwargs):