* 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> 2005-05-31 Anton Huber <anton_huber@gmx.de>
* src/po/de.po: Updated translation * src/po/de.po: Updated translation

View File

@@ -193,9 +193,11 @@ class ExistingDbPrompter:
filetype = get_mime_type(filename) filetype = get_mime_type(filename)
(the_path,the_file) = os.path.split(filename) (the_path,the_file) = os.path.split(filename)
choose.destroy() choose.destroy()
if filetype in [const.app_gramps,const.app_gramps_xml,
const.app_gedcom]:
try: try:
if open_native(self.parent,filename,filetype): return open_native(self.parent,filename,filetype)
return True
except db.DBInvalidArgError, msg: except db.DBInvalidArgError, msg:
QuestionDialog.ErrorDialog( QuestionDialog.ErrorDialog(
_("Could not open file: %s") % filename, msg[1]) _("Could not open file: %s") % filename, msg[1])
@@ -532,17 +534,14 @@ def open_native(parent,filename,filetype):
while gtk.events_pending(): while gtk.events_pending():
gtk.main_iteration() gtk.main_iteration()
parent.read_file(filename,update_msg) success = parent.read_file(filename,update_msg)
msg_top.destroy() msg_top.destroy()
success = True
elif filetype == const.app_gramps_xml: elif filetype == const.app_gramps_xml:
parent.db = GrampsXMLDB.GrampsXMLDB() parent.db = GrampsXMLDB.GrampsXMLDB()
parent.read_file(filename) success = parent.read_file(filename)
success = True
elif filetype == const.app_gedcom: elif filetype == const.app_gedcom:
parent.db = GrampsGEDDB.GrampsGEDDB() parent.db = GrampsGEDDB.GrampsGEDDB()
parent.read_file(filename) success = parent.read_file(filename)
success = True
if success: if success:
# Add the file to the recent items # Add the file to the recent items