on_close_window() callback added.

cleanly shuts down vban connection on windows close
if vban connected.
This commit is contained in:
onyx-and-iris 2023-08-06 23:15:54 +01:00
parent 6222ab1e62
commit bfb0482c32
2 changed files with 7 additions and 1 deletions

View File

@ -50,6 +50,7 @@ class App(tk.Tk):
self.minsize(275, False)
self.subject = Subject()
self._configs = None
self.protocol("WM_DELETE_WINDOW", self.on_close_window)
self.menu = self["menu"] = Menus(self, vmr)
self.styletable = ttk.Style()
if _configuration.config:
@ -182,6 +183,11 @@ class App(tk.Tk):
self.destroy()
self.after(250, self.healthcheck_step)
def on_close_window(self):
if _base_values.vban_connected:
self._vban.logout()
self.destroy()
_apps = {kind.name: App.make(kind) for kind in _kinds_all}

View File

@ -227,7 +227,7 @@ class Menus(tk.Menu):
if fn := getattr(self.target.command, cmd):
fn()
if cmd == "shutdown":
self.parent.destroy()
self.parent.on_close_window()
def action_set_voicemeeter(self, cmd, val=True):
if cmd == "lock":