From 9bb4aaaf491ad70445a62d60fb5be384fbfc297d Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 30 Jun 2017 14:31:51 -0700 Subject: [PATCH] Open web links with /usr/bin/open on Mac and Python older than 3.5 Works around https://bugs.python.org/issue24452 Fixes #10105 --- gramps/gui/display.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gramps/gui/display.py b/gramps/gui/display.py index 47fa50e49..3ce1f83b0 100644 --- a/gramps/gui/display.py +++ b/gramps/gui/display.py @@ -25,7 +25,7 @@ #------------------------------------------------------------------------- import os import webbrowser - +import sys #------------------------------------------------------------------------ # # GRAMPS modules @@ -33,7 +33,7 @@ import webbrowser #------------------------------------------------------------------------ from gramps.gen.const import GRAMPS_LOCALE as glocale 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.gui.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. """ - 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)