* src/plugins/ReadGedcom.py: full support for undo
svn: r3183
This commit is contained in:
parent
ec3156362a
commit
109fe90e97
@ -1,4 +1,5 @@
|
||||
2004-05-19 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/plugins/ReadGedcom.py: full support for undo
|
||||
* src/ImageSelect.py: undo messages
|
||||
* src/MediaView.py: undo messages
|
||||
* src/RelLib.py: use db for undo status
|
||||
|
@ -2407,11 +2407,16 @@ class GrampsDB:
|
||||
self.eventnames = None
|
||||
self.metadata = None
|
||||
self.undolabel = None
|
||||
self.redolabel = None
|
||||
|
||||
def set_undo_label(self,label):
|
||||
self.undolabel = label
|
||||
self.undolabel.set_sensitive(0)
|
||||
|
||||
def set_redo_label(self,label):
|
||||
self.redolabel = label
|
||||
self.redolabel.set_sensitive(0)
|
||||
|
||||
def load(self,name,callback):
|
||||
if self.person_map:
|
||||
self.close()
|
||||
|
@ -56,7 +56,7 @@
|
||||
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1987">
|
||||
<widget class="GtkImage" id="image2005">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-new</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -78,7 +78,7 @@
|
||||
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1988">
|
||||
<widget class="GtkImage" id="image2006">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -112,7 +112,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1989">
|
||||
<widget class="GtkImage" id="image2007">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-convert</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -140,7 +140,7 @@
|
||||
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1990">
|
||||
<widget class="GtkImage" id="image2008">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-quit</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -175,7 +175,7 @@
|
||||
<accelerator key="z" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1991">
|
||||
<widget class="GtkImage" id="image2009">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-undo</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -189,7 +189,7 @@
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="redo1">
|
||||
<widget class="GtkImageMenuItem" id="redolabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock_item">GNOMEUIINFO_MENU_REDO_ITEM</property>
|
||||
<signal name="activate" handler="on_redo1_activate" last_modification_time="Sun, 25 Apr 2004 05:57:09 GMT"/>
|
||||
@ -212,7 +212,7 @@
|
||||
<accelerator key="Insert" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1992">
|
||||
<widget class="GtkImage" id="image2010">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -235,7 +235,7 @@
|
||||
<accelerator key="Delete" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1993">
|
||||
<widget class="GtkImage" id="image2011">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -273,7 +273,7 @@
|
||||
<accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1994">
|
||||
<widget class="GtkImage" id="image2012">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -295,7 +295,7 @@
|
||||
<accelerator key="M" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1995">
|
||||
<widget class="GtkImage" id="image2013">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-convert</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -322,7 +322,7 @@
|
||||
<signal name="activate" handler="on_preferences1_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1996">
|
||||
<widget class="GtkImage" id="image2014">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -343,7 +343,7 @@
|
||||
<signal name="activate" handler="on_column_order_activate" last_modification_time="Wed, 10 Mar 2004 04:36:07 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1997">
|
||||
<widget class="GtkImage" id="image2015">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -364,7 +364,7 @@
|
||||
<signal name="activate" handler="on_default_person_activate" last_modification_time="Sat, 16 Aug 2003 01:58:26 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1998">
|
||||
<widget class="GtkImage" id="image2016">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-home</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -450,7 +450,7 @@
|
||||
<accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1999">
|
||||
<widget class="GtkImage" id="image2017">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-index</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -472,7 +472,7 @@
|
||||
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2000">
|
||||
<widget class="GtkImage" id="image2018">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gnome-stock-book-open</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -545,7 +545,7 @@
|
||||
<accelerator key="F1" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2001">
|
||||
<widget class="GtkImage" id="image2019">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-help</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -566,7 +566,7 @@
|
||||
<signal name="activate" handler="on_faq_activate" last_modification_time="Wed, 26 Nov 2003 17:59:23 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2002">
|
||||
<widget class="GtkImage" id="image2020">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gnome-stock-book-open</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -593,7 +593,7 @@
|
||||
<signal name="activate" handler="on_gramps_home_page_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2003">
|
||||
<widget class="GtkImage" id="image2021">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -614,7 +614,7 @@
|
||||
<signal name="activate" handler="on_gramps_mailing_lists_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2004">
|
||||
<widget class="GtkImage" id="image2022">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gnome-stock-mail</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -668,7 +668,7 @@
|
||||
<signal name="activate" handler="on_about_activate" last_modification_time="Tue, 01 Apr 2003 03:44:24 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2005">
|
||||
<widget class="GtkImage" id="image2023">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gnome-stock-about</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -214,8 +214,10 @@ class Gramps:
|
||||
self.spouse_combo= self.gtop.get_widget("spouse_combo")
|
||||
self.spouse_tab = self.gtop.get_widget("spouse_tab")
|
||||
self.undolabel = self.gtop.get_widget('undolabel')
|
||||
self.redolabel = self.gtop.get_widget('redolabel')
|
||||
|
||||
self.db.set_undo_label(self.undolabel)
|
||||
self.db.set_redo_label(self.redolabel)
|
||||
self.use_sidebar = GrampsCfg.get_view()
|
||||
self.sidebar_btn.set_active(self.use_sidebar)
|
||||
|
||||
|
@ -333,7 +333,10 @@ class GedcomParser:
|
||||
def get_next(self):
|
||||
if self.backoff == 0:
|
||||
next_line = self.f.readline()
|
||||
self.text = string.translate(next_line.strip(),self.trans,self.delc)
|
||||
try:
|
||||
self.text = string.translate(next_line.strip(),self.trans,self.delc)
|
||||
except:
|
||||
self.text = next_line.strip()
|
||||
|
||||
try:
|
||||
self.text = self.cnv(self.text)
|
||||
@ -379,6 +382,8 @@ class GedcomParser:
|
||||
self.backoff = 1
|
||||
|
||||
def parse_gedcom_file(self):
|
||||
|
||||
self.trans = self.db.start_transaction()
|
||||
t = time.time()
|
||||
self.index = 0
|
||||
self.fam_count = 0
|
||||
@ -398,6 +403,9 @@ class GedcomParser:
|
||||
self.break_note_links()
|
||||
t = time.time() - t
|
||||
msg = _('Import Complete: %d seconds') % t
|
||||
|
||||
self.db.add_transaction(self.trans,_("GEDCOM import"))
|
||||
|
||||
if self.window:
|
||||
self.infomsg("\n%s" % msg)
|
||||
else:
|
||||
@ -431,7 +439,7 @@ class GedcomParser:
|
||||
self.ignore_sub_junk(1)
|
||||
|
||||
def parse_source(self,name,level):
|
||||
self.source = self.db.find_source(name,self.smap)
|
||||
self.source = self.db.find_source(name,self.smap, self.trans)
|
||||
|
||||
note = ""
|
||||
while 1:
|
||||
@ -441,7 +449,7 @@ class GedcomParser:
|
||||
self.source.set_note(note)
|
||||
if not self.source.get_title():
|
||||
self.source.set_title("No title - ID %s" % self.source.get_id())
|
||||
self.db.commit_source(self.source)
|
||||
self.db.commit_source(self.source, self.trans)
|
||||
self.backup()
|
||||
return
|
||||
elif matches[1] == "TITL":
|
||||
@ -484,21 +492,21 @@ class GedcomParser:
|
||||
if self.fam_count % UPDATE == 0 and self.window:
|
||||
self.update(self.families_obj,str(self.fam_count))
|
||||
self.fam_count = self.fam_count + 1
|
||||
self.family = self.db.find_family_with_map(matches[1],self.fmap)
|
||||
self.family = self.db.find_family_with_map(matches[1],self.fmap, self.trans)
|
||||
self.parse_family()
|
||||
if self.addr != None:
|
||||
father = self.family.get_father_id()
|
||||
if father:
|
||||
father.add_address(self.addr)
|
||||
self.db.commit_person(father)
|
||||
self.db.commit_person(father, self.trans)
|
||||
mother = self.family.get_mother_id()
|
||||
if mother:
|
||||
mother.add_address(self.addr)
|
||||
self.db.commit_person(mother)
|
||||
self.db.commit_person(mother, self.trans)
|
||||
for child in self.family.get_child_id_list():
|
||||
child.add_address(self.addr)
|
||||
self.db.commit_person(child)
|
||||
self.db.commit_family(self.family)
|
||||
self.db.commit_person(child, self.trans)
|
||||
self.db.commit_family(self.family, self.trans)
|
||||
del self.family
|
||||
elif matches[2] == "INDI":
|
||||
if self.indi_count % UPDATE == 0 and self.window:
|
||||
@ -509,7 +517,7 @@ class GedcomParser:
|
||||
self.person = self.find_or_create_person(id)
|
||||
self.added[self.person.get_id()] = 1
|
||||
self.parse_individual()
|
||||
self.db.commit_person(self.person)
|
||||
self.db.commit_person(self.person, self.trans)
|
||||
del self.person
|
||||
elif matches[2] in ["SUBM","SUBN","REPO"]:
|
||||
self.ignore_sub_junk(1)
|
||||
@ -535,13 +543,13 @@ class GedcomParser:
|
||||
|
||||
def find_or_create_person(self,id):
|
||||
if self.pmap.has_key(id):
|
||||
person = self.db.find_person_from_id(self.pmap[id])
|
||||
person = self.db.find_person_from_id(self.pmap[id],self.trans)
|
||||
elif self.db.has_person_id(id):
|
||||
person = RelLib.Person()
|
||||
self.pmap[id] = self.db.add_person(person)
|
||||
self.pmap[id] = self.db.add_person(person,self.trans)
|
||||
else:
|
||||
person = RelLib.Person(id)
|
||||
self.db.add_person_as(person)
|
||||
self.db.add_person_as(person,self.trans)
|
||||
self.pmap[id] = id
|
||||
return person
|
||||
|
||||
@ -642,7 +650,7 @@ class GedcomParser:
|
||||
if child.get_main_parents_family_id() == self.family:
|
||||
child.set_main_parent_family_id(None)
|
||||
child.add_parent_family_id(self.family.get_id(),mrel,frel)
|
||||
self.db.commit_person(child)
|
||||
self.db.commit_person(child, self.trans)
|
||||
elif matches[1] == "NCHI":
|
||||
a = RelLib.Attribute()
|
||||
a.set_type("Number of Children")
|
||||
@ -669,10 +677,10 @@ class GedcomParser:
|
||||
event.set_name(matches[1])
|
||||
if event.get_name() == "Marriage":
|
||||
self.family.set_relationship("Married")
|
||||
self.db.add_event(event)
|
||||
self.db.add_event(event,self.trans)
|
||||
self.family.add_event_id(event.get_id())
|
||||
self.parse_family_event(event,2)
|
||||
self.db.commit_event(event)
|
||||
self.db.commit_event(event, self.trans)
|
||||
del event
|
||||
|
||||
def parse_note_base(self,matches,obj,level,old_note,task):
|
||||
@ -771,16 +779,16 @@ class GedcomParser:
|
||||
self.person.set_lds_sealing(ord)
|
||||
self.parse_ord(ord,2)
|
||||
elif matches[1] == "FAMS":
|
||||
family = self.db.find_family_with_map(matches[2],self.fmap)
|
||||
family = self.db.find_family_with_map(matches[2],self.fmap, self.trans)
|
||||
self.person.add_family_id(family.get_id())
|
||||
if note == "":
|
||||
note = self.parse_optional_note(2)
|
||||
else:
|
||||
note = "%s\n\n%s" % (note,self.parse_optional_note(2))
|
||||
self.db.commit_family(family)
|
||||
self.db.commit_family(family, self.trans)
|
||||
elif matches[1] == "FAMC":
|
||||
type,note = self.parse_famc_type(2)
|
||||
family = self.db.find_family_with_map(matches[2],self.fmap)
|
||||
family = self.db.find_family_with_map(matches[2],self.fmap, self.trans)
|
||||
|
||||
for f in self.person.get_parent_family_id_list():
|
||||
if f[0] == family.get_id():
|
||||
@ -795,7 +803,7 @@ class GedcomParser:
|
||||
if self.person.get_main_parents_family_id() == family.get_id():
|
||||
self.person.set_main_parent_family_id(None)
|
||||
self.person.add_parent_family_id(family.get_id(),type,type)
|
||||
self.db.commit_family(family)
|
||||
self.db.commit_family(family, self.trans)
|
||||
elif matches[1] == "RESI":
|
||||
addr = RelLib.Address()
|
||||
self.person.add_address(addr)
|
||||
@ -812,7 +820,7 @@ class GedcomParser:
|
||||
self.person.add_address(addr)
|
||||
elif matches[1] == "BIRT":
|
||||
event = RelLib.Event()
|
||||
self.db.add_event(event)
|
||||
self.db.add_event(event, self.trans)
|
||||
if self.person.get_birth_id():
|
||||
event.set_name("Alternate Birth")
|
||||
self.person.add_event_id(event.get_id())
|
||||
@ -820,16 +828,16 @@ class GedcomParser:
|
||||
event.set_name("Birth")
|
||||
self.person.set_birth_id(event.get_id())
|
||||
self.parse_person_event(event,2)
|
||||
self.db.commit_event(event)
|
||||
self.db.commit_event(event, self.trans)
|
||||
elif matches[1] == "ADOP":
|
||||
event = RelLib.Event()
|
||||
event.set_name("Adopted")
|
||||
self.person.add_event_id(event.get_id())
|
||||
self.parse_adopt_event(event,2)
|
||||
self.db.add_event(event)
|
||||
self.db.add_event(event, self.trans)
|
||||
elif matches[1] == "DEAT":
|
||||
event = RelLib.Event()
|
||||
self.db.add_event(event)
|
||||
self.db.add_event(event, self.trans)
|
||||
if self.person.get_death_id():
|
||||
event.set_name("Alternate Death")
|
||||
self.person.add_event_id(event.get_id())
|
||||
@ -837,7 +845,7 @@ class GedcomParser:
|
||||
event.set_name("Death")
|
||||
self.person.set_death_id(event.get_id())
|
||||
self.parse_person_event(event,2)
|
||||
self.db.commit_event(event)
|
||||
self.db.commit_event(event, self.trans)
|
||||
elif matches[1] == "EVEN":
|
||||
event = RelLib.Event()
|
||||
if matches[2]:
|
||||
@ -850,7 +858,7 @@ class GedcomParser:
|
||||
attr.set_value(event.get_description())
|
||||
self.person.add_attribute(attr)
|
||||
else:
|
||||
self.db.add_event(event)
|
||||
self.db.add_event(event, self.trans)
|
||||
self.person.add_event_id(event.get_id())
|
||||
elif matches[1] == "SOUR":
|
||||
source_ref = self.handle_source(matches,2)
|
||||
@ -887,7 +895,7 @@ class GedcomParser:
|
||||
self.parse_person_event(event,2)
|
||||
if matches[2]:
|
||||
event.set_description(matches[2])
|
||||
self.db.add_event(event)
|
||||
self.db.add_event(event, self.trans)
|
||||
self.person.add_event_id(event.get_id())
|
||||
|
||||
def parse_optional_note(self,level):
|
||||
@ -972,11 +980,11 @@ class GedcomParser:
|
||||
photo.set_path(path)
|
||||
photo.set_description(title)
|
||||
photo.set_mime_type(Utils.get_mime_type(path))
|
||||
self.db.add_object(photo)
|
||||
self.db.add_object(photo, self.trans)
|
||||
oref = RelLib.MediaRef()
|
||||
oref.set_reference_id(photo.get_id())
|
||||
self.person.add_media_reference(oref)
|
||||
self.db.commit_person(self.person)
|
||||
self.db.commit_person(self.person, self.trans)
|
||||
|
||||
def parse_family_object(self,level):
|
||||
form = ""
|
||||
@ -1011,11 +1019,11 @@ class GedcomParser:
|
||||
photo.set_path(path)
|
||||
photo.set_description(title)
|
||||
photo.set_mime_type(Utils.get_mime_type(path))
|
||||
self.db.add_object(photo)
|
||||
self.db.add_object(photo, self.trans)
|
||||
oref = RelLib.MediaRef()
|
||||
oref.set_reference_id(photo.get_id())
|
||||
self.family.add_media_reference(photo)
|
||||
self.db.commit_family(self.family)
|
||||
self.db.commit_family(self.family, self.trans)
|
||||
|
||||
def parse_residence(self,address,level):
|
||||
note = ""
|
||||
@ -1090,7 +1098,7 @@ class GedcomParser:
|
||||
elif matches[1] == "DATE":
|
||||
ord.set_date_object(self.extract_date(matches[2]))
|
||||
elif matches[1] == "FAMC":
|
||||
ord.set_family_id(self.db.find_family_with_map(matches[2],self.fmap))
|
||||
ord.set_family_id(self.db.find_family_with_map(matches[2],self.fmap,self.trans))
|
||||
elif matches[1] == "PLAC":
|
||||
try:
|
||||
val = matches[2]
|
||||
@ -1099,7 +1107,7 @@ class GedcomParser:
|
||||
else:
|
||||
place = RelLib.Place()
|
||||
place.set_title(matches[2])
|
||||
self.db.add_place(place)
|
||||
self.db.add_place(place, self.trans)
|
||||
place_id = place.get_id()
|
||||
self.placemap[val] = place_id
|
||||
ord.set_place_id(place_id)
|
||||
@ -1152,7 +1160,7 @@ class GedcomParser:
|
||||
else:
|
||||
place = RelLib.Place()
|
||||
place.set_title(matches[2])
|
||||
self.db.add_place(place)
|
||||
self.db.add_place(place, self.trans)
|
||||
place_id = place.get_id()
|
||||
self.placemap[val] = place_id
|
||||
event.set_place_id(place_id)
|
||||
@ -1196,7 +1204,7 @@ class GedcomParser:
|
||||
elif matches[1] == "SOUR":
|
||||
event.add_source_reference(self.handle_source(matches,level+1))
|
||||
elif matches[1] == "FAMC":
|
||||
family = self.db.find_family_with_map(matches[2],self.fmap)
|
||||
family = self.db.find_family_with_map(matches[2],self.fmap,self.trans)
|
||||
mrel,frel = self.parse_adopt_famc(level+1);
|
||||
if self.person.get_main_parents_family_id() == family.get_id():
|
||||
self.person.set_main_parent_family_id(None)
|
||||
@ -1208,7 +1216,7 @@ class GedcomParser:
|
||||
else:
|
||||
place = RelLib.Place()
|
||||
place.set_title(matches[2])
|
||||
self.db.add_place(place)
|
||||
self.db.add_place(place, self.trans)
|
||||
place_id = place.get_id()
|
||||
self.placemap[val] = place_id
|
||||
event.set_place_id(place_id)
|
||||
@ -1336,7 +1344,7 @@ class GedcomParser:
|
||||
else:
|
||||
place = RelLib.Place()
|
||||
place.set_title(matches[2])
|
||||
self.db.add_place(place)
|
||||
self.db.add_place(place, self.trans)
|
||||
place_id = place.get_id()
|
||||
self.placemap[val] = place_id
|
||||
event.set_place_id(place_id)
|
||||
@ -1697,13 +1705,13 @@ class GedcomParser:
|
||||
if matches[2] and matches[2][0] != "@":
|
||||
self.localref = self.localref + 1
|
||||
ref = "gsr%d" % self.localref
|
||||
s = self.db.find_source(ref,self.smap)
|
||||
s = self.db.find_source(ref,self.smap, self.trans)
|
||||
source_ref.set_base_id(s.get_id())
|
||||
s.set_title('Imported Source #%d' % self.localref)
|
||||
s.set_note(matches[2] + self.parse_continue_data(level))
|
||||
self.ignore_sub_junk(level+1)
|
||||
else:
|
||||
source_ref.set_base_id(self.db.find_source(matches[2],self.smap).get_id())
|
||||
source_ref.set_base_id(self.db.find_source(matches[2],self.smap,self.trans).get_id())
|
||||
self.parse_source_reference(source_ref,level)
|
||||
return source_ref
|
||||
|
||||
@ -1718,20 +1726,20 @@ class GedcomParser:
|
||||
new_key = prefix % val
|
||||
new_pmax = max(new_pmax,val)
|
||||
|
||||
person = self.db.find_person_from_id(pid)
|
||||
person = self.db.find_person_from_id(pid,self.trans)
|
||||
|
||||
# new ID is not used
|
||||
if not self.db.has_person_id(new_key):
|
||||
self.db.remove_person_id(pid)
|
||||
person.set_id(new_key)
|
||||
self.db.add_person(person)
|
||||
self.db.add_person(person,self.trans)
|
||||
else:
|
||||
tp = self.db.find_person_from_id(new_key)
|
||||
tp = self.db.find_person_from_id(new_key,self.trans)
|
||||
# same person, just change it
|
||||
if person == tp:
|
||||
self.db.remove_person_id(pid)
|
||||
person.set_id(new_key)
|
||||
self.db.add_person_as(person)
|
||||
self.db.add_person_as(person,self.trans)
|
||||
# give up trying to use the refn as a key
|
||||
else:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user