Skip to content

Commit

Permalink
Refactor to import method from ovos_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Jul 6, 2023
1 parent 8975bd7 commit 7c460b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
26 changes: 2 additions & 24 deletions ovos_workshop/skills/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from ovos_utils.enclosure.api import EnclosureAPI
from ovos_utils.events import EventSchedulerInterface
from ovos_utils.file_utils import FileWatcher
from ovos_utils.gui import GUIInterface
from ovos_utils.gui import GUIInterface, get_ui_directories
from ovos_utils.intents import ConverseTracker
from ovos_utils.intents import Intent, IntentBuilder
from ovos_utils.intents.intent_service_interface import munge_regex, munge_intent_parser, IntentServiceInterface
Expand Down Expand Up @@ -1895,33 +1895,11 @@ def __init__(self, skill: BaseSkill):
skill_id = skill.skill_id
bus = skill.bus
config = skill.config_core.get('gui')
ui_directories = self._get_ui_directories()
ui_directories = get_ui_directories(skill.root_dir)
GUIInterface.__init__(self, skill_id=skill_id, bus=bus, config=config,
ui_directories=ui_directories)

@property
@deprecated("`skill` should not be referenced directly", "0.1.0")
def skill(self):
return self._skill

def _get_ui_directories(self) -> dict:
"""
Get a dict of UI directories by GUI framework.
@return: Dict of framework name to UI resource directory
"""
ui_directories = dict()
base_directory = self._skill.root_dir
if isdir(join(base_directory, "gui")):
LOG.debug("Skill implements resources in `gui` directory")
ui_directories["all"] = join(base_directory, "gui")
return ui_directories
LOG.info("Checking for legacy UI directories")
# TODO: Add deprecation log after ovos-gui is implemented
if isdir(join(base_directory, "ui5")):
ui_directories["qt5"] = join(base_directory, "ui5")
if isdir(join(base_directory, "ui6")):
ui_directories["qt6"] = join(base_directory, "ui6")
if isdir(join(base_directory, "ui")) and "qt5" not in ui_directories:
LOG.debug("Handling `ui` directory as `qt5`")
ui_directories["qt5"] = join(base_directory, "ui")
return ui_directories
3 changes: 2 additions & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ovos-utils < 0.1.0, >=0.0.34
# ovos-utils < 0.1.0, >=0.0.34
ovos-utils@git+https://github.com/openvoiceos/ovos-utils@FEAT_GuiSendPageIDs
ovos_config < 0.1.0,>=0.0.5
ovos-lingua-franca~=0.4,>=0.4.6
ovos-bus-client < 0.1.0, >=0.0.5a1
Expand Down

0 comments on commit 7c460b2

Please sign in to comment.