Skip to content

Commit

Permalink
Add file extension mapping for react GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Oct 5, 2023
1 parent e8d9ca6 commit f11ddb7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ovos_gui/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,13 @@ def _define_message_handlers(self):
"""
Defines event handlers for core messagebus.
"""
self.core_bus.on("recognizer_loop:audio_output_start",
self.forward_to_gui)
self.core_bus.on("recognizer_loop:audio_output_end",
self.forward_to_gui)
self.core_bus.on("mycroft.ready", self.forward_to_gui)
self.core_bus.on("mycroft.gui.port", self.forward_to_gui)

self.core_bus.on("gui.clear.namespace", self.handle_clear_namespace)
self.core_bus.on("gui.event.send", self.handle_send_event)
self.core_bus.on("gui.page.delete", self.handle_delete_page)
Expand All @@ -506,6 +513,14 @@ def _define_message_handlers(self):
self.core_bus.on("gui.page_gained_focus", self.handle_page_gained_focus)
self.core_bus.on("mycroft.skills.trained", self.handle_ready)

@staticmethod
def forward_to_gui(message: Message):
"""
Forward a core Message to the GUI
@param message: Core message to forward
"""
send_message_to_gui(message.as_dict)

def handle_ready(self, message):
self._ready_event.set()
self.core_bus.on("gui.volunteer_page_upload",
Expand Down
2 changes: 2 additions & 0 deletions ovos_gui/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def get_file_extension(framework: str) -> str:
"""
if framework in ("qt5", "qt6"):
return "qml"
if framework == "react":
return "jsx"
return ""

def get_uri(self, framework: str = "qt5", server_url: str = None) -> str:
Expand Down

0 comments on commit f11ddb7

Please sign in to comment.