]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - music_sampler/app.py
Leave application correctly when clicking on the cross button
[perso/Immae/Projets/Python/MusicSampler.git] / music_sampler / app.py
index ac1944a1a5075ce92a3b4340670b25fbafd13c9e..e7c90dbd8967da9a4cadda1a8068ef7c2223da54 100644 (file)
@@ -47,6 +47,7 @@ class Screen(FloatLayout):
         super(Screen, self).__init__(**kwargs)
         self.unfocused_widget = UnfocusedOverlay()
         Window.bind(focus=self.focus_changed)
+        Window.on_request_close = self.on_request_close
 
     def focus_changed(self, instance, focus):
         if Config.no_focus_warning:
@@ -56,6 +57,9 @@ class Screen(FloatLayout):
         else:
             self.remove_widget(self.unfocused_widget)
 
+    def on_request_close(self, *args, **kwargs):
+        self.ids["Mapping"].leave_application()
+
 class MusicSamplerApp(App):
     def build(self):
         Window.size = (913, 563)