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