* src/DbPrompter.py: Properly return False if opening a file failed

svn: r4740
This commit is contained in:
Martin Hawlisch 2005-05-31 15:30:42 +00:00
parent fdda045607
commit 447191f427
2 changed files with 19 additions and 17 deletions

View File

@ -1,3 +1,6 @@
2005-05-30 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/DbPrompter.py: Properly return False if opening a file failed
2005-05-31 Anton Huber <anton_huber@gmx.de>
* src/po/de.po: Updated translation

View File

@ -193,17 +193,19 @@ class ExistingDbPrompter:
filetype = get_mime_type(filename)
(the_path,the_file) = os.path.split(filename)
choose.destroy()
try:
if open_native(self.parent,filename,filetype):
return True
except db.DBInvalidArgError, msg:
QuestionDialog.ErrorDialog(
_("Could not open file: %s") % filename, msg[1])
return False
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
return False
if filetype in [const.app_gramps,const.app_gramps_xml,
const.app_gedcom]:
try:
return open_native(self.parent,filename,filetype)
except db.DBInvalidArgError, msg:
QuestionDialog.ErrorDialog(
_("Could not open file: %s") % filename, msg[1])
return False
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
return False
# The above native formats did not work, so we need to
# look up the importer for this format
@ -532,17 +534,14 @@ def open_native(parent,filename,filetype):
while gtk.events_pending():
gtk.main_iteration()
parent.read_file(filename,update_msg)
success = parent.read_file(filename,update_msg)
msg_top.destroy()
success = True
elif filetype == const.app_gramps_xml:
parent.db = GrampsXMLDB.GrampsXMLDB()
parent.read_file(filename)
success = True
success = parent.read_file(filename)
elif filetype == const.app_gedcom:
parent.db = GrampsGEDDB.GrampsGEDDB()
parent.read_file(filename)
success = True
success = parent.read_file(filename)
if success:
# Add the file to the recent items