2006-11-10 Don Allingham <don@gramps-project.org>

* src/GrampsDb/_ReadGedcom.py: handle GedcomError properly
	* src/DisplayModels/_BaseModel.py: handle add properly with filters



svn: r7609
This commit is contained in:
Don Allingham 2006-11-11 05:02:26 +00:00
parent ed5c45d64e
commit f960c2132f
3 changed files with 17 additions and 22 deletions

View File

@ -1,3 +1,7 @@
2006-11-10 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: handle GedcomError properly
* src/DisplayModels/_BaseModel.py: handle add properly with filters
2006-11-10 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/ImportGeneWeb.py: Start parsing titles of a person
* src/DataViews/_PedigreeView.py,

View File

@ -145,15 +145,10 @@ class BaseModel(gtk.GenericTreeModel):
self.indexlist = {}
def add_row_by_handle(self,handle):
self.datalist = self.sort_keys()
i = 0
self.indexlist = {}
for key in self.datalist:
self.indexlist[key] = i
i += 1
self.rebuild_data()
index = self.indexlist[handle]
node = self.get_iter(index)
self.row_inserted(index,node)
self.row_inserted(index, node)
def delete_row_by_handle(self,handle):
index = self.indexlist[handle]

View File

@ -244,16 +244,15 @@ def import2(database, filename, callback, codeset, use_trans):
errmsg = _("%s could not be opened\n") % filename
ErrorDialog(errmsg,str(msg))
return
except Errors.GedcomError, val:
(m1,m2) = val.messages()
ErrorDialog(m1,m2)
return
except db.DBSecondaryBadError, msg:
WarningDialog(_('Database corruption detected'),
_('A problem was detected with the database. Please '
'run the Check and Repair Database tool to fix the '
'problem.'))
return
except Errors.GedcomError, msg:
ErrorDialog(_('Error reading GEDCOM file'), str(msg))
return
#-------------------------------------------------------------------------
#
@ -815,11 +814,11 @@ class GedcomParser(UpdateCallback):
if not self.groups:
self.text = "";
self.backoff = False
msg = _("Premature end of file at line %d.\n") % self.groups[4]
msg = _("Your GEDCOM file is corrupted. It appears to have been truncated.")
self.errmsg(msg)
self.error_count += 1
self.groups = (-1, TOKEN_UNKNOWN, "","")
return self.groups
raise Errors.GedcomError(msg)
self.backoff = False
return self.groups
@ -849,15 +848,12 @@ class GedcomParser(UpdateCallback):
self.indi_count = 0
self.repo_count = 0
self.source_count = 0
try:
self.parse_header()
self.parse_submitter()
if self.use_def_src:
self.db.add_source(self.def_src,self.trans)
self.parse_record()
self.parse_trailer()
except Errors.GedcomError, err:
self.errmsg(str(err))
self.parse_header()
self.parse_submitter()
if self.use_def_src:
self.db.add_source(self.def_src,self.trans)
self.parse_record()
self.parse_trailer()
for value in self.inline_srcs.keys():
title,note = value