]>
git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blob - app.py
3fd6f510c2236ae490c1b116aadb53a44f6d6972
1 from .helpers
import parse_args
, dump_config
, register_fonts
, path
7 from kivy
.app
import App
8 from kivy
.uix
.floatlayout
import FloatLayout
9 from kivy
.uix
.relativelayout
import RelativeLayout
10 from kivy
.uix
.label
import Label
11 from kivy
.properties
import ListProperty
, StringProperty
12 from kivy
.core
.window
import Window
13 from kivy
.lang
import Builder
19 from .helpers
import Config
21 from .mapping
import Mapping
23 from .app_blocks
.actionlist
import *
24 from .app_blocks
.playlist
import *
26 class KeyList(RelativeLayout
):
27 keylist
= ListProperty([])
28 first_key
= StringProperty("")
29 second_key
= StringProperty("")
30 third_key
= StringProperty("")
32 def append(self
, value
):
33 self
.keylist
.insert(0, value
)
35 def on_keylist(self
, instance
, new_key_list
):
36 if len(self
.keylist
) > 0:
37 self
.first_key
= self
.keylist
[0]
38 if len(self
.keylist
) > 1:
39 self
.second_key
= self
.keylist
[1]
40 if len(self
.keylist
) > 2:
41 self
.third_key
= self
.keylist
[2]
43 class UnfocusedOverlay(Label
):
46 class Screen(FloatLayout
):
47 def __init__(self
, **kwargs
):
48 super(Screen
, self
).__init
__(**kwargs
)
49 self
.unfocused_widget
= UnfocusedOverlay()
50 Window
.bind(focus
=self
.focus_changed
)
51 Window
.on_request_close
= self
.on_request_close
53 def focus_changed(self
, instance
, focus
):
54 if not Config
.focus_warning
:
57 self
.add_widget(self
.unfocused_widget
)
59 self
.remove_widget(self
.unfocused_widget
)
61 def on_request_close(self
, *args
, **kwargs
):
62 self
.ids
["Mapping"].leave_application()
64 class MusicSamplerApp(App
):
66 Window
.size
= (913, 563)
71 with open(path() + "/music_sampler.kv", encoding
='utf8') as f
:
72 Builder
.load_string(f
.read())
73 MusicSamplerApp().run()