]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - music_sampler.py
Coding styles
[perso/Immae/Projets/Python/MusicSampler.git] / music_sampler.py
index 5e61466257fdb631ad8467e6c7bedcb16901ab0c..d91e150aed51d93d9fa6e7432b2971c3cb05c398 100644 (file)
@@ -1,3 +1,7 @@
+import helpers
+
+helpers.parse_args()
+
 import kivy
 kivy.require("1.9.1")
 from kivy.app import App
@@ -9,7 +13,6 @@ from kivy.core.window import Window
 from kivy.lang import Builder
 from helpers.key import Key
 from helpers.mapping import Mapping
-import helpers
 
 class KeyList(RelativeLayout):
     keylist = ListProperty([])
@@ -18,7 +21,7 @@ class KeyList(RelativeLayout):
     third_key = StringProperty("")
 
     def append(self, value):
-        self.keylist = [value] + self.keylist
+        self.keylist.insert(0, value)
 
     def on_keylist(self, instance, new_key_list):
         if len(self.keylist) > 0:
@@ -42,12 +45,17 @@ class PlayList(RelativeLayout):
         open_files = self.parent.ids['Mapping'].open_files
         self.playlist = []
         for music_file in open_files.values():
-            if not music_file.is_playing():
+            if not music_file.is_not_stopped():
                 continue
+
+            text = "{}/{}".format(
+                    helpers.duration_to_min_sec(music_file.sound_position),
+                    helpers.duration_to_min_sec(music_file.sound_duration))
+
             if music_file.is_paused():
-                self.playlist.append(["⏸", music_file.name, False])
+                self.playlist.append(["⏸", music_file.name, text, False])
             else:
-                self.playlist.append(["⏵", music_file.name, True])
+                self.playlist.append(["⏵", music_file.name, text, True])
 
 
 class ActionList(RelativeLayout):