ReadGedcom importing improvements

svn: r1104
This commit is contained in:
Don Allingham 2002-08-03 03:44:00 +00:00
parent 06482ff46d
commit ae9ceb17e0
4 changed files with 11 additions and 6 deletions

View File

@ -30,7 +30,6 @@ import sys
# GNOME/GTK libraries
#
#-------------------------------------------------------------------------
import GdkImlib
import gtk
import gnome.ui
import gnome.config

View File

@ -960,6 +960,7 @@ class Gramps:
self.remove_from_person_list(p1,old_id)
self.remove_from_person_list(p2)
self.redisplay_person_list(p1)
self.update_display(0)
def on_delete_parents_clicked(self,obj):
if not self.active_parents:

View File

@ -22,7 +22,7 @@ import sys
if sys.version[0] != '1':
def utf8_to_latin(s):
return s.encode('latin-1','replace')
return s.encode('iso-8859-1','replace')
def latin_to_utf8(s):
return s

View File

@ -196,6 +196,8 @@ class GedcomParser:
self.trans = string.maketrans('','')
self.delc = self.trans[0:31]
self.trans2 = self.trans[0:127] + ('?' * 128)
self.file_obj = window.get_widget("file")
self.encoding_obj = window.get_widget("encoding")
self.created_obj = window.get_widget("created")
@ -261,11 +263,14 @@ class GedcomParser:
def get_next(self):
if self.backoff == 0:
next_line = self.f.readline()
if next_line == '':
next_line = string.strip(self.f.readline())
self.text = string.translate(next_line,self.trans,self.delc)
if self.text == '':
raise UNEXPECTED_EOF
self.text = self.cnv(string.strip(next_line))
self.text = string.translate(self.text,self.trans,self.delc)
try:
self.text = self.cnv(self.text)
except:
self.text = string.translate(self.text,self.trans2)
self.index = self.index + 1
l = string.split(self.text, None, 2)