Skip to content

Commit

Permalink
Update default GUI file path and documentation to address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Sep 28, 2023
1 parent 791eae3 commit 093cbc2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ under mycroft.conf
// "file_server_port": 8000,

// Optional support for collecting GUI files for container support
// This example describes a configuration where the host system has mounted
// `/tmp/gui_files` to the container path `/mount/gui_files`
// "gui_file_host_path": "/tmp/gui_files"
// "server_path": "/mount/gui_files"
// This example describes a configuration where the HOST system has collected
// GUI resources at `/tmp/gui_files`. The container path for these files will be
// {XDG_CACHE_HOME}/ovos_gui_file_server
// "ui_file_path": "/tmp/gui_files"

// Optionally specify a default qt version for connected clients
// "default_qt_version": 5,
Expand Down
4 changes: 2 additions & 2 deletions ovos_gui/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_client_pages(self, namespace):
client_pages = []
server_url = self.ns_manager.gui_file_server.url if \
self.ns_manager.gui_file_server else \
self.ns_manager.gui_file_host_path
self.ns_manager.ui_file_path
for page in namespace.pages:
uri = page.get_uri(self.framework, server_url)
client_pages.append(uri)
Expand Down Expand Up @@ -262,7 +262,7 @@ def send_gui_pages(self, pages: List[GuiPage], namespace: str,
"""
server_url = self.ns_manager.gui_file_server.url if \
self.ns_manager.gui_file_server else \
self.ns_manager.gui_file_host_path
self.ns_manager.ui_file_path
framework = self.framework

message = {
Expand Down
12 changes: 6 additions & 6 deletions ovos_gui/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def __init__(self, core_bus: MessageBusClient):
self._ready_event = Event()
self.gui_file_server = None
self.gui_file_path = None
self.gui_file_host_path = None
self.ui_file_path = None
self._connected_frameworks: List[str] = list()
self._init_gui_file_share()
self._define_message_handlers()
Expand All @@ -470,16 +470,16 @@ def _active_homescreen(self) -> str:

def _init_gui_file_share(self):
"""
Initialize optional GUI file collection. if `gui_file_host_path` is
Initialize optional GUI file collection. if `ui_file_path` is
defined, resources are assumed to be referenced outside this container.
If `gui_file_server` is defined, resources will be served via HTTP
"""
config = Configuration().get("gui", {})
self.gui_file_host_path = config.get("gui_file_host_path")
if config.get("gui_file_server") or self.gui_file_host_path:
from ovos_utils.file_utils import get_temp_path
self.ui_file_path = config.get("ui_file_path")
if config.get("gui_file_server") or self.ui_file_path:
from ovos_utils.xdg_utils import xdg_cache_home
self.gui_file_path = config.get("server_path") or \
get_temp_path("ovos_gui_file_server")
join(xdg_cache_home(), "ovos_gui_file_server")
if config.get("gui_file_server"):
self.gui_file_server = start_gui_http_server(self.gui_file_path)
self._upload_system_resources()
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/test_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def setUp(self):
with mock.patch(PATCH_MODULE + ".create_gui_service"):
self.namespace_manager = NamespaceManager(FakeBus())

def test_init_gui_server(self):
def test_init_gui_file_share(self):
# TODO
pass

Expand Down

0 comments on commit 093cbc2

Please sign in to comment.