Open web links with /usr/bin/open on Mac and Python older than 3.5
Works around https://bugs.python.org/issue24452 Fixes #10105
This commit is contained in:
parent
9174d0e573
commit
d10561f27c
@ -25,7 +25,7 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
import sys
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Gramps modules
|
# Gramps modules
|
||||||
@ -33,7 +33,7 @@ import webbrowser
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
from gramps.gen.const import URL_MANUAL_PAGE, URL_WIKISTRING
|
from gramps.gen.const import URL_MANUAL_PAGE, URL_WIKISTRING
|
||||||
from gramps.gen.constfunc import is_quartz
|
from gramps.gen.constfunc import is_quartz, mac
|
||||||
from gramps.gen.config import config
|
from gramps.gen.config import config
|
||||||
from .utils import open_file_with_default_application as run_file
|
from .utils import open_file_with_default_application as run_file
|
||||||
|
|
||||||
@ -74,4 +74,9 @@ def display_url(link, uistate=None):
|
|||||||
"""
|
"""
|
||||||
Open the specified URL in a browser.
|
Open the specified URL in a browser.
|
||||||
"""
|
"""
|
||||||
webbrowser.open_new_tab(link)
|
if (mac() and sys.version_info.major == 3 and sys.version_info.minor < 5):
|
||||||
|
import subprocess
|
||||||
|
proc = subprocess.call(['/usr/bin/open', link],
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
|
else:
|
||||||
|
webbrowser.open_new_tab(link)
|
||||||
|
Loading…
Reference in New Issue
Block a user