From 1424d3d20fb5453fa5b79fdba71f382d80395158 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 2 Sep 2013 21:02:33 +0000 Subject: [PATCH] Silence error box for browser launch svn: r23004 --- src/GrampsDisplay.py | 2 +- src/gui/utils.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/GrampsDisplay.py b/src/GrampsDisplay.py index d56ab61e6..e8b48a786 100644 --- a/src/GrampsDisplay.py +++ b/src/GrampsDisplay.py @@ -87,7 +87,7 @@ def url(link, uistate=None): page = uistate.viewmanager.goto_page(cat_num, None) page.open(link) return - if not open_file_with_default_application(link): + if not open_file_with_default_application(link, display_error=False): run_browser(link) def run_browser(url): diff --git a/src/gui/utils.py b/src/gui/utils.py index 94742d75e..fa5da7f21 100644 --- a/src/gui/utils.py +++ b/src/gui/utils.py @@ -337,11 +337,11 @@ def display_error_dialog (index, errorstrings): if errorstrings: if isinstance(errorstrings, dict): try: - error = errorstrings[resp] + error = errorstrings[index] except KeyError: pass - else: - error = errorstrings + else: + error = errorstrings ErrorDialog(_("Error from external program"), error) @@ -362,10 +362,10 @@ def poll_external ((proc, errorstrings)): return True if resp != 0: - display_error(resp, errorstrings) + display_error_dialog(resp, errorstrings) return False -def open_file_with_default_application(uri): +def open_file_with_default_application(uri, display_error=True): """ Launch a program to open an arbitrary file. The file will be opened using whatever program is configured on the host as the default program for that @@ -376,7 +376,6 @@ def open_file_with_default_application(uri): @type file_path: string @return: nothing """ - from QuestionDialog import ErrorDialog from urlparse import urlparse from time import sleep errstrings = None @@ -385,7 +384,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): - display_error(0, _("File does not exist")) + display_error_dialog(0, _("File does not exist")) return False else: norm_path = uri @@ -394,7 +393,7 @@ def open_file_with_default_application(uri): try: os.startfile(norm_path) except WindowsError, msg: - display_error(0, str(msg)) + display_error_dialog(0, str(msg)) return False return True @@ -417,7 +416,8 @@ def open_file_with_default_application(uri): if resp == 0: return True - display_error(resp, errstrings) + if display_error: + display_error_dialog(resp, errstrings) return False def process_pending_events(max_count=10):