diff options
Diffstat (limited to 'music_sampler/app.py')
-rw-r--r-- | music_sampler/app.py | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/music_sampler/app.py b/music_sampler/app.py index 81c47a7..510cb44 100644 --- a/music_sampler/app.py +++ b/music_sampler/app.py | |||
@@ -1,4 +1,4 @@ | |||
1 | from .helpers import parse_args, register_fonts, duration_to_min_sec, path | 1 | from .helpers import parse_args, register_fonts, path |
2 | 2 | ||
3 | parse_args() | 3 | parse_args() |
4 | 4 | ||
@@ -6,9 +6,9 @@ import kivy | |||
6 | kivy.require("1.9.1") | 6 | kivy.require("1.9.1") |
7 | from kivy.app import App | 7 | from kivy.app import App |
8 | from kivy.uix.floatlayout import FloatLayout | 8 | from kivy.uix.floatlayout import FloatLayout |
9 | from kivy.uix.stacklayout import StackLayout | ||
9 | from kivy.uix.relativelayout import RelativeLayout | 10 | from kivy.uix.relativelayout import RelativeLayout |
10 | from kivy.properties import ListProperty, StringProperty | 11 | from kivy.properties import ListProperty, StringProperty |
11 | from kivy.clock import Clock | ||
12 | from kivy.core.window import Window | 12 | from kivy.core.window import Window |
13 | from kivy.lang import Builder | 13 | from kivy.lang import Builder |
14 | from .key import Key | 14 | from .key import Key |
@@ -16,6 +16,8 @@ from .mapping import Mapping | |||
16 | 16 | ||
17 | register_fonts() | 17 | register_fonts() |
18 | 18 | ||
19 | from .app_blocks.playlist import * | ||
20 | |||
19 | class KeyList(RelativeLayout): | 21 | class KeyList(RelativeLayout): |
20 | keylist = ListProperty([]) | 22 | keylist = ListProperty([]) |
21 | first_key = StringProperty("") | 23 | first_key = StringProperty("") |
@@ -33,33 +35,6 @@ class KeyList(RelativeLayout): | |||
33 | if len(self.keylist) > 2: | 35 | if len(self.keylist) > 2: |
34 | self.third_key = self.keylist[2] | 36 | self.third_key = self.keylist[2] |
35 | 37 | ||
36 | class PlayList(RelativeLayout): | ||
37 | playlist = ListProperty([]) | ||
38 | |||
39 | def __init__(self, **kwargs): | ||
40 | super(PlayList, self).__init__(**kwargs) | ||
41 | Clock.schedule_interval(self.update_playlist, 0.5) | ||
42 | |||
43 | def update_playlist(self, dt): | ||
44 | if self.parent is None or 'Mapping' not in self.parent.ids: | ||
45 | return True | ||
46 | |||
47 | open_files = self.parent.ids['Mapping'].open_files | ||
48 | self.playlist = [] | ||
49 | for music_file in open_files.values(): | ||
50 | if not music_file.is_in_use(): | ||
51 | continue | ||
52 | |||
53 | text = "{}/{}".format( | ||
54 | duration_to_min_sec(music_file.sound_position), | ||
55 | duration_to_min_sec(music_file.sound_duration)) | ||
56 | |||
57 | if music_file.is_loaded_paused(): | ||
58 | self.playlist.append(["⏸", music_file.name, text, False]) | ||
59 | else: | ||
60 | self.playlist.append(["⏵", music_file.name, text, True]) | ||
61 | |||
62 | |||
63 | class ActionList(RelativeLayout): | 38 | class ActionList(RelativeLayout): |
64 | action_title = StringProperty("") | 39 | action_title = StringProperty("") |
65 | action_list = ListProperty([]) | 40 | action_list = ListProperty([]) |