From 48b8a9f591d66494a8b03845bf7226d0c92ad8bd Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sun, 27 Oct 2024 22:58:40 +0000 Subject: [PATCH 1/3] fix:gui spam (#133) do not spam the bus with GUI messages if disabled in config --- ovos_bus_client/apis/gui.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ovos_bus_client/apis/gui.py b/ovos_bus_client/apis/gui.py index 3286999..993f743 100644 --- a/ovos_bus_client/apis/gui.py +++ b/ovos_bus_client/apis/gui.py @@ -119,6 +119,10 @@ def set_bus(self, bus=None): self._bus = bus or get_mycroft_bus() self.setup_default_handlers() + @property + def gui_disabled(self) -> bool: + return Configuration().get("gui", {}).get("disable_gui", False) + @property def bus(self): """ @@ -276,6 +280,8 @@ def gui_set(self, message: Message): self.on_gui_changed_callback() def _sync_data(self): + if self.gui_disabled: + return if not self.bus: raise RuntimeError("bus not set, did you call self.bind() ?") data = self.__session_data.copy() @@ -322,6 +328,8 @@ def clear(self): self.__session_data = {} self._pages = [] self.current_page_idx = -1 + if self.gui_disabled: + return if not self.bus: raise RuntimeError("bus not set, did you call self.bind() ?") self.bus.emit(Message("gui.clear.namespace", @@ -337,6 +345,8 @@ def send_event(self, event_name: str, params: json serializable object containing any parameters that should be sent along with the request. """ + if self.gui_disabled: + return params = params or {} if not self.bus: raise RuntimeError("bus not set, did you call self.bind() ?") @@ -442,6 +452,8 @@ def show_pages(self, page_names: List[str], index: int = 0, self._pages = page_names self.current_page_idx = index + if self.gui_disabled: + return # First sync any data... data = self.__session_data.copy() data.update({'__from': self.skill_id}) @@ -470,6 +482,8 @@ def remove_pages(self, page_names: List[str]): Request to remove a list of pages from the GUI. @param page_names: list of page resources requested """ + if self.gui_disabled: + return if not self.bus: raise RuntimeError("bus not set, did you call self.bind() ?") if isinstance(page_names, str): @@ -489,6 +503,8 @@ def remove_all_pages(self, except_pages=None): Request to remove all pages from the GUI. @param except_pages: list of optional page resources to keep """ + if self.gui_disabled: + return if not self.bus: raise RuntimeError("bus not set, did you call self.bind() ?") self.bus.emit(Message("gui.page.delete.all", From b69209dc82dda0a69bbe1590f046dac70d15cb7d Mon Sep 17 00:00:00 2001 From: JarbasAl Date: Sun, 27 Oct 2024 22:58:56 +0000 Subject: [PATCH 2/3] Increment Version to 0.1.6a1 --- ovos_bus_client/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ovos_bus_client/version.py b/ovos_bus_client/version.py index b58f0b7..bbc3689 100644 --- a/ovos_bus_client/version.py +++ b/ovos_bus_client/version.py @@ -1,6 +1,6 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 1 -VERSION_BUILD = 5 -VERSION_ALPHA = 0 +VERSION_BUILD = 6 +VERSION_ALPHA = 1 # END_VERSION_BLOCK From 395d12be3039ff1881766f8c89ea2850b82c7d7e Mon Sep 17 00:00:00 2001 From: JarbasAl Date: Sun, 27 Oct 2024 22:59:19 +0000 Subject: [PATCH 3/3] Update Changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0235da2..b673df1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,12 @@ # Changelog -## [0.1.5a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/0.1.5a1) (2024-10-21) +## [0.1.6a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/0.1.6a1) (2024-10-27) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/0.1.4...0.1.5a1) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/0.1.5...0.1.6a1) **Merged pull requests:** -- fix:log spam [\#131](https://github.com/OpenVoiceOS/ovos-bus-client/pull/131) ([JarbasAl](https://github.com/JarbasAl)) +- fix:gui spam [\#133](https://github.com/OpenVoiceOS/ovos-bus-client/pull/133) ([JarbasAl](https://github.com/JarbasAl))