* 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,17 +193,19 @@ 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()
try: if filetype in [const.app_gramps,const.app_gramps_xml,
if open_native(self.parent,filename,filetype): const.app_gedcom]:
return True
except db.DBInvalidArgError, msg: try:
QuestionDialog.ErrorDialog( return open_native(self.parent,filename,filetype)
_("Could not open file: %s") % filename, msg[1]) except db.DBInvalidArgError, msg:
return False QuestionDialog.ErrorDialog(
except: _("Could not open file: %s") % filename, msg[1])
import DisplayTrace return False
DisplayTrace.DisplayTrace() except:
return False import DisplayTrace
DisplayTrace.DisplayTrace()
return False
# The above native formats did not work, so we need to # The above native formats did not work, so we need to
# look up the importer for this format # look up the importer for this format
@@ -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