should a config be loaded during engine startup

bypass _base_values.run_update

patch bump
This commit is contained in:
onyx-and-iris 2023-09-07 08:39:20 +01:00
parent 1498daf36f
commit c684ed9981
3 changed files with 17 additions and 7 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "voicemeeter-compact" name = "voicemeeter-compact"
version = "1.9.2" version = "1.9.3"
description = "A Compact Voicemeeter Remote App" description = "A Compact Voicemeeter Remote App"
authors = ["onyx-and-iris <code@onyxandiris.online>"] authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT" license = "MIT"

View File

@ -42,13 +42,13 @@ class App(tk.Tk):
self.logger = logger.getChild(self.__class__.__name__) self.logger = logger.getChild(self.__class__.__name__)
self._vmr = vmr self._vmr = vmr
self._vmr.event.add(["pdirty", "ldirty"]) self._vmr.event.add(["pdirty", "ldirty"])
self.after(12000 if self._vmr.gui.launched_by_api else 1, self.start_updates) self.subject = Subject()
self.start_updates()
self._vmr.init_thread() self._vmr.init_thread()
icon_path = Path(__file__).parent.resolve() / "img" / "cat.ico" icon_path = Path(__file__).parent.resolve() / "img" / "cat.ico"
if icon_path.is_file(): if icon_path.is_file():
self.iconbitmap(str(icon_path)) self.iconbitmap(str(icon_path))
self.minsize(275, False) self.minsize(275, False)
self.subject = Subject()
self._configs = None self._configs = None
self.protocol("WM_DELETE_WINDOW", self.on_close_window) self.protocol("WM_DELETE_WINDOW", self.on_close_window)
self.menu = self["menu"] = Menus(self, vmr) self.menu = self["menu"] = Menus(self, vmr)
@ -148,10 +148,15 @@ class App(tk.Tk):
return self._configs return self._configs
def start_updates(self): def start_updates(self):
def init():
self.logger.debug("updates started") self.logger.debug("updates started")
_base_values.run_update = True _base_values.run_update = True
if self._vmr.gui.launched_by_api: if self._vmr.gui.launched_by_api:
self.on_pdirty() self.subject.notify("pdirty")
self.after(12000, init)
else:
init()
def healthcheck_step(self): def healthcheck_step(self):
if not _base_values.vban_connected: if not _base_values.vban_connected:

View File

@ -4,10 +4,11 @@ import webbrowser
from functools import partial from functools import partial
from tkinter import messagebox from tkinter import messagebox
import sv_ttk
import vban_cmd import vban_cmd
from vban_cmd.error import VBANCMDConnectionError from vban_cmd.error import VBANCMDConnectionError
import sv_ttk
from .data import _base_values, _configuration, get_configuration, kind_get from .data import _base_values, _configuration, get_configuration, kind_get
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -238,10 +239,14 @@ class Menus(tk.Menu):
def load_custom_profile(self, profile): def load_custom_profile(self, profile):
self.logger.info(f"loading user profile {profile}") self.logger.info(f"loading user profile {profile}")
self.target.apply(profile) self.target.apply(profile)
if not _base_values.run_update:
self.parent.subject.notify("pdirty")
def load_profile(self, profile): def load_profile(self, profile):
self.logger.info(f"loading user profile {profile}") self.logger.info(f"loading user profile {profile}")
self.target.apply_config(profile) self.target.apply_config(profile)
if not _base_values.run_update:
self.parent.subject.notify("pdirty")
def load_defaults(self): def load_defaults(self):
msg = ( msg = (