Start work on special handling for remote file hyperlinks
This commit is contained in:
parent
399a1f8fee
commit
b552173185
@ -490,8 +490,29 @@ class Window:
|
||||
get_boss().child_monitor.set_iutf8_winid(self.id, on)
|
||||
|
||||
def open_url(self, url: str, hyperlink_id: int) -> None:
|
||||
if hyperlink_id:
|
||||
from urllib.parse import urlparse
|
||||
try:
|
||||
purl = urlparse(url)
|
||||
except Exception:
|
||||
return
|
||||
if (not purl.scheme or purl.scheme == 'file'):
|
||||
if purl.netloc:
|
||||
from socket import gethostname
|
||||
try:
|
||||
hostname = gethostname()
|
||||
except Exception:
|
||||
hostname = ''
|
||||
remote_hostname = purl.netloc.partition(':')[0]
|
||||
if remote_hostname and remote_hostname != hostname:
|
||||
self.handle_remote_file(purl.netloc, purl.path)
|
||||
return
|
||||
|
||||
get_boss().open_url(url)
|
||||
|
||||
def handle_remote_file(self, netloc: str, remote_path: str) -> None:
|
||||
pass
|
||||
|
||||
def focus_changed(self, focused: bool) -> None:
|
||||
if self.destroyed:
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user