From 0c1e899d5e61c1449dbe41ca7542bf22bbc2ff8c Mon Sep 17 00:00:00 2001 From: miro Date: Thu, 19 Sep 2024 01:48:22 +0100 Subject: [PATCH] fix:cache_gui_files companion to https://github.com/OpenVoiceOS/ovos-gui/pull/53 and https://github.com/OpenVoiceOS/ovos-bus-client/pull/120 this should be merged first as it does not require the others to work and does not break anything in the wild --- ovos_gui_plugin_shell_companion/__init__.py | 27 ++++++++++++--------- requirements.txt | 3 ++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ovos_gui_plugin_shell_companion/__init__.py b/ovos_gui_plugin_shell_companion/__init__.py index d0e1c68..0245b34 100644 --- a/ovos_gui_plugin_shell_companion/__init__.py +++ b/ovos_gui_plugin_shell_companion/__init__.py @@ -1,13 +1,13 @@ import platform -from os.path import join, dirname +from os.path import dirname from ovos_bus_client import Message -from ovos_bus_client.apis.gui import GUIInterface from ovos_bus_client.client import MessageBusClient from ovos_config.config import Configuration from ovos_plugin_manager.templates.gui import GUIExtension from ovos_utils import network_utils from ovos_utils.log import LOG +from ovos_workshop.skills.ovos import SkillGUI from ovos_gui_plugin_shell_companion.brightness import BrightnessManager from ovos_gui_plugin_shell_companion.color_manager import ColorManager @@ -15,6 +15,18 @@ from ovos_gui_plugin_shell_companion.wigets import WidgetManager +class _FakeSkill: + # SkillGUI expects a OVOSSkill, we need to define + # self.skill_id , self.bus , self.config_core, self.root_dir + def __init__(self, bus): + self.bus = bus + # the skill_id is chosen so the namespace matches the regular bus api + # ie, the gui event "XXX" is sent in the bus as "ovos.common_play.XXX" + self.skill_id = "ovos_gui_plugin_shell_companion" + self.root_dir = f"{dirname(__file__)}/res" + self.config_core = Configuration() + + class OVOSShellCompanionExtension(GUIExtension): """OVOS-shell Extension: This extension is responsible for managing the Smart Speaker specific GUI behaviours. This extension adds support for Homescreens and Homescreen Mangement. @@ -29,17 +41,10 @@ class OVOSShellCompanionExtension(GUIExtension): """ def __init__(self, config: dict, bus: MessageBusClient = None, - gui: GUIInterface = None, + gui: SkillGUI = None, preload_gui=False, permanent=True): config["homescreen_supported"] = True - res_dir = join(dirname(__file__), "res") - gui = gui or GUIInterface("ovos_gui_plugin_shell_companion", - bus=bus, config=Configuration(), - ui_directories={"qt5": join(res_dir, "ui"), - "qt6": join(res_dir, "ui6")}) - if not gui.ui_directories: - LOG.info(f"Setting default qt5 resource directory to: {res_dir}") - gui.ui_directories["qt5"] = res_dir + gui = gui or SkillGUI(_FakeSkill(bus)) LOG.info("OVOS Shell: Initializing") super().__init__(config=config, bus=bus, gui=gui, preload_gui=preload_gui, permanent=permanent) diff --git a/requirements.txt b/requirements.txt index fdc27d9..08f6135 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ ovos-plugin-manager>=0.0.23,<1.0.0 ovos-utils>=0.0.34,<1.0.0 -ovos-bus-client>=0.0.3,<1.0.0 +ovos-workshop>=0.0.1,<1.0.0 +ovos-bus-client>=0.0.3,<2.0.0 astral~=3.0