aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helpers/key.py1
-rw-r--r--music_sampler.kv68
-rw-r--r--music_sampler.py17
3 files changed, 84 insertions, 2 deletions
diff --git a/helpers/key.py b/helpers/key.py
index f49b3ec..ca73b87 100644
--- a/helpers/key.py
+++ b/helpers/key.py
@@ -83,6 +83,7 @@ class Key(ButtonBehavior, Widget):
83 if not self.enabled: 83 if not self.enabled:
84 return None 84 return None
85 85
86 self.parent.parent.ids['KeyList'].append(self.key_sym)
86 print("running actions for {}".format(self.key_sym)) 87 print("running actions for {}".format(self.key_sym))
87 start_time = time.time() 88 start_time = time.time()
88 self.parent.start_running(self, start_time) 89 self.parent.start_running(self, start_time)
diff --git a/music_sampler.kv b/music_sampler.kv
index 4a44069..d21c5fb 100644
--- a/music_sampler.kv
+++ b/music_sampler.kv
@@ -85,14 +85,21 @@
85 mapping_width: self.key_size * 18 + self.key_sep * 16 + self.key_pad_sep 85 mapping_width: self.key_size * 18 + self.key_sep * 16 + self.key_pad_sep
86 mapping_x: self.border 86 mapping_x: self.border
87 mapping_y: self.top - self.mapping_height - self.border 87 mapping_y: self.top - self.mapping_height - self.border
88
89 key_list_width: 4 * (mock_ubuntu_regular.width or 0)
90 key_list_height: self.height - self.mapping_height - 3 * self.border
91 key_list_x: (self.action_list_width or 0) + 2 * self.border
92 key_list_y: self.border
93
88 action_list_height: self.height - self.mapping_height - 3 * self.border 94 action_list_height: self.height - self.mapping_height - 3 * self.border
89 action_list_width: 3 * self.width / 4 95 action_list_width: 3 * self.width / 4 - self.key_list_width - self.border
90 action_list_x: self.border 96 action_list_x: self.border
91 action_list_y: self.border 97 action_list_y: self.border
98
92 play_list_height: self.action_list_height 99 play_list_height: self.action_list_height
93 play_list_width: self.width - self.action_list_width - 3* self.border 100 play_list_width: self.width - self.action_list_width - 3* self.border
94 play_list_y: self.border 101 play_list_y: self.border
95 play_list_x: self.action_list_width + 2 * self.border 102 play_list_x: self.action_list_width + self.key_list_width + 3 * self.border
96 103
97 min_height: min(mock_symbola.height, mock_ubuntu_regular.height, mock_ubuntu_bold.height) 104 min_height: min(mock_symbola.height, mock_ubuntu_regular.height, mock_ubuntu_bold.height)
98 symbola_line_height: self.min_height / max(mock_symbola.height,1) 105 symbola_line_height: self.min_height / max(mock_symbola.height,1)
@@ -139,11 +146,68 @@
139 id: ActionList 146 id: ActionList
140 pos: self.parent.action_list_x, self.parent.action_list_y 147 pos: self.parent.action_list_x, self.parent.action_list_y
141 size: self.parent.action_list_width, self.parent.action_list_height 148 size: self.parent.action_list_width, self.parent.action_list_height
149 KeyList:
150 id: KeyList
151 pos: self.parent.key_list_x, self.parent.key_list_y
152 size: self.parent.key_list_width, self.parent.key_list_height
142 PlayList: 153 PlayList:
143 id: PlayList 154 id: PlayList
144 pos: self.parent.play_list_x, self.parent.play_list_y 155 pos: self.parent.play_list_x, self.parent.play_list_y
145 size: self.parent.play_list_width, self.parent.play_list_height 156 size: self.parent.play_list_width, self.parent.play_list_height
146 157
158<KeyList>:
159 size_hint: None, None
160 canvas:
161 Color:
162 rgba: 250./255, 250./255, 250./255, 1
163 Rectangle:
164 pos: 0, 0
165 size: self.width, self.height
166 Label:
167 id: key_list_first
168 font_name: h.path() + "fonts/Ubuntu-B.ttf"
169 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
170 color: 0, 0, 0, 1
171 text: self.parent.first_key
172 text_size: None, None
173 valign: "top"
174 size_hint: None, None
175 size: self.parent.width, self.texture_size[1]
176 pos: 0, self.parent.height - self.height
177 Label:
178 id: key_list_second
179 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
180 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
181 color: 0, 0, 0, 1
182 text: self.parent.second_key
183 text_size: None, None
184 valign: "top"
185 size_hint: None, None
186 size: self.parent.width, self.texture_size[1]
187 pos: 0, self.parent.height - key_list_first.height - self.height
188 Label:
189 id: key_list_third
190 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
191 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
192 color: 0, 0, 0, 0.75
193 text: self.parent.third_key
194 text_size: None, None
195 valign: "top"
196 size_hint: None, None
197 size: self.parent.width, self.texture_size[1]
198 pos: 0, self.parent.height - key_list_first.height - key_list_second.height - self.height
199 Label:
200 id: key_list_rest
201 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
202 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
203 color: 0, 0, 0, 0.5
204 text: "\n".join(self.parent.keylist[3:])
205 text_size: None, None
206 valign: "top"
207 size_hint: None, None
208 size: self.parent.width, self.texture_size[1]
209 pos: 0, self.parent.height - key_list_first.height - key_list_second.height - key_list_third.height - self.height
210
147<ActionList>: 211<ActionList>:
148 size_hint: None, None 212 size_hint: None, None
149 canvas: 213 canvas:
diff --git a/music_sampler.py b/music_sampler.py
index 81b96c4..5e61466 100644
--- a/music_sampler.py
+++ b/music_sampler.py
@@ -11,6 +11,23 @@ from helpers.key import Key
11from helpers.mapping import Mapping 11from helpers.mapping import Mapping
12import helpers 12import helpers
13 13
14class KeyList(RelativeLayout):
15 keylist = ListProperty([])
16 first_key = StringProperty("")
17 second_key = StringProperty("")
18 third_key = StringProperty("")
19
20 def append(self, value):
21 self.keylist = [value] + self.keylist
22
23 def on_keylist(self, instance, new_key_list):
24 if len(self.keylist) > 0:
25 self.first_key = self.keylist[0]
26 if len(self.keylist) > 1:
27 self.second_key = self.keylist[1]
28 if len(self.keylist) > 2:
29 self.third_key = self.keylist[2]
30
14class PlayList(RelativeLayout): 31class PlayList(RelativeLayout):
15 playlist = ListProperty([]) 32 playlist = ListProperty([])
16 33