From 4bae1e1d15338496f4484ad4c556b7bfd16277a9 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Thu, 29 Jun 2023 18:14:38 +0100 Subject: [PATCH] set greace period if gui was launched by the api --- vmcompact/app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vmcompact/app.py b/vmcompact/app.py index 85a2c87..92114eb 100644 --- a/vmcompact/app.py +++ b/vmcompact/app.py @@ -40,7 +40,7 @@ class App(tk.Tk): self.logger = logger.getChild(self.__class__.__name__) self._vmr = vmr self._vmr.event.add(["pdirty", "ldirty"]) - self.after(12000 if not self._vmr.gui.initial_state else 1, self.start_updates) + self.after(12000 if self._vmr.gui.launched_by_api else 1, self.start_updates) self._vmr.init_thread() icon_path = Path(__file__).parent.resolve() / "img" / "cat.ico" if icon_path.is_file(): @@ -61,6 +61,8 @@ class App(tk.Tk): def start_updates(self): self.logger.debug("updates started") _base_values.run_update = True + if self._vmr.gui.launched_by_api: + self.on_pdirty() def __str__(self): return f"{type(self).__name__}App"