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 cd6b816099
commit 123c2f44f8
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> 2006-11-10 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/ImportGeneWeb.py: Start parsing titles of a person * src/plugins/ImportGeneWeb.py: Start parsing titles of a person
* src/DataViews/_PedigreeView.py, * src/DataViews/_PedigreeView.py,

View File

@ -145,15 +145,10 @@ class BaseModel(gtk.GenericTreeModel):
self.indexlist = {} self.indexlist = {}
def add_row_by_handle(self,handle): def add_row_by_handle(self,handle):
self.datalist = self.sort_keys() self.rebuild_data()
i = 0
self.indexlist = {}
for key in self.datalist:
self.indexlist[key] = i
i += 1
index = self.indexlist[handle] index = self.indexlist[handle]
node = self.get_iter(index) node = self.get_iter(index)
self.row_inserted(index,node) self.row_inserted(index, node)
def delete_row_by_handle(self,handle): def delete_row_by_handle(self,handle):
index = self.indexlist[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 errmsg = _("%s could not be opened\n") % filename
ErrorDialog(errmsg,str(msg)) ErrorDialog(errmsg,str(msg))
return return
except Errors.GedcomError, val:
(m1,m2) = val.messages()
ErrorDialog(m1,m2)
return
except db.DBSecondaryBadError, msg: except db.DBSecondaryBadError, msg:
WarningDialog(_('Database corruption detected'), WarningDialog(_('Database corruption detected'),
_('A problem was detected with the database. Please ' _('A problem was detected with the database. Please '
'run the Check and Repair Database tool to fix the ' 'run the Check and Repair Database tool to fix the '
'problem.')) 'problem.'))
return return
except Errors.GedcomError, msg:
ErrorDialog(_('Error reading GEDCOM file'), str(msg))
return
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -815,11 +814,11 @@ class GedcomParser(UpdateCallback):
if not self.groups: if not self.groups:
self.text = ""; self.text = "";
self.backoff = False 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.errmsg(msg)
self.error_count += 1 self.error_count += 1
self.groups = (-1, TOKEN_UNKNOWN, "","") self.groups = (-1, TOKEN_UNKNOWN, "","")
return self.groups raise Errors.GedcomError(msg)
self.backoff = False self.backoff = False
return self.groups return self.groups
@ -849,15 +848,12 @@ class GedcomParser(UpdateCallback):
self.indi_count = 0 self.indi_count = 0
self.repo_count = 0 self.repo_count = 0
self.source_count = 0 self.source_count = 0
try: self.parse_header()
self.parse_header() self.parse_submitter()
self.parse_submitter() if self.use_def_src:
if self.use_def_src: self.db.add_source(self.def_src,self.trans)
self.db.add_source(self.def_src,self.trans) self.parse_record()
self.parse_record() self.parse_trailer()
self.parse_trailer()
except Errors.GedcomError, err:
self.errmsg(str(err))
for value in self.inline_srcs.keys(): for value in self.inline_srcs.keys():
title,note = value title,note = value