Stop service with app shutdown, but persist on UI close

This commit is contained in:
Mark Qvist 2022-10-02 02:26:58 +02:00
parent bec6bda2f6
commit 8b275cbe7f
3 changed files with 31 additions and 15 deletions

View file

@ -317,6 +317,12 @@ class SidebandApp(MDApp):
self.sideband.setstate("app.foreground", False)
def final_exit(dt):
RNS.log("Stopping service...")
self.sideband.setstate("wants.service_stop", True)
while self.sideband.service_available():
time.sleep(0.2)
RNS.log("Service stopped")
RNS.exit()
MDApp.get_running_app().stop()
Window.close()