Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop the gui bus upload of resources #53

Merged
merged 13 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ GUI messagebus service, manages GUI state and implements the [gui protocol](./pr
GUI clients (the application that actually draws the GUI) connect to this service


# Plugins

plugins provide platform specific GUI functionality, such as determining when to show a homescreen or close a window

you should usually not need any of these unless instructed to install it from a GUI client application

- https://github.com/OpenVoiceOS/ovos-gui-plugin-shell-companion
- https://github.com/OpenVoiceOS/ovos-gui-plugin-mobile
- https://github.com/OpenVoiceOS/ovos-gui-plugin-plasmoid
- https://github.com/OpenVoiceOS/ovos-gui-plugin-bigscreen

# Configuration

under mycroft.conf
Expand All @@ -36,18 +25,8 @@ under mycroft.conf
"homescreen_supported": false
},

// Optional file server support for remote clients
// "gui_file_server": true,
// "file_server_port": 8000,

// Optional support for collecting GUI files for container support
// The ovos-gui container path for these files will be {XDG_CACHE_HOME}/ovos_gui_file_server.
// With the below configuration, the GUI client will have files prefixed with the configured host path,
// so the example below describes a situation where `{XDG_CACHE_HOME}/ovos_gui_file_server` maps
// to `/tmp/gui_files` on the filesystem where the GUI client is running.
// "gui_file_host_path": "/tmp/gui_files",

// Optionally specify a default qt version for connected clients that don't report it
// NOTE: currently only QT5 clients exist
"default_qt_version": 5
},

Expand All @@ -60,3 +39,26 @@ under mycroft.conf
}
}
```

# Plugins

plugins provide platform specific GUI functionality, such as determining when to show a homescreen or close a window

you should usually not need any of these unless instructed to install it from a GUI client application

- https://github.com/OpenVoiceOS/ovos-gui-plugin-shell-companion
- https://github.com/OpenVoiceOS/ovos-gui-plugin-mobile
- https://github.com/OpenVoiceOS/ovos-gui-plugin-plasmoid
- https://github.com/OpenVoiceOS/ovos-gui-plugin-bigscreen


# Limitations

gui resources files are populated under `~/.cache/mycrot/ovos-gui` by skills and other OVOS components and are expectd to be accessible by GUI client applications

This means GUI clients are expected to be running under the same machine or implement their own access to the resource files (resolving page names to uris is the client app responsibility)

> TODO: new repository with the removed GUI file server, serve files from `~/.cache/mycrot/ovos-gui` to be handled by client apps
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NeonDaniel not sure if you had a specific use case in mind, but please see this note


In case of containers a shared volume should be mounted between ovos-gui, skills and gui client apps

30 changes: 7 additions & 23 deletions ovos_gui/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,6 @@ def on_close(self):
LOG.info('Closing {}'.format(id(self)))
GUIWebsocketHandler.clients.remove(self)

def get_client_pages(self, namespace):
"""
Get a list of client page URLs for the given namespace
@param namespace: Namespace to get pages for
@return: list of page URIs for this GUI Client
"""
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
for page in namespace.pages:
uri = page.get_uri(self.framework, server_url)
client_pages.append(uri)

return client_pages

def synchronize(self):
"""
Upload namespaces, pages and data to the last connected client.
Expand All @@ -155,11 +139,13 @@ def synchronize(self):
"data": [{"skill_id": namespace.skill_id}]
})
# Insert pages
# if uri (path) can not be resolved, it might exist client side
# if path doesn't exist in client side, client is responsible for resolving page by namespace/name
self.send({"type": "mycroft.gui.list.insert",
"namespace": namespace.skill_id,
"position": 0,
"data": [{"url": url} for url in
self.get_client_pages(namespace)]
"data": [{"url": page.get_uri(self.framework), "page": page.name}
for page in namespace.pages]
})
# Insert data
for key, value in namespace.data.items():
Expand Down Expand Up @@ -260,16 +246,14 @@ def send_gui_pages(self, pages: List[GuiPage], namespace: str,
@param namespace: namespace to put GuiPages in
@param position: position to insert pages at
"""
server_url = self.ns_manager.gui_file_server.url if \
self.ns_manager.gui_file_server else \
self.ns_manager.gui_file_host_path
framework = self.framework

# if uri (path) can not be resolved, it might exist client side
# if path doesn't exist in client side, client is responsible for resolving page by namespace/name
message = {
"type": "mycroft.gui.list.insert",
"namespace": namespace,
"position": position,
"data": [{"url": page.get_uri(framework, server_url)}
"data": [{"url": page.get_uri(framework), "page": page.name}
for page in pages]
}
LOG.debug(f"Showing pages: {message['data']}")
Expand Down
4 changes: 4 additions & 0 deletions ovos_gui/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ovos_config.locations import get_xdg_cache_save_path

GUI_CACHE_PATH = get_xdg_cache_save_path('ovos_gui')
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved

58 changes: 0 additions & 58 deletions ovos_gui/gui_file_server.py

This file was deleted.

Loading
Loading