* src/ReadGedcom.py (parse_record): Get objects from handles;

(handle_source): Refer to handle, not the object;
(parse_source): Use gramps id (not handle) to form the title.
* src/GrampsDbBase.py (get_person_from_handle): Typo;
(find_event_from_handle): Correctly create new event if not found.
* src/Sources.py (draw): Correctly sort, use gramps id when
displaying sources; (redraw): Use gramps id in the list view.


svn: r3461
This commit is contained in:
Alex Roitman 2004-08-21 18:13:18 +00:00
parent 831a3adb99
commit e6a9800d80
4 changed files with 38 additions and 21 deletions

View File

@ -1,3 +1,12 @@
2004-08-21 Alex Roitman <shura@alex.neuro.umn.edu>
* src/ReadGedcom.py (parse_record): Get objects from handles;
(handle_source): Refer to handle, not the object;
(parse_source): Use gramps id (not handle) to form the title.
* src/GrampsDbBase.py (get_person_from_handle): Typo;
(find_event_from_handle): Correctly create new event if not found.
* src/Sources.py (draw): Correctly sort, use gramps id when
displaying sources; (redraw): Use gramps id in the list view.
2004-08-20 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps_main.py: update family display after EditPerson
* src/EditPerson.py: fix callback

View File

@ -261,7 +261,7 @@ class GrampsDbBase:
def get_person_from_handle(self,val):
"""finds a Person in the database from the passed gramps' ID.
If no such Person exists, a new Person is added to the database."""
If no such Person exists, None is returned."""
data = self.person_map.get(str(val))
if data:
@ -302,8 +302,8 @@ class GrampsDbBase:
return None
def get_event_from_handle(self,handle):
"""finds a Place in the database from the passed gramps' ID.
If no such Place exists, None is returned."""
"""finds a Event in the database from the passed gramps' ID.
If no such Event exists, None is returned."""
data = self.event_map.get(str(handle))
if data:
@ -313,8 +313,8 @@ class GrampsDbBase:
return None
def get_family_from_handle(self,handle):
"""finds a Place in the database from the passed gramps' ID.
If no such Place exists, None is returned."""
"""finds a Family in the database from the passed gramps' ID.
If no such Family exists, None is returned."""
data = self.family_map.get(str(handle))
if data:
@ -358,16 +358,20 @@ class GrampsDbBase:
def find_event_from_handle(self,val):
"""
Finds a Family in the database from the passed GRAMPS ID.
If no such Family exists, a new Family is added to the database.
Finds a Event in the database from the passed GRAMPS ID.
If no such Event exists, a new Event is added to the database.
"""
event = Event()
data = self.event_map.get(str(val))
if data:
event = Event()
event.unserialize(data)
return event
else:
return None
event.set_handle(val)
if transaction:
transaction.add(EVENT_KEY,val,None)
self.event_map[str(val)] = event.serialize()
self.emap_index = self.emap_index + 1
return event
def find_object_from_handle(self,handle,transaction):
"""

View File

@ -454,7 +454,7 @@ class GedcomParser:
if note:
self.source.set_note(note)
if not self.source.get_title():
self.source.set_title("No title - ID %s" % self.source.get_handle())
self.source.set_title("No title - ID %s" % self.source.get_gramps_id())
self.db.commit_source(self.source, self.trans)
self.backup()
return
@ -501,17 +501,21 @@ class GedcomParser:
self.family = self.find_or_create_family(matches[1])
self.parse_family()
if self.addr != None:
father = self.family.get_father_handle()
father_handle = self.family.get_father_handle()
father = self.db.get_person_from_handle(father_handle)
if father:
father.add_address(self.addr)
self.db.commit_person(father, self.trans)
mother = self.family.get_mother_handle()
mother_handle = self.family.get_mother_handle()
mother = self.db.get_person_from_handle(mother_handle)
if mother:
mother.add_address(self.addr)
self.db.commit_person(mother, self.trans)
for child in self.family.get_child_handle_list():
child.add_address(self.addr)
self.db.commit_person(child, self.trans)
for child_handle in self.family.get_child_handle_list():
child = self.db.get_person_from_handle(child_handle)
if child:
child.add_address(self.addr)
self.db.commit_person(child, self.trans)
self.db.commit_family(self.family, self.trans)
del self.family
elif matches[2] == "INDI":
@ -1751,7 +1755,7 @@ class GedcomParser:
s.set_note(matches[2] + self.parse_continue_data(level))
self.ignore_sub_junk(level+1)
else:
source_ref.set_base_handle(self.find_or_create_source(matches[2][1:-1]))
source_ref.set_base_handle(self.find_or_create_source(matches[2][1:-1]).get_handle())
self.parse_source_reference(source_ref,level)
return source_ref

View File

@ -243,9 +243,9 @@ class SourceTab:
self.model.clear()
for s in self.list:
base_handle = s.get_base_handle()
iter = self.model.append()
base = self.db.get_source_from_handle(base_handle)
self.model.set(iter,0,base_handle,1,base.get_title())
iter = self.model.append()
self.model.set(iter,0,base.get_gramps_id(),1,base.get_title())
if self.list:
Utils.bold_label(self.parent.sources_label)
else:
@ -426,14 +426,14 @@ class SourceEditor:
self.pub_field.set_text("")
keys = self.db.get_source_handles()
keys.sort(self.db.sortbysource)
keys.sort(self.db._sortbysource)
sel_child = None
self.list = []
self.active_source = sel
for src_id in keys:
src = self.db.get_source_from_handle(src_id)
l = gtk.Label("%s [%s]" % (src.get_title(),src.get_handle()))
l = gtk.Label("%s [%s]" % (src.get_title(),src.get_gramps_id()))
l.show()
l.set_alignment(0,0.5)
c = gtk.ListItem()