Skip to content

Commit

Permalink
Check if the request for the webbrowser from python is trying to di…
Browse files Browse the repository at this point in the history
…splay an html file and if so, use the new `show-html-file` comm to display in viewer pane.
  • Loading branch information
nstrayer committed Jul 29, 2024
1 parent 9b40f51 commit c5f77c8
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@ def open(self, url, new=0, autoraise=True):
if not self._comm:
return False

# Check if the url starts with 'file://', and if it does send the comm message
# for opening an html file and ends with '.html' or '.htm' to open the file in the browser
if url.startswith("file://") and (url.endswith(".html") or url.endswith(".htm")):
self._comm.send_event(
name=UiFrontendEvent.ShowHtmlFile,
payload={
"path": url,
# TODO: Figure out if the file being displayed is a plot or not.
"is_plot": False,
},
)
return True

for addr in _localhosts:
if addr in url:
event = ShowUrlParams(url=url)
Expand Down

0 comments on commit c5f77c8

Please sign in to comment.