]>
git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blob - music_sampler/app.py
1 from .helpers
import parse_args
, 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
18 from .helpers
import Config
20 from .mapping
import Mapping
22 from .app_blocks
.actionlist
import *
23 from .app_blocks
.playlist
import *
25 class KeyList(RelativeLayout
):
26 keylist
= ListProperty([])
27 first_key
= StringProperty("")
28 second_key
= StringProperty("")
29 third_key
= StringProperty("")
31 def append(self
, value
):
32 self
.keylist
.insert(0, value
)
34 def on_keylist(self
, instance
, new_key_list
):
35 if len(self
.keylist
) > 0:
36 self
.first_key
= self
.keylist
[0]
37 if len(self
.keylist
) > 1:
38 self
.second_key
= self
.keylist
[1]
39 if len(self
.keylist
) > 2:
40 self
.third_key
= self
.keylist
[2]
42 class UnfocusedOverlay(Label
):
45 class Screen(FloatLayout
):
46 def __init__(self
, **kwargs
):
47 super(Screen
, self
).__init
__(**kwargs
)
48 self
.unfocused_widget
= UnfocusedOverlay()
49 Window
.bind(focus
=self
.focus_changed
)
50 Window
.on_request_close
= self
.on_request_close
52 def focus_changed(self
, instance
, focus
):
53 if not Config
.focus_warning
:
56 self
.add_widget(self
.unfocused_widget
)
58 self
.remove_widget(self
.unfocused_widget
)
60 def on_request_close(self
, *args
, **kwargs
):
61 self
.ids
["Mapping"].leave_application()
63 class MusicSamplerApp(App
):
65 Window
.size
= (913, 563)
70 Builder
.load_file(path() + "/music_sampler.kv")
71 MusicSamplerApp().run()