Fix some omissions in r23001
svn: r23003
This commit is contained in:
parent
62743c6321
commit
4a91ff8238
@ -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):
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user