diff --git a/src/GrampsDisplay.py b/src/GrampsDisplay.py index 3e15d2ae7..d56ab61e6 100644 --- a/src/GrampsDisplay.py +++ b/src/GrampsDisplay.py @@ -80,13 +80,14 @@ def url(link, uistate=None): """ Open the specified URL in a browser. """ + from gui.utils import open_file_with_default_application if uistate and config.get('htmlview.url-handler'): cat_num = uistate.viewmanager.get_category('Web') if cat_num is not None: page = uistate.viewmanager.goto_page(cat_num, None) page.open(link) return - if not open_with_default_application(link): + if not open_file_with_default_application(link): run_browser(link) def run_browser(url): diff --git a/src/gui/utils.py b/src/gui/utils.py index 9e1ac200a..94742d75e 100644 --- a/src/gui/utils.py +++ b/src/gui/utils.py @@ -333,12 +333,15 @@ def display_error_dialog (index, errorstrings): Display a message box for errors resulting from xdg-open/open """ from QuestionDialog import ErrorDialog - error = "The external program failed to launch or experienced an error" + error = _("The external program failed to launch or experienced an error") if errorstrings: - try: - error = errorstrings[resp] - except KeyError: - pass + if isinstance(errorstrings, dict): + try: + error = errorstrings[resp] + except KeyError: + pass + else: + error = errorstrings ErrorDialog(_("Error from external program"), error) @@ -382,7 +385,7 @@ def open_file_with_default_application(uri): if (not urlcomp.scheme or urlcomp.scheme == 'file'): norm_path = os.path.normpath(urlcomp.path) if not os.path.exists(norm_path): - ErrorDialog(_("Error Opening File"), _("File does not exist")) + display_error(0, _("File does not exist")) return False else: norm_path = uri @@ -391,7 +394,7 @@ def open_file_with_default_application(uri): try: os.startfile(norm_path) except WindowsError, msg: - ErrorDialog(_("Error Opening File"), str(msg)) + display_error(0, str(msg)) return False return True