X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=music_sampler.py;h=7bd7513d738e8c33c33d3a5e6bd9aaed8172bd76;hb=98ff43054fe94f333e2deda2906cd62593ded1d8;hp=81b96c4c29d32ea45498109e28548e2d40e19602;hpb=e4846541aa226de8b231cc401fcaa6f058246d1c;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git diff --git a/music_sampler.py b/music_sampler.py index 81b96c4..7bd7513 100644 --- a/music_sampler.py +++ b/music_sampler.py @@ -11,6 +11,23 @@ from helpers.key import Key from helpers.mapping import Mapping import helpers +class KeyList(RelativeLayout): + keylist = ListProperty([]) + first_key = StringProperty("") + second_key = StringProperty("") + third_key = StringProperty("") + + def append(self, value): + self.keylist.insert(0, value) + + def on_keylist(self, instance, new_key_list): + if len(self.keylist) > 0: + self.first_key = self.keylist[0] + if len(self.keylist) > 1: + self.second_key = self.keylist[1] + if len(self.keylist) > 2: + self.third_key = self.keylist[2] + class PlayList(RelativeLayout): playlist = ListProperty([]) @@ -27,10 +44,16 @@ class PlayList(RelativeLayout): for music_file in open_files.values(): if not music_file.is_playing(): 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):