Show an error dialog if a file can not be opened with the default application.
svn: r11792
This commit is contained in:
parent
ea96136bf9
commit
662dbc94f6
10
src/Utils.py
10
src/Utils.py
@ -45,11 +45,10 @@ import gtk
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Mime
|
||||
from BasicUtils import name_displayer
|
||||
import gen.lib
|
||||
import Errors
|
||||
from QuestionDialog import WarningDialog
|
||||
from QuestionDialog import WarningDialog, ErrorDialog
|
||||
|
||||
from const import TEMP_DIR, USER_HOME
|
||||
import shutil
|
||||
@ -1124,9 +1123,16 @@ def open_file_with_default_application( file_path ):
|
||||
"""
|
||||
norm_path = os.path.normpath( file_path )
|
||||
|
||||
if not os.path.exists(norm_path):
|
||||
ErrorDialog(_("Error Opening File"), _("File does not exist"))
|
||||
return
|
||||
|
||||
if os.sys.platform == 'win32':
|
||||
norm_path = norm_path.encode(os.sys.getfilesystemencoding())
|
||||
try:
|
||||
os.startfile(norm_path)
|
||||
except WindowsError, msg:
|
||||
ErrorDialog(_("Error Opening File"), str(msg))
|
||||
else:
|
||||
search = os.environ['PATH'].split(':')
|
||||
for lpath in search:
|
||||
|
Loading…
Reference in New Issue
Block a user