]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blame - music_sampler/app.py
Use labels stacking to build playlist
[perso/Immae/Projets/Python/MusicSampler.git] / music_sampler / app.py
CommitLineData
d734981b 1from .helpers import parse_args, register_fonts, path
cc008de4 2
6ebe6247 3parse_args()
cc008de4 4
d8046b94
IB
5import kivy
6kivy.require("1.9.1")
4b2d79ca
IB
7from kivy.app import App
8from kivy.uix.floatlayout import FloatLayout
d734981b 9from kivy.uix.stacklayout import StackLayout
4b2d79ca
IB
10from kivy.uix.relativelayout import RelativeLayout
11from kivy.properties import ListProperty, StringProperty
4b2d79ca 12from kivy.core.window import Window
bb69f62e 13from kivy.lang import Builder
6ebe6247
IB
14from .key import Key
15from .mapping import Mapping
bb69f62e 16
6ebe6247 17register_fonts()
35bde798 18
d734981b
IB
19from .app_blocks.playlist import *
20
65ec4d2a
IB
21class KeyList(RelativeLayout):
22 keylist = ListProperty([])
23 first_key = StringProperty("")
24 second_key = StringProperty("")
25 third_key = StringProperty("")
26
27 def append(self, value):
98ff4305 28 self.keylist.insert(0, value)
65ec4d2a
IB
29
30 def on_keylist(self, instance, new_key_list):
31 if len(self.keylist) > 0:
32 self.first_key = self.keylist[0]
33 if len(self.keylist) > 1:
34 self.second_key = self.keylist[1]
35 if len(self.keylist) > 2:
36 self.third_key = self.keylist[2]
37
4b2d79ca
IB
38class ActionList(RelativeLayout):
39 action_title = StringProperty("")
40 action_list = ListProperty([])
189bf90c 41
b17aed6a 42 def update_list(self, key, action_descriptions):
4b2d79ca
IB
43 self.action_title = "actions linked to key {}:".format(key.key_sym)
44 self.action_list = []
189bf90c 45
b17aed6a
IB
46 for [action, status] in action_descriptions:
47 if status == "done":
4b2d79ca 48 icon = "✓"
b17aed6a 49 elif status == "current":
4b2d79ca
IB
50 icon = "✅"
51 else:
52 icon = " "
b17aed6a 53 self.action_list.append([icon, action])
189bf90c 54
4b2d79ca
IB
55class Screen(FloatLayout):
56 pass
189bf90c 57
4b2d79ca
IB
58class MusicSamplerApp(App):
59 def build(self):
60 Window.size = (913, 563)
9de92b6d 61
4b2d79ca 62 return Screen()
9de92b6d 63
6ebe6247
IB
64def main():
65 Builder.load_file(path() + "/music_sampler.kv")
4b2d79ca 66 MusicSamplerApp().run()