* various: change try_to_find_*_from_handle to

get_*_from_handle


svn: r3355
This commit is contained in:
Don Allingham 2004-08-07 05:16:57 +00:00
parent cddd8ed8af
commit 082907d675
81 changed files with 660 additions and 623 deletions

View File

@ -1,3 +1,7 @@
2004-08-06 Don Allingham <dallingham@users.sourceforge.net>
* various: change try_to_find_*_from_handle to
get_*_from_handle
2004-08-05 Don Allingham <dallingham@users.sourceforge.net>
* src/AutoComp.py: switch over entirely to ComboBox for
autocompletion

View File

@ -219,7 +219,7 @@ class AddSpouse:
else:
self.db.add_person_no_map(person,id,trans)
person = self.db.try_to_find_person_from_handle(id)
person = self.db.get_person_from_handle(id)
n = person.get_primary_name().get_name()
self.db.add_transaction(trans,_('Add Person (%s)' % n))
self.addperson(person)
@ -246,13 +246,14 @@ class AddSpouse:
if not idlist or not idlist[0]:
return
spouse = self.db.get_person(idlist[0])
spouse = self.db.get_person_from_handle(idlist[0])
spouse_id = spouse.get_handle()
# don't do anything if the marriage already exists
for f in self.person.get_family_handle_list():
fam = self.db.find_family_from_handle(f)
if spouse_id == fam.get_mother_handle() or spouse_id == fam.get_father_handle():
if spouse_id == fam.get_mother_handle() or \
spouse_id == fam.get_father_handle():
Utils.destroy_passed_object(obj)
return

View File

@ -36,6 +36,7 @@ Module responsible for handling the command line arguments for GRAMPS.
import os
import os.path
import getopt
from gettext import gettext as _
#-------------------------------------------------------------------------
#
@ -414,7 +415,7 @@ class ArgHandler:
# Write media files first, since the database may be modified
# during the process (i.e. when removing object)
for m_id in self.parent.db.get_object_keys():
mobject = self.parent.db.try_to_find_object_from_handle(m_id)
mobject = self.parent.db.get_object_from_handle(m_id)
oldfile = mobject.get_path()
base = os.path.basename(oldfile)
if os.path.isfile(oldfile):

View File

@ -80,7 +80,7 @@ class ChooseParents:
self.parent = parent
self.db = db
self.child_windows = {}
self.person = self.db.try_to_find_person_from_handle(person.get_handle())
self.person = self.db.get_person_from_handle(person.get_handle())
if family:
self.family = self.db.find_family_from_handle(family.get_handle())
else:
@ -317,7 +317,7 @@ class ChooseParents:
self.build_exclude_list()
for pid in self.db.get_person_keys():
person = self.db.try_to_find_person_from_handle(pid)
person = self.db.get_person_from_handle(pid)
visible = self.father_filter(person)
if visible:
self.father_nsort.set_visible(pid,visible)
@ -340,7 +340,7 @@ class ChooseParents:
self.build_exclude_list()
for pid in self.db.get_person_keys():
person = self.db.try_to_find_person_from_handle(pid)
person = self.db.get_person_from_handle(pid)
visible = self.mother_filter(person)
if visible:
self.mother_nsort.set_visible(pid,visible)
@ -402,11 +402,11 @@ class ChooseParents:
family.add_child_handle(self.person.get_handle())
if father_handle:
self.father = self.db.try_to_find_person_from_handle(father_handle)
self.father = self.db.get_person_from_handle(father_handle)
self.father.add_family_handle(family.get_handle())
self.db.commit_person(self.father,trans)
if mother_handle:
self.mother = self.db.try_to_find_person_from_handle(mother_handle)
self.mother = self.db.get_person_from_handle(mother_handle)
self.mother.add_family_handle(family.get_handle())
self.db.commit_person(self.mother,trans)
@ -419,7 +419,7 @@ class ChooseParents:
idlist = self.get_selected_mother_handles()
if idlist and idlist[0]:
self.mother = self.db.get_person(idlist[0])
self.mother = self.db.get_person_from_handle(idlist[0])
else:
self.mother = None
@ -458,7 +458,7 @@ class ChooseParents:
idlist = self.get_selected_father_handles()
if idlist and idlist[0]:
self.father = self.db.get_person(idlist[0])
self.father = self.db.get_person_from_handle(idlist[0])
else:
self.father = None
@ -468,7 +468,7 @@ class ChooseParents:
if len(family_handle_list) >= 1:
family = self.db.find_family_from_handle(family_handle_list[0])
mother_handle = family.get_mother_handle()
mother = self.db.try_to_find_person_from_handle(mother_handle)
mother = self.db.get_person_from_handle(mother_handle)
sname = mother.get_primary_name().get_surname()
tpath = self.mother_nsort.on_get_path(sname)
self.mother_list.expand_row(tpath,0)
@ -482,7 +482,7 @@ class ChooseParents:
idlist = self.get_selected_mother_handles()
if idlist and idlist[0]:
self.mother = self.db.get_person(idlist[0])
self.mother = self.db.get_person_from_handle(idlist[0])
else:
self.mother = None
@ -492,7 +492,7 @@ class ChooseParents:
if len(family_handle_list) >= 1:
family = self.db.find_family_from_handle(family_handle_list[0])
father_handle = family.get_mother_handle()
father = self.db.try_to_find_person_from_handle(father_handle)
father = self.db.get_person_from_handle(father_handle)
sname = father.get_primary_name().get_surname()
tpath = self.father_nsort.on_get_path(sname)
self.father_list.expand_row(tpath,0)
@ -656,8 +656,8 @@ class ModifyParents:
self.family_update = family_update
self.full_update = full_update
self.father = self.db.try_to_find_person_from_handle(self.family.get_father_handle())
self.mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle())
self.father = self.db.get_person_from_handle(self.family.get_father_handle())
self.mother = self.db.get_person_from_handle(self.family.get_mother_handle())
self.glade = gtk.glade.XML(const.gladeFile,"modparents","gramps")
self.top = self.glade.get_widget("modparents")

View File

@ -136,7 +136,19 @@ class ExistingDbPrompter:
# Always add native format filter
filter = gtk.FileFilter()
filter.set_name(_('GRAMPS databases'))
filter.add_mime_type('application/x-gramps')
filter.add_mime_type(const.app_gramps)
choose.add_filter(filter)
# Always add native format filter
filter = gtk.FileFilter()
filter.set_name(_('GRAMPS XML databases'))
filter.add_mime_type(const.app_gramps_xml)
choose.add_filter(filter)
# Always add native format filter
filter = gtk.FileFilter()
filter.set_name(_('GEDCOM'))
filter.add_mime_type(const.app_gedcom)
choose.add_filter(filter)
# Add more data type selections if opening existing db
@ -147,19 +159,18 @@ class ExistingDbPrompter:
if response == gtk.RESPONSE_OK:
filename = choose.get_filename()
filetype = gnome.vfs.get_mime_type(filename)
print filetype
if filetype == 'application/x-gramps':
if filetype == const.app_gramps:
choose.destroy()
self.parent.db = GrampsBSDDB.GrampsBSDDB()
self.parent.read_file(filename)
return 1
if filetype == 'application/x-gramps-xml' or filetype == 'text/xml' or filetype == 'application/x-gzip':
if filetype == const.app_gramps_xml:
choose.destroy()
self.parent.db = GrampsXMLDB.GrampsXMLDB()
self.parent.read_file(filename)
return 1
if filetype == 'application/x-gedcom':
if filetype == const.app_gedcom:
choose.destroy()
self.parent.db = GrampsGEDDB.GrampsGEDDB()
self.parent.read_file(filename)

View File

@ -112,8 +112,9 @@ class EditPerson:
self.window.set_title("%s - GRAMPS" % _('Edit Person'))
self.icon_list = self.top.get_widget("iconlist")
self.gallery = ImageSelect.Gallery(person, self.db.commit_person, self.path,
self.icon_list, self.db, self,self.window)
self.gallery = ImageSelect.Gallery(person, self.db.commit_person,
self.path, self.icon_list,
self.db, self, self.window)
self.complete = self.get_widget('complete')
self.name_delete_btn = self.top.get_widget('aka_delete')
@ -499,7 +500,7 @@ class EditPerson:
build_dropdown(place,self.place_list)
if ord and ord.get_place_handle():
ord_place = self.db.try_to_find_place_from_handle(ord.get_place_handle())
ord_place = self.db.get_place_from_handle(ord.get_place_handle())
place.set_text(ord_place.get_title())
return stat
@ -559,8 +560,8 @@ class EditPerson:
continue
f_id = fam.get_father_handle()
m_id = fam.get_mother_handle()
f = self.db.try_to_find_person_from_handle(f_id)
m = self.db.try_to_find_person_from_handle(m_id)
f = self.db.get_person_from_handle(f_id)
m = self.db.get_person_from_handle(m_id)
if f and m:
name = _("%(father)s and %(mother)s") % {
'father' : GrampsCfg.get_nameof()(f),
@ -650,7 +651,7 @@ class EditPerson:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.try_to_find_source_from_handle(base_handle)
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase)
place = foo.get_place_handle()
if place:
@ -728,7 +729,7 @@ class EditPerson:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.try_to_find_source_from_handle(base_handle)
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase)
self.alist.append(foo)
self.lists_changed = 1
@ -761,7 +762,7 @@ class EditPerson:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.try_to_find_source_from_handle(base_handle)
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase)
self.plist.insert(row,foo)
@ -1253,7 +1254,7 @@ class EditPerson:
if len(event.get_source_references()) > 0:
psrc_ref = event.get_source_references()[0]
psrc_id = psrc_ref.get_base_handle()
psrc = self.db.try_to_find_source_from_handle(psrc_id)
psrc = self.db.get_source_from_handle(psrc_id)
self.event_src_field.set_text(short(psrc.get_title()))
self.event_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()])
else:
@ -1286,7 +1287,7 @@ class EditPerson:
if len(addr.get_source_references()) > 0:
psrc_ref = addr.get_source_references()[0]
psrc_id = psrc_ref.get_base_handle()
psrc = self.db.try_to_find_source_from_handle(psrc_id)
psrc = self.db.get_source_from_handle(psrc_id)
self.addr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()])
self.addr_src_field.set_text(short(psrc.get_title()))
else:
@ -1320,7 +1321,7 @@ class EditPerson:
if len(name.get_source_references()) > 0:
psrc_ref = name.get_source_references()[0]
psrc_id = psrc_ref.get_base_handle()
psrc = self.db.try_to_find_source_from_handle(psrc_id)
psrc = self.db.get_source_from_handle(psrc_id)
self.name_src_field.set_text(short(psrc.get_title()))
self.name_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()])
else:
@ -1367,7 +1368,7 @@ class EditPerson:
if len(attr.get_source_references()) > 0:
psrc_ref = attr.get_source_references()[0]
psrc_id = psrc_ref.get_base_handle()
psrc = self.db.try_to_find_source_from_handle(psrc_id)
psrc = self.db.get_source_from_handle(psrc_id)
self.attr_src_field.set_text(short(psrc.get_title()))
self.attr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()])
else:
@ -1450,7 +1451,7 @@ class EditPerson:
self.birth.set_place_handle(self.get_place(self.bplace,1))
if idval != self.person.get_gramps_id():
person = self.db.try_to_find_person_from_gramps_id(idval)
person = self.db.get_person_from_gramps_id(idval)
if not person:
self.person.set_gramps_id(idval)
else:
@ -1624,9 +1625,9 @@ class EditPerson:
self.add_places.append(place)
return place.get_handle()
else:
return ''
return None
else:
return ''
return None
def on_primary_name_source_clicked(self,obj):
Sources.SourceSelector(self.pname.get_source_references(),self,
@ -1681,7 +1682,7 @@ class EditPerson:
if media_list:
ph = media_list[0]
object_handle = ph.get_reference_handle()
object = self.db.try_to_find_object_from_handle(object_handle)
object = self.db.get_object_from_handle(object_handle)
if self.load_obj != object.get_path():
if object.get_mime_type()[0:5] == "image":
self.load_photo(object.get_path())
@ -1708,8 +1709,9 @@ class EditPerson:
elif page == 9 and self.lds_not_loaded:
self.lds_not_loaded = 0
self.draw_lds()
text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
self.notes_buffer.get_end_iter(),gtk.FALSE))
buffer = self.notes_buffer
text = unicode(buffer.get_text(buffer.get_start_iter(),
buffer.get_end_iter(),gtk.FALSE))
if text:
Utils.bold_label(self.notes_label)
else:
@ -1757,7 +1759,7 @@ class EditPerson:
prev_date = "00000000"
for i in range(len(list)):
child_handle = list[i]
child = self.db.try_to_find_person_from_handle(child_handle)
child = self.db.get_person_from_handle(child_handle)
if child.get_birth_handle():
event = self.db.find_event_from_handle(child.get_birth_handle())
bday = event.get_date_object()
@ -1791,7 +1793,7 @@ class EditPerson:
index = list.index(person.get_handle())
target = index
for i in range(index-1, -1, -1):
other = self.db.try_to_find_person_from_handle(list[i])
other = self.db.get_person_from_handle(list[i])
event_handle = other.get_birth_handle()
if event_handle:
event = self.db.find_event_from_handle(event_handle)
@ -1806,7 +1808,7 @@ class EditPerson:
# Now try moving to a later position in the list
if (target == index):
for i in range(index, len(list)):
other = self.db.try_to_find_person_from_handle(list[i])
other = self.db.get_person_from_handle(list[i])
event_handle = other.get_birth_handle()
if event_handle:
event = self.db.find_event_from_handle(event_handle)
@ -1834,7 +1836,7 @@ def short(val,size=60):
def place_title(db,event):
pid = event.get_place_handle()
if pid:
return db.try_to_find_place_from_handle(pid).get_title()
return db.get_place_from_handle(pid).get_title()
else:
return u''

View File

@ -480,7 +480,7 @@ class EditPlace:
fevent = []
msg = ""
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
for event_handle in [p.get_birth_handle(), p.get_death_handle()] + p.get_event_list():
event = self.db.find_event_from_handle(event_handle)
if event and event.get_place_handle() == self.place:
@ -562,7 +562,7 @@ class DeletePlaceQuery:
self.db.remove_place(self.place.get_handle(),trans)
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
for event_handle in [p.get_birth_handle(), p.get_death_handle()] + p.get_event_list():
event = self.db.find_event_from_handle(event_handle)
if event and event.get_place_handle() == self.place.get_handle():

View File

@ -143,7 +143,7 @@ class EditSource:
gnome.help_display('gramps-manual','gramps-edit-complete')
def close(self,obj):
self.gallery.close(self.gallery_ok)
self.gallery.close()
self.close_child_windows()
self.remove_itself_from_menu()
self.top.destroy()
@ -197,7 +197,7 @@ class EditSource:
if sref.get_base_handle() == self.source.get_handle():
p_list.append(name)
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
name = GrampsCfg.get_nameof()(p)
for event_handle in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]:
if event_handle:
@ -218,7 +218,7 @@ class EditSource:
if sref.get_base_handle() == self.source.get_handle():
p_addr_list.append((name,v.get_street()))
for object_handle in self.db.get_object_keys():
object = self.db.try_to_find_object_from_handle(object_handle)
object = self.db.get_object_from_handle(object_handle)
name = object.get_description()
for sref in object.get_source_references():
if sref.get_base_handle() == self.source.get_handle():
@ -228,9 +228,9 @@ class EditSource:
f_id = family.get_father_handle()
m_id = family.get_mother_handle()
if f_id:
f = self.db.try_to_find_person_from_handle(f_id)
f = self.db.get_person_from_handle(f_id)
if m_id:
m = self.db.try_to_find_person_from_handle(m_id)
m = self.db.get_person_from_handle(m_id)
if f_id and m_id:
name = _("%(father)s and %(mother)s") % {
"father" : GrampsCfg.get_nameof()(f),
@ -373,7 +373,7 @@ class DelSrcQuery:
for key in self.db.get_person_keys():
commit = 0
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
for v_id in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]:
v = self.db.find_event_from_handle(v_id)
if v:
@ -404,13 +404,13 @@ class DelSrcQuery:
self.db.commit_family(p,trans)
for p_id in self.db.get_object_keys():
p = self.db.try_to_find_object_from_handle(p_id,trans)
p = self.db.get_object_from_handle(p_id,trans)
if self.delete_source(p):
self.db.commit_media_object(p,trans)
for key in self.db.get_place_handle_keys():
p = self.db.try_to_find_place_from_handle(key)
if self.delete_source(self.db.try_to_find_place_from_handle(key)):
p = self.db.get_place_from_handle(key)
if self.delete_source(self.db.get_place_from_handle(key)):
self.db.commit_place(p,trans)
self.db.remove_source_handle(self.source.get_handle(),trans)

View File

@ -173,7 +173,7 @@ class EventEditor:
if not place_handle:
place_name = u""
else:
place_name = self.db.try_to_find_place_from_handle(place_handle).get_title()
place_name = self.db.get_place_from_handle(place_handle).get_title()
self.place_field.set_text(place_name)
self.date_field.set_text(self.date.get_date())

View File

@ -485,18 +485,18 @@ class FamilyView:
model, iter = self.child_selection.get_selected()
if not iter:
return
child = self.parent.db.get_person(self.child_model.get_value(iter,7))
child = self.parent.db.get_person_from_handle(self.child_model.get_value(iter,7))
try:
EditPerson.EditPerson(self.parent, child, self.parent.db, self.spouse_after_edit)
except:
DisplayTrace.DisplayTrace()
def child_rel(self,obj):
person = self.parent.db.get_person(obj.get_data(Utils.OBJECT))
person = self.parent.db.get_person_from_handle(obj.get_data(Utils.OBJECT))
SelectChild.EditRel(self.parent.db,person,self.family,self.load_family)
def child_rel_by_id(self,id):
person = self.parent.db.get_person(id)
person = self.parent.db.get_person_from_handle(id)
SelectChild.EditRel(self.parent.db,person,self.family,self.load_family)
def spouse_changed(self,obj):
@ -740,7 +740,7 @@ class FamilyView:
return
id = self.child_model.get_value(iter,7)
child = self.parent.db.get_person(id)
child = self.parent.db.get_person_from_handle(id)
trans = self.parent.db.start_transaction()
@ -838,7 +838,7 @@ class FamilyView:
person_handle = family.get_father_handle()
else:
person_handle = family.get_mother_handle()
person = self.parent.db.try_to_find_person_from_handle(person_handle)
person = self.parent.db.get_person_from_handle(person_handle)
self.parent.change_active_person(person)
n = person.get_primary_name().get_name()
@ -858,7 +858,7 @@ class FamilyView:
if self.parent.active_person:
id = self.parent.active_person.get_handle()
self.person = self.parent.db.try_to_find_person_from_handle(id)
self.person = self.parent.db.get_person_from_handle(id)
else:
self.person = None
self.clear()
@ -917,7 +917,7 @@ class FamilyView:
flist[f] = iter
if sp_id:
sp = self.parent.db.try_to_find_person_from_handle(sp_id)
sp = self.parent.db.get_person_from_handle(sp_id)
event = self.find_marriage(fm)
if event:
mdate = " - %s" % event.get_date()
@ -964,8 +964,8 @@ class FamilyView:
fam = self.parent.db.find_family_from_handle(f)
father_handle = fam.get_father_handle()
mother_handle = fam.get_mother_handle()
f = self.parent.db.try_to_find_person_from_handle(father_handle)
m = self.parent.db.try_to_find_person_from_handle(mother_handle)
f = self.parent.db.get_person_from_handle(father_handle)
m = self.parent.db.get_person_from_handle(mother_handle)
father = self.nameof(_("Father"),f,frel)
mother = self.nameof(_("Mother"),m,mrel)
@ -1011,13 +1011,13 @@ class FamilyView:
if self.family.get_father_handle() == self.person.get_handle():
sp_id = self.family.get_mother_handle()
if sp_id:
self.selected_spouse = self.parent.db.try_to_find_person_from_handle(sp_id)
self.selected_spouse = self.parent.db.get_person_from_handle(sp_id)
else:
self.selected_spouse = None
else:
sp_id = self.family.get_father_handle()
if sp_id:
self.selected_spouse = self.parent.db.try_to_find_person_from_handle(sp_id)
self.selected_spouse = self.parent.db.get_person_from_handle(sp_id)
else:
self.selected_spouse = None
@ -1034,7 +1034,7 @@ class FamilyView:
for child_handle in child_list:
status = _("Unknown")
child = self.parent.db.try_to_find_person_from_handle(child_handle)
child = self.parent.db.get_person_from_handle(child_handle)
for fam in child.get_parent_family_handle_list():
if fam[0] == self.family.get_handle():
if self.person == self.family.get_father_handle():
@ -1221,13 +1221,13 @@ class FamilyView:
model, iter = self.child_selection.get_selected()
if iter:
id = self.child_model.get_value(iter,2)
child = self.parent.db.try_to_find_person_from_gramps_id(id)
child = self.parent.db.get_person_from_gramps_id(id)
self.parent.change_active_person(child)
self.load_family()
else:
list = self.family.get_child_handle_list()
if len(list) == 1:
p = self.parent.db.try_to_find_person_from_handle(list[0])
p = self.parent.db.get_person_from_handle(list[0])
self.parent.change_active_person(p)
self.load_family()
@ -1289,7 +1289,7 @@ class FamilyView:
row = model.get_path(iter)
family_handle = person.get_parent_family_handle_list()[row[0]][0]
person.remove_parent_family_handle(family_handle)
fam = self.parent.db.try_to_find_family_from_handle(family_handle)
fam = self.parent.db.get_family_from_handle(family_handle)
if len(fam.get_child_handle_list()) == 0:
father_handle = fam.get_father_handle()
@ -1413,7 +1413,7 @@ class FamilyView:
prev_date = "00000000"
for i in range(len(list)):
child_handle = list[i]
child = self.parent.db.try_to_find_person_from_handle(child_handle)
child = self.parent.db.get_person_from_handle(child_handle)
birth_handle = child.get_birth_handle()
birth = self.parent.db.find_event_from_handle(birth_handle)
if not birth:

View File

@ -159,7 +159,7 @@ class FindPerson(FindBase):
self.list.append(db.get_person_display(val))
def get_value(self,id):
return self.db.get_person(id)
return self.db.get_person_from_handle(id)
#-------------------------------------------------------------------------
#

View File

@ -167,7 +167,7 @@ class RelationshipPathBetween(Rule):
if not first:
map[p_id] = 1
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list():
if fam_id:
fam = self.db.find_family_from_handle(fam_id)
@ -279,7 +279,7 @@ class HasCompleteRecord(Rule):
return _('Matches all people whose records are complete')
def apply(self,db,p_id):
return db.try_to_find_person_from_handle(p_id).get_complete() == 1
return db.get_person_from_handle(p_id).get_complete() == 1
#-------------------------------------------------------------------------
#
@ -301,7 +301,7 @@ class IsFemale(Rule):
return _('Matches all females')
def apply(self,db,p_id):
return db.try_to_find_person_from_handle(p_id).get_gender() == RelLib.Person.female
return db.get_person_from_handle(p_id).get_gender() == RelLib.Person.female
#-------------------------------------------------------------------------
#
@ -349,7 +349,7 @@ class IsDescendantOf(Rule):
if not first:
self.map[p_id] = 1
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list():
if fam_id:
fam = self.db.find_family_from_handle(fam_id)
@ -440,7 +440,7 @@ class IsLessThanNthGenerationDescendantOf(Rule):
if gen >= int(self.list[1]):
return
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list():
fam = self.db.find_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list():
@ -486,7 +486,7 @@ class IsMoreThanNthGenerationDescendantOf(Rule):
if gen >= int(self.list[1]):
self.map[p_id] = 1
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list():
fam = self.db.find_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list():
@ -530,7 +530,7 @@ class IsChildOfFilterMatch(Rule):
return self.map.has_key(p_id)
def init_list(self,p_id):
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list():
fam = self.db.find_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list():
@ -568,7 +568,7 @@ class IsDescendantFamilyOf(Rule):
self.map[p_id] = 1
return 1
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
for (f,r1,r2) in p.get_parent_family_handle_list():
family = self.db.find_family_from_handle(f)
for person_handle in [family.get_mother_handle(),family.get_father_handle()]:
@ -633,7 +633,7 @@ class IsAncestorOf(Rule):
if not first:
self.map[p_id] = 1
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
fam_id = p.get_main_parents_family_handle()
if fam_id:
fam = self.db.find_family_from_handle(fam_id)
@ -730,7 +730,7 @@ class IsLessThanNthGenerationAncestorOf(Rule):
if gen >= int(self.list[1]):
return
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
fam_id = p.get_main_parents_family_handle()
if fam_id:
fam = self.db.find_family_from_handle(fam_id)
@ -783,7 +783,7 @@ class IsMoreThanNthGenerationAncestorOf(Rule):
if gen >= int(self.list[1]):
self.map[p_id] = 1
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
fam_id = p.get_main_parents_family_handle()
if fam_id:
fam = self.db.find_family_from_handle(fam_id)
@ -833,7 +833,7 @@ class IsParentOfFilterMatch(Rule):
return self.map.has_key(p_id)
def init_list(self,p_id):
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_main_parents_family_handle():
fam = self.db.find_family_from_handle(fam_id)
for parent_id in [fam.get_father_handle (), fam.get_mother_handle ()]:
@ -937,7 +937,7 @@ class IsMale(Rule):
return _('Matches all males')
def apply(self,db,p_id):
return db.try_to_find_person_from_handle(p_id).get_gender() == RelLib.Person.male
return db.get_person_from_handle(p_id).get_gender() == RelLib.Person.male
#-------------------------------------------------------------------------
#
@ -967,7 +967,7 @@ class HasEvent(Rule):
return _('Event filters')
def apply(self,db,p_id):
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
for event_handle in p.get_event_list():
if not event_handle:
continue
@ -984,7 +984,7 @@ class HasEvent(Rule):
if self.list[2]:
pl_id = event.get_place_handle()
if pl_id:
pl = db.try_to_find_place_from_handle(pl_id)
pl = db.get_place_from_handle(pl_id)
pn = pl.get_title()
if string.find(pn.upper(),self.list[2].upper()) == -1:
val = 0
@ -1021,7 +1021,7 @@ class HasFamilyEvent(Rule):
return _('Event filters')
def apply(self,db,p_id):
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
for f_id in p.get_family_handle_list():
f = db.find_family_from_handle(f_id)
for event_handle in f.get_event_list():
@ -1039,7 +1039,7 @@ class HasFamilyEvent(Rule):
val = 0
pl_id = event.get_place_handle()
if pl_id:
pl = db.try_to_find_place_from_handle(pl_id)
pl = db.get_place_from_handle(pl_id)
pn = pl.get_title()
if self.list[2] and string.find(pn,self.list[2].upper()) == -1:
val = 0
@ -1071,7 +1071,7 @@ class HasRelationship(Rule):
def apply(self,db,p_id):
rel_type = 0
cnt = 0
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
num_rel = len(p.get_family_handle_list())
# count children and look for a relationship type match
@ -1133,7 +1133,7 @@ class HasBirth(Rule):
return _('Event filters')
def apply(self,db,p_id):
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
event_handle = p.get_birth_handle()
if not event_handle:
return 0
@ -1146,7 +1146,7 @@ class HasBirth(Rule):
return 0
pl_id = event.get_place_handle()
if pl_id:
pl = db.try_to_find_place_from_handle(pl_id)
pl = db.get_place_from_handle(pl_id)
pn = pl.get_title()
if len(self.list) > 1 and string.find(pn,self.list[1].upper()) == -1:
return 0
@ -1180,7 +1180,7 @@ class HasDeath(Rule):
return _('Event filters')
def apply(self,db,p_id):
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
event_handle = p.get_death_handle()
if not event_handle:
return 0
@ -1193,7 +1193,7 @@ class HasDeath(Rule):
return 0
pl_id = event.get_place_handle()
if pl_id:
pl = db.try_to_find_place_from_handle(pl_id)
pl = db.get_place_from_handle(pl_id)
pn = pl.get_title()
if self.list[1] and string.find(pn,self.list[1].upper()) == -1:
return 0
@ -1213,7 +1213,7 @@ class HasAttribute(Rule):
return 'Has the personal attribute'
def apply(self,db,p_id):
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
for event in p.getAttributes():
if self.list[0] and event.get_type() != self.list[0]:
return 0
@ -1236,7 +1236,7 @@ class HasFamilyAttribute(Rule):
return 'Has the family attribute'
def apply(self,db,p_id):
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
for f_id in p.get_family_handle_list():
f = db.find_family_from_handle(f_id)
for event in f.getAttributes():
@ -1274,7 +1274,7 @@ class HasNameOf(Rule):
self.l = self.list[1]
self.s = self.list[2]
self.t = self.list[3]
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
for name in [p.get_primary_name()] + p.get_alternate_names():
val = 1
if self.f and string.find(name.get_first_name().upper(),self.f.upper()) == -1:
@ -1310,7 +1310,7 @@ class SearchName(Rule):
def apply(self,db,p_id):
self.f = self.list[0]
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
return self.f and string.find(p.get_primary_name().get_name().upper(),self.f.upper()) != -1
#-------------------------------------------------------------------------
@ -1357,7 +1357,7 @@ class IsSpouseOfFilterMatch(Rule):
def apply(self,db,p_id):
filter = MatchesFilter (self.list)
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
for family_handle in p.get_family_handle_list ():
family = db.find_family_from_handle(family_handle)
for spouse_id in [family.get_father_handle (), family.get_mother_handle ()]:

View File

@ -89,6 +89,8 @@ class GrampsBSDDB(GrampsDbBase):
self.bookmarks = self.metadata.get('bookmarks')
if self.bookmarks == None:
self.bookmarks = []
self.genderStats = GenderStats(self.metadata.get('gender_stats'))
return 1
def close(self):
@ -99,6 +101,7 @@ class GrampsBSDDB(GrampsDbBase):
self.media_map.close()
self.event_map.close()
self.metadata['bookmarks'] = self.bookmarks
self.metadata['gender_stats'] = self.genderStats.save_stats()
self.metadata.close()
self.surnames.close()
self.eventnames.close()
@ -140,7 +143,7 @@ class GrampsBSDDB(GrampsDbBase):
return vals
def remove_person_handle(self,handle,transaction):
# self.genderStats.uncount_person (self.person_map[handle])
self.genderStats.uncount_person (self.person_map[handle])
if transaction != None:
old_data = self.person_map.get(handle)
transaction.add(PERSON_KEY,handle,old_data)

View File

@ -20,17 +20,22 @@
# $Id$
#-------------------------------------------------------------------------
#
# libraries
#
#-------------------------------------------------------------------------
from RelLib import *
import cPickle
_UNDO_SIZE = 1000
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# ID regular expression
# constants
#
#-------------------------------------------------------------------------
_id_reg = compile("%\d+d")
_UNDO_SIZE = 1000
_id_reg = compile("%\d+d")
#-------------------------------------------------------------------------
#
@ -55,6 +60,7 @@ class GrampsDbBase:
self.added_files = []
self.genderStats = GenderStats()
self.id_trans = None
self.env = None
self.person_map = None
self.family_map = None
@ -172,12 +178,12 @@ class GrampsDbBase:
transaction.add(PERSON_KEY,handle,old_data)
self.person_map[handle] = person.serialize()
def commit_media_object(self,object,transaction):
handle = str(object.get_handle())
def commit_media_object(self,obj,transaction):
handle = str(obj.get_handle())
if transaction != None:
old_data = self.media_map.get(handle)
transaction.add(MEDIA_KEY,handle,old_data)
self.media_map[str(object.get_handle())] = object.serialize()
self.media_map[str(obj.get_handle())] = obj.serialize()
def commit_source(self,source,transaction):
handle = str(source.get_handle())
@ -474,7 +480,7 @@ class GrampsDbBase:
if trans != None:
trans.add(PERSON_KEY, person.get_handle(),None)
self.person_map[person.get_handle()] = person.serialize()
# self.genderStats.count_person (person, self)
self.genderStats.count_person (person, self)
return person.get_handle()
def add_person(self,person,trans):
@ -493,7 +499,7 @@ class GrampsDbBase:
def has_family_handle(self,val):
return self.family_map.has_key(str(val))
def try_to_find_person_from_handle(self,val):
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."""
@ -505,7 +511,7 @@ class GrampsDbBase:
else:
return None
def try_to_find_person_from_gramps_id(self,val):
def get_person_from_gramps_id(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."""
@ -545,7 +551,7 @@ class GrampsDbBase:
if trans != None:
trans.add(PERSON_KEY, val, None)
self.person_map[val] = person.serialize()
# self.genderStats.count_person (person, self)
self.genderStats.count_person (person, self)
return person
def add_person_no_map(self,person,handle,trans):
@ -555,7 +561,7 @@ class GrampsDbBase:
if trans != None:
trans.add(PERSON_KEY, handle, None)
self.person_map.set(handle,person.serialize())
# self.genderStats.count_person (person, self)
self.genderStats.count_person (person, self)
return handle
def add_source(self,source,trans):
@ -640,7 +646,7 @@ class GrampsDbBase:
map[handle] = self.add_event(event,trans)
return event
def try_to_find_source_from_handle(self,val):
def get_source_from_handle(self,val):
"""finds a Source in the database from the passed gramps' ID.
If no such Source exists, None is returned."""
@ -674,7 +680,7 @@ class GrampsDbBase:
else:
return None
def add_object(self,object,trans):
def add_object(self,obj,trans):
"""adds an Object instance to the database, assigning it a gramps'
ID number"""
@ -682,12 +688,12 @@ class GrampsDbBase:
while self.media_map.get(str(index)):
self.omap_index = self.omap_index + 1
index = self.oprefix % self.omap_index
object.set_handle(index)
obj.set_handle(index)
if trans != None:
trans.add(MEDIA_KEY,index,None)
self.media_map[str(index)] = object.serialize()
self.media_map[str(index)] = obj.serialize()
self.omap_index = self.omap_index + 1
self.added_files.append(object)
self.added_files.append(obj)
return index
@ -701,28 +707,28 @@ class GrampsDbBase:
map - map build by find_object of external to gramp's IDs"""
handle = str(handle)
object = MediaObject()
obj = MediaObject()
if map.has_key(handle):
object.unserialize(self.media_map.get(str(map[handle])))
obj.unserialize(self.media_map.get(str(map[handle])))
else:
if self.media_map.get(str(handle)):
map[handle] = self.add_object(object,trans)
map[handle] = self.add_object(obj,trans)
else:
map[handle] = self.add_object_no_map(object,handle,trans)
return object
map[handle] = self.add_object_no_map(obj,handle,trans)
return obj
def add_object_no_map(self,object,index,trans):
def add_object_no_map(self,obj,index,trans):
"""adds an Object to the database if the gramps' ID is known"""
index = str(index)
object.set_handle(index)
obj.set_handle(index)
if trans != None:
trans.add(MEDIA_KEY,index,None)
self.media_map[str(index)] = object.serialize()
self.media_map[str(index)] = obj.serialize()
self.omap_index = self.omap_index + 1
self.added_files.append(object)
self.added_files.append(obj)
return index
def try_to_find_object_from_handle(self,handle):
def get_object_from_handle(self,handle):
"""finds an Object in the database from the passed gramps' ID.
If no such Object exists, None is returned."""
@ -738,12 +744,12 @@ class GrampsDbBase:
"""finds an Object in the database from the passed gramps' ID.
If no such Object exists, a new Object is added to the database."""
object = MediaObject()
obj = MediaObject()
if self.media_map.get(str(handle)):
object.unserialize(self.media_map.get(str(handle)))
obj.unserialize(self.media_map.get(str(handle)))
else:
self.add_object_no_map(object,handle,trans)
return object
self.add_object_no_map(obj,handle,trans)
return obj
def has_object_handle(self,handle):
"""finds an Object in the database from the passed gramps' ID.
@ -828,7 +834,7 @@ class GrampsDbBase:
place.unserialize(data)
return place
def try_to_find_place_from_handle(self,handle):
def get_place_from_handle(self,handle):
"""finds a Place in the database from the passed gramps' ID.
If no such Place exists, None is returned."""
@ -887,11 +893,6 @@ class GrampsDbBase:
else:
return []
def get_place_handle(self,key):
place = Place()
place.unserialize(self.place_map.get(str(key)))
return place
def get_place_display(self,key):
# fix this up better
place = Place()
@ -929,11 +930,6 @@ class GrampsDbBase:
source.unserialize(self.source_map.get(str(key)))
return source.get_display_info()
def get_source(self,key):
source = Source()
source.unserialize(self.source_map[key])
return source
def build_source_display(self,nkey,okey=None):
pass

View File

@ -66,7 +66,7 @@ class GrampsGEDDB(GrampsDbBase):
def get_surnames(self):
a = {}
for person_id in self.get_person_keys():
p = self.try_to_find_person_from_handle(person_id)
p = self.get_person_from_handle(person_id)
a[p.get_primary_name().get_surname()] = 1
vals = a.keys()
vals.sort()
@ -82,7 +82,7 @@ class GrampsGEDDB(GrampsDbBase):
return vals
def remove_person_handle(self,handle,transaction):
# self.genderStats.uncount_person (self.person_map[handle])
self.genderStats.uncount_person (self.person_map[handle])
if transaction != None:
old_data = self.person_map.get(handle)
transaction.add(PERSON_KEY,handle,old_data)

View File

@ -74,7 +74,7 @@ class GrampsXMLDB(GrampsDbBase):
def get_surnames(self):
a = {}
for person_id in self.get_person_keys():
p = self.try_to_find_person_from_handle(person_id)
p = self.get_person_from_handle(person_id)
a[p.get_primary_name().get_surname()] = 1
vals = a.keys()
vals.sort()
@ -90,7 +90,7 @@ class GrampsXMLDB(GrampsDbBase):
return vals
def remove_person_handle(self,handle,transaction):
# self.genderStats.uncount_person (self.person_map[handle])
self.genderStats.uncount_person (self.person_map[handle])
if transaction != None:
old_data = self.person_map.get(handle)
transaction.add(PERSON_KEY,handle,old_data)

View File

@ -54,7 +54,7 @@ class DescendLine(GraphLayout):
if pos > self.maxy:
self.maxy = pos
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
for family_handle in person.get_family_handle_list():
family = self.database.find_family_from_handle(family_handle)
for child_handle in family.get_child_handle_list():
@ -65,7 +65,7 @@ class DescendLine(GraphLayout):
self.elist.pop()
def depth(self,person_handle,val=0):
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
for family_handle in person.get_family_handle_list():
family = self.database.find_family_from_handle(family_handle)
clist = family.get_child_handle_list()

View File

@ -170,7 +170,7 @@ class ImageSelect:
trans = self.db.start_transaction()
for o_id in self.db.get_object_keys():
o = self.db.try_to_find_object_from_handle(o_id)
o = self.db.get_object_from_handle(o_id)
if o.get_path() == filename:
already_imported = o
break
@ -269,7 +269,7 @@ class Gallery(ImageSelect):
def on_drag_begin(self,obj,context):
if const.dnd_images:
id = self.sel_obj.get_reference_handle()
obj = self.db.try_to_find_object_from_handle(id)
obj = self.db.get_object_from_handle(id)
mtype = obj.get_mime_type()
name = Utils.thumb_path(self.db.get_save_path(),obj)
pix = gtk.gdk.pixbuf_new_from_file(name)
@ -363,7 +363,7 @@ class Gallery(ImageSelect):
def add_thumbnail(self, photo):
"""Scale the image and add it to the IconList."""
oid = photo.get_reference_handle()
object = self.db.try_to_find_object_from_handle(oid)
object = self.db.get_object_from_handle(oid)
if self.canvas_list.has_key(oid):
(grp,item,text,x,y) = self.canvas_list[oid]
if x != self.cx or y != self.cy:
@ -598,7 +598,7 @@ class Gallery(ImageSelect):
menu = gtk.Menu()
menu.set_title(_("Media Object"))
object = self.db.try_to_find_object_from_handle(photo.get_reference_handle())
object = self.db.get_object_from_handle(photo.get_reference_handle())
mtype = object.get_mime_type()
progname = GrampsMime.get_application(mtype)
@ -615,20 +615,20 @@ class Gallery(ImageSelect):
def popup_view_photo(self, obj):
"""Open this picture in a picture viewer"""
photo = obj.get_data('o')
Utils.view_photo(self.db.try_to_find_object_from_handle(photo.get_reference_handle()))
Utils.view_photo(self.db.get_object_from_handle(photo.get_reference_handle()))
def popup_edit_photo(self, obj):
"""Open this picture in a picture editor"""
photo = obj.get_data('o')
if os.fork() == 0:
obj = self.db.try_to_find_object_from_handle(photo.get_reference_handle())
obj = self.db.get_object_from_handle(photo.get_reference_handle())
os.execvp(const.editor,[const.editor, obj.get_path()])
def popup_convert_to_private(self, obj):
"""Copy this picture into gramps private database instead of
leaving it as an external data object."""
photo = obj.get_data('o')
object = self.db.try_to_find_object_from_handle(photo.get_reference_handle())
object = self.db.get_object_from_handle(photo.get_reference_handle())
name = RelImage.import_media_object(object.get_path(),self.path,
object.get_handle())
object.set_path(name)
@ -659,7 +659,7 @@ class LocalMediaProperties:
self.child_windows = {}
self.photo = photo
self.db = parent.db
self.object = self.db.try_to_find_object_from_handle(photo.get_reference_handle())
self.object = self.db.get_object_from_handle(photo.get_reference_handle())
self.alist = photo.get_attribute_list()[:]
self.lists_changed = 0
@ -1057,7 +1057,7 @@ class GlobalMediaProperties:
titles,event_func=self.button_press)
any = 0
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
for o in p.get_media_list():
if o.get_reference_handle() == self.object.get_handle():
self.refmodel.add([_("Person"),p.get_handle(),GrampsCfg.get_nameof()(p)])
@ -1069,13 +1069,13 @@ class GlobalMediaProperties:
self.refmodel.add([_("Family"),p.get_handle(),Utils.family_name(p,self.db)])
any = 1
for key in self.db.get_source_keys():
p = self.db.try_to_find_source_from_handle(key)
p = self.db.get_source_from_handle(key)
for o in p.get_media_list():
if o.get_reference_handle() == self.object.get_handle():
self.refmodel.add([_("Source"),p.get_handle(),p.get_title()])
any = 1
for key in self.db.get_place_handle_keys():
p = self.db.try_to_find_place_from_handle(key)
p = self.db.get_place_from_handle(key)
for o in p.get_media_list():
if o.get_reference_handle() == self.object.get_handle():
self.refmodel.add([_("Place"),p.get_handle(),p.get_title()])
@ -1170,7 +1170,7 @@ class DeleteMediaQuery:
trans = self.db.start_transaction()
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
nl = []
change = 0
for photo in p.get_media_list():
@ -1196,7 +1196,7 @@ class DeleteMediaQuery:
self.db.commit_family(p,trans)
for key in self.db.get_source_keys():
sid = self.db.try_to_find_source_from_handle(key)
sid = self.db.get_source_from_handle(key)
nl = []
change = 0
for photo in p.get_media_list():
@ -1209,7 +1209,7 @@ class DeleteMediaQuery:
self.db.commit_source(p,trans)
for key in self.db.get_place_handle_keys():
p = self.db.try_to_find_place_from_handle(key)
p = self.db.get_place_from_handle(key)
nl = []
change = 0
for photo in p.get_media_list():

View File

@ -160,6 +160,7 @@ gdir_PYTHON = \
GedcomInfo.py\
GenericFilter.py\
GrampsCfg.py\
GrampsBSDDB.py\
GrampsMime.py\
gramps_main.py\
gramps.py\
@ -185,6 +186,7 @@ gdir_PYTHON = \
PlaceView.py\
Plugins.py\
QuestionDialog.py\
ReadGedcom.py \
ReadXML.py\
Relationship.py\
RelImage.py\
@ -206,6 +208,7 @@ gdir_PYTHON = \
UrlEdit.py\
Utils.py\
Witness.py\
WriteGedcom.py \
WriteXML.py\
SelectPerson.py\
ArgHandler.py\
@ -218,6 +221,8 @@ gdir_PYTHON = \
GLADEFILES = \
gramps.glade\
mergedata.glade\
gedcomexport.glade\
gedcomimport.glade\
plugins.glade\
rule.glade

View File

@ -132,8 +132,8 @@ class Marriage:
fid = family.get_father_handle()
mid = family.get_mother_handle()
father = self.db.try_to_find_person_from_handle(fid)
mother = self.db.try_to_find_person_from_handle(mid)
father = self.db.get_person_from_handle(fid)
mother = self.db.get_person_from_handle(mid)
self.title = _("%s and %s") % (GrampsCfg.get_nameof()(father),
GrampsCfg.get_nameof()(mother))
@ -400,11 +400,11 @@ class Marriage:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.try_to_find_source_from_handle(base_handle)
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase)
place = foo.get_place_handle()
if place:
foo.set_place_handle(self.db.try_to_find_place_from_handle(place.get_handle()))
foo.set_place_handle(self.db.get_place_from_handle(place.get_handle()))
self.elist.insert(row,foo)
self.lists_changed = 1
@ -432,7 +432,7 @@ class Marriage:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.try_to_find_source_from_handle(base_handle)
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase)
self.alist.insert(row,foo)
@ -478,7 +478,7 @@ class Marriage:
place_handle = event.get_place_handle()
if place_handle:
place_name = self.db.try_to_find_place_from_handle(place_handle).get_title()
place_name = self.db.get_place_from_handle(place_handle).get_title()
else:
place_name = ""
iter = self.etree.add([const.display_fevent(event.get_name()),
@ -675,7 +675,7 @@ class Marriage:
self.date_field.set_text(event.get_date())
place_handle = event.get_place_handle()
if place_handle:
place_name = self.db.try_to_find_place_from_handle(place_handle).get_title()
place_name = self.db.get_place_from_handle(place_handle).get_title()
else:
place_name = u""
self.place_field.set_text(place_name)
@ -684,7 +684,7 @@ class Marriage:
if len(event.get_source_references()) > 0:
psrc_ref = event.get_source_references()[0]
psrc_id = psrc_ref.get_base_handle()
psrc = self.db.try_to_find_source_from_handle(psrc_id)
psrc = self.db.get_source_from_handle(psrc_id)
self.event_src_field.set_text(psrc.get_title())
self.event_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()])
else:
@ -703,7 +703,7 @@ class Marriage:
if len(attr.get_source_references()) > 0:
psrc_ref = attr.get_source_references()[0]
psrc_id = psrc_ref.get_base_handle()
psrc = self.db.try_to_find_source_from_handle(psrc_id)
psrc = self.db.get_source_from_handle(psrc_id)
self.attr_src_field.set_text(psrc.get_title())
self.attr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()])
else:
@ -720,8 +720,8 @@ class Marriage:
father_handle = self.family.get_father_handle()
mother_handle = self.family.get_mother_handle()
father = self.db.try_to_find_person_from_handle(father_handle)
mother = self.db.try_to_find_person_from_handle(mother_handle)
father = self.db.get_person_from_handle(father_handle)
mother = self.db.get_person_from_handle(mother_handle)
if father and mother:
name = _("%s and %s") % (father.get_primary_name().get_name(),
mother.get_primary_name().get_name())
@ -741,8 +741,8 @@ class Marriage:
import AttrEdit
father_handle = self.family.get_father_handle()
mother_handle = self.family.get_mother_handle()
father = self.db.try_to_find_person_from_handle(father_handle)
mother = self.db.try_to_find_person_from_handle(mother_handle)
father = self.db.get_person_from_handle(father_handle)
mother = self.db.get_person_from_handle(mother_handle)
if father and mother:
name = _("%s and %s") % (father.get_primary_name().get_name(),
mother.get_primary_name().get_name())
@ -785,7 +785,7 @@ class Marriage:
text = string.strip(unicode(field.get_text()))
if text:
if self.pmap.has_key(text):
return self.db.try_to_find_place_from_handle(self.pmap[text])
return self.db.get_place_from_handle(self.pmap[text])
elif makenew:
place = RelLib.Place()
place.set_title(text)

View File

@ -178,7 +178,7 @@ class MediaView:
id = store.get_value(iter,1)
mobj = self.db.try_to_find_object_from_handle(id)
mobj = self.db.get_object_from_handle(id)
type = mobj.get_mime_type()
type_name = Utils.get_mime_description(type)
path = mobj.get_path()
@ -226,7 +226,7 @@ class MediaView:
store,iter = self.selection.get_selected()
if iter:
id = store.get_value(iter,1)
object = self.db.try_to_find_object_from_handle(id)
object = self.db.get_object_from_handle(id)
self.obj = object
mime_type = object.get_mime_type()
@ -292,7 +292,7 @@ class MediaView:
list_store, iter = self.selection.get_selected()
if iter:
id = list_store.get_value(iter,1)
object = self.db.try_to_find_object_from_handle(id)
object = self.db.get_object_from_handle(id)
ImageSelect.GlobalMediaProperties(self.db,object,self.load_media,
self,self.topWindow)
@ -302,7 +302,7 @@ class MediaView:
return
id = store.get_value(iter,1)
mobj = self.db.try_to_find_object_from_handle(id)
mobj = self.db.get_object_from_handle(id)
if self.is_object_used(mobj):
ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.build_tree)
QuestionDialog(_('Delete Media Object?'),
@ -325,12 +325,12 @@ class MediaView:
if o.get_reference_handle() == mobj.get_handle():
return 1
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
for o in p.get_media_list():
if o.get_reference_handle() == mobj.get_handle():
return 1
for key in self.db.get_source_keys():
p = self.db.get_source(key)
p = self.db.get_source_from_handle(key)
for o in p.get_media_list():
if o.get_reference_handle() == mobj.get_handle():
return 1
@ -346,7 +346,7 @@ class MediaView:
if not iter:
return
if (const.dnd_images):
object = self.db.try_to_find_object_from_handle(store.get_value(iter,1))
object = self.db.get_object_from_handle(store.get_value(iter,1))
mtype = object.get_mime_type()
name = Utils.thumb_path(self.db.get_save_path(),object)
pix = gtk.gdk.pixbuf_new_from_file(name)

View File

@ -391,7 +391,7 @@ class MergePeople:
#
if tgt_family in self.p1.get_family_handle_list():
if tgt_family.get_father_handle() != None and \
src_family in tgt_father.get_family_handle_list():
src_family in tgt_family.get_family_handle_list():
tgt_family.get_father_handle().remove_family_handle(src_family)
if tgt_family.get_mother_handle() != None and \
src_family in tgt_family.get_mother_handle().get_family_handle_list():
@ -485,6 +485,7 @@ class MergePeople:
self.delete_empty_family(family)
def delete_empty_family(self,family_handle):
family = self.db.get_family_from_handle(family_handle)
for child in family.get_child_handle_list():
if child.get_main_parents_family_handle() == family_handle:
child.set_main_parent_family_handle(None)
@ -887,7 +888,7 @@ class MergePlaces:
# loop through people, changing event references to P2 to P1
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
for event in [p.get_birth(), p.get_death()] + p.get_event_list():
if event.get_place_handle() == self.p2:
event.set_place_handle(self.p1)

View File

@ -373,13 +373,13 @@ class PedigreeView:
childlist = find_children(self.parent.db,self.active_person)
if len(childlist) == 1:
child = self.parent.db.try_to_find_person_from_handle(childlist[0])
child = self.parent.db.get_person_from_handle(childlist[0])
if child:
self.load_canvas(child)
elif len(childlist) > 1:
myMenu = gtk.Menu()
for child_handle in childlist:
child = self.parent.db.try_to_find_person_from_handle(child_handle)
child = self.parent.db.get_person_from_handle(child_handle)
cname = GrampsCfg.get_nameof()(child)
menuitem = gtk.MenuItem(None)
if find_children(self.parent.db,child):
@ -402,7 +402,7 @@ class PedigreeView:
attached with menu item."""
person_handle = obj.get_data(_PERSON)
person = self.parent.db.try_to_find_person_from_handle(person_handle)
person = self.parent.db.get_person_from_handle(person_handle)
if person:
self.load_canvas(person)
return 1
@ -427,7 +427,7 @@ class PedigreeView:
attached to the button and change the root person to that
person, redrawing the view."""
person_handle = obj.get_data(_PERSON)
person = self.parent.db.try_to_find_person_from_handle(person_handle)
person = self.parent.db.get_person_from_handle(person_handle)
if self.active_person:
self.active_person = person
self.load_canvas(person)
@ -463,7 +463,7 @@ class PedigreeView:
"""Catch X events over a line and respond to the ones we care about"""
person_handle = obj.get_data(_PERSON)
person = self.parent.db.try_to_find_person_from_handle(person_handle)
person = self.parent.db.get_person_from_handle(person_handle)
style = self.canvas.get_style()
if event.type == gtk.gdk._2BUTTON_PRESS:
@ -495,11 +495,11 @@ class PedigreeView:
if family != None:
father_handle = family.get_father_handle()
if father_handle != None:
father = self.parent.db.try_to_find_person_from_handle(father_handle)
father = self.parent.db.get_person_from_handle(father_handle)
self.find_tree(father,(2*index)+1,depth+1,list,frel)
mother_handle = family.get_mother_handle()
if mother_handle != None:
mother = self.parent.db.try_to_find_person_from_handle(mother_handle)
mother = self.parent.db.get_person_from_handle(mother_handle)
self.find_tree(mother,(2*index)+2,depth+1,list,mrel)
def on_canvas1_event(self,obj,event):
@ -578,7 +578,7 @@ class PedigreeView:
sp_id = family.get_mother_handle()
else:
sp_id = family.get_father_handle()
spouse = self.parent.db.try_to_find_person_from_handle(sp_id)
spouse = self.parent.db.get_person_from_handle(sp_id)
if not spouse:
continue
@ -609,7 +609,7 @@ class PedigreeView:
for sib_id in sib_list:
if sib_id == person.get_handle():
continue
sib = self.parent.db.try_to_find_person_from_handle(sib_id)
sib = self.parent.db.get_person_from_handle(sib_id)
if not sib:
continue
@ -634,7 +634,7 @@ class PedigreeView:
no_children = 1
childlist = find_children(self.parent.db,person)
for child_handle in childlist:
child = self.parent.db.try_to_find_person_from_handle(child_handle)
child = self.parent.db.get_person_from_handle(child_handle)
if not child:
continue
@ -668,7 +668,7 @@ class PedigreeView:
no_parents = 1
par_list = find_parents(self.parent.db,person)
for par_id in par_list:
par = self.parent.db.try_to_find_person_from_handle(par_id)
par = self.parent.db.get_person_from_handle(par_id)
if not par:
continue

View File

@ -138,7 +138,7 @@ class PeopleModel(gtk.GenericTreeModel):
for person_handle in self.db.get_person_keys():
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
surname = unicode(person.get_primary_name().get_surname())
if self.sname_sub.has_key(surname):
@ -377,7 +377,7 @@ class PeopleModel(gtk.GenericTreeModel):
if event:
place_handle = event.get_place_handle()
if place_handle:
return self.db.try_to_find_place_from_handle(place_handle).get_title()
return self.db.get_place_from_handle(place_handle).get_title()
return u""
def column_death_place(self,data):
@ -386,7 +386,7 @@ class PeopleModel(gtk.GenericTreeModel):
if event:
place_handle = event.get_place_handle()
if place_handle:
return self.db.try_to_find_place_from_handle(place_handle).get_title()
return self.db.get_place_from_handle(place_handle).get_title()
return u""
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]

View File

@ -139,7 +139,7 @@ class PeopleView:
selected_ids = self.get_selected_objects()
try:
person = self.parent.db.get_person(selected_ids[0])
person = self.parent.db.get_person_from_handle(selected_ids[0])
self.parent.change_active_person(person)
except:
self.parent.change_active_person(None)

View File

@ -190,7 +190,7 @@ class PlaceView:
for place in mlist:
used = 0
for key in self.db.get_person_keys():
p = self.db.try_to_find_person_from_handle(key)
p = self.db.get_person_from_handle(key)
event_list = []
for e in [p.get_birth_handle(),p.get_death_handle()] + p.get_event_list():
event = self.db.find_event_from_handle(e)
@ -243,7 +243,7 @@ class PlaceView:
EditPlace.EditPlace(self.parent, place, self.update_display)
def blist(self,store,path,iter,list):
id = self.db.get_place_handle(store.get_value(iter,1))
id = self.db.get_place_from_handle(store.get_value(iter,1))
list.append(id)
def merge(self):

View File

@ -1746,7 +1746,7 @@ class GedcomParser:
new_key = prefix % val
new_pmax = max(new_pmax,val)
person = self.db.try_to_find_person_from_handle(pid,self.trans)
person = self.db.get_person_from_handle(pid,self.trans)
# new ID is not used
if not self.db.has_person_handle(new_key):
@ -1755,7 +1755,7 @@ class GedcomParser:
person.set_gramps_id(new_key)
self.db.add_person(person,self.trans)
else:
tp = self.db.try_to_find_person_from_handle(new_key,self.trans)
tp = self.db.get_person_from_handle(new_key,self.trans)
# same person, just change it
if person == tp:
self.db.remove_person_handle(pid,self.trans)

View File

@ -153,7 +153,7 @@ def importData(database, filename, callback=None,cl=0):
first = not os.path.exists(img_dir)
for m_id in database.get_object_keys():
mobject = database.try_to_find_object_from_handle(m_id)
mobject = database.get_object_from_handle(m_id)
oldfile = mobject.get_path()
if oldfile[0] != '/':
if first:

View File

@ -1504,7 +1504,7 @@ class Person(SourceNote):
for family_handle in person.get_family_handle_list():
family = db.find_family_from_handle(family_handle)
for child_handle in family.get_child_handle_list():
child = db.try_to_find_person_from_handle(child_handle)
child = db.get_person_from_handle(child_handle)
if child.birth_handle:
child_birth = db.find_event_from_handle(child.birth_handle)
if child_birth.get_date() != "":
@ -1537,7 +1537,7 @@ class Person(SourceNote):
if not parent_id:
continue
parent = db.try_to_find_person_from_handle(parent_id)
parent = db.get_person_from_handle(parent_id)
if parent.birth_handle:
parent_birth = db.find_event_from_handle(parent.birth_handle)
if parent_birth.get_date():
@ -1569,7 +1569,7 @@ class Person(SourceNote):
continue
if spouse_id == self.handle:
continue
spouse = db.try_to_find_person_from_handle(spouse_id)
spouse = db.get_person_from_handle(spouse_id)
if spouse.birth_handle:
spouse_birth = db.find_event_from_handle(spouse.birth_handle)
if spouse_birth.get_date() != "":
@ -2244,8 +2244,14 @@ class SourceRef:
#
#-------------------------------------------------------------------------
class GenderStats:
def __init__ (self):
self.stats = {}
def __init__ (self,stats={}):
if stats == None:
self.stats = {}
else:
self.stats = stats
def save_stats(self):
return self.stats
def _get_key (self, person):
name = person.get_primary_name().get_first_name()

View File

@ -172,8 +172,8 @@ class RelationshipCalculator:
family_handle = person.get_main_parents_family_handle()
family = self.db.find_family_from_handle(family_handle)
if family != None:
father = self.db.try_to_find_person_from_handle(family.get_father_handle())
mother = self.db.try_to_find_person_from_handle(family.get_mother_handle())
father = self.db.get_person_from_handle(family.get_father_handle())
mother = self.db.get_person_from_handle(family.get_mother_handle())
self.apply_filter(father,index+1,plist,pmap)
self.apply_filter(mother,index+1,plist,pmap)

View File

@ -87,8 +87,8 @@ class SelectChild:
self.add_child = self.xml.get_widget("childlist")
if (self.family):
father = self.db.try_to_find_person_from_handle(self.family.get_father_handle())
mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle())
father = self.db.get_person_from_handle(self.family.get_father_handle())
mother = self.db.get_person_from_handle(self.family.get_mother_handle())
if father != None:
fname = father.get_primary_name().get_name()
@ -196,7 +196,7 @@ class SelectChild:
person_list = []
for key in self.db.sort_person_keys():
person = self.db.get_person(key)
person = self.db.get_person_from_handle(key)
if filter:
if slist.has_key(key) or person.get_main_parents_family_handle():
continue
@ -276,7 +276,7 @@ class SelectChild:
return
id = idlist[0]
select_child = self.db.get_person(id)
select_child = self.db.get_person_from_handle(id)
if self.person.get_handle() == id:
ErrorDialog(_("Error selecting a child"),
_("A person cannot be linked as his/her own child"),
@ -300,13 +300,13 @@ class SelectChild:
self.family.add_child_handle(select_child.get_handle())
mrel = const.child_relations.find_value(self.mrel.get_text())
mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle())
mother = self.db.get_person_from_handle(self.family.get_mother_handle())
if mother and mother.get_gender() != RelLib.Person.female:
if mrel == "Birth":
mrel = "Unknown"
frel = const.child_relations.find_value(self.frel.get_text())
father = self.db.try_to_find_person_from_handle(self.family.get_father_handle())
father = self.db.get_person_from_handle(self.family.get_father_handle())
if father and father.get_gender() !=RelLib. Person.male:
if frel == "Birth":
frel = "Unknown"
@ -393,8 +393,8 @@ class EditRel:
Utils.set_titles(self.top,self.xml.get_widget('title'),
_('Relationships of %s') % name)
father = self.db.try_to_find_person_from_handle(self.family.get_father_handle())
mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle())
father = self.db.get_person_from_handle(self.family.get_father_handle())
mother = self.db.get_person_from_handle(self.family.get_mother_handle())
if father:
fname = father.get_primary_name().get_name()
@ -437,13 +437,13 @@ class EditRel:
def on_ok_clicked(self,obj):
mrel = const.child_relations.find_value(self.mentry.get_text())
mother = self.db.try_to_find_person_from_handle(self.family.get_mother_handle())
mother = self.db.get_person_from_handle(self.family.get_mother_handle())
if mother and mother.get_gender() != RelLib.Person.female:
if mrel == "Birth":
mrel = "Unknown"
frel = const.child_relations.find_value(self.fentry.get_text())
father = self.db.try_to_find_person_from_handle(self.family.get_father_handle())
father = self.db.get_person_from_handle(self.family.get_father_handle())
if father and father.get_gender() !=RelLib. Person.male:
if frel == "Birth":
frel = "Unknown"

View File

@ -99,7 +99,7 @@ class SelectObject:
self.object_model.new_model()
for key in self.db.get_object_keys():
object = self.db.try_to_find_object_from_handle(key)
object = self.db.get_object_from_handle(key)
title = object.get_description()
the_id = object.get_handle()
the_type = Utils.get_mime_description(object.get_mime_type())
@ -116,7 +116,7 @@ class SelectObject:
return
data = self.object_model.get_data(iter,range(self.ncols))
the_id = data[4]
object = self.db.try_to_find_object_from_handle(the_id)
object = self.db.get_object_from_handle(the_id)
the_type = Utils.get_mime_description(object.get_mime_type())
path = object.get_path()
@ -149,7 +149,7 @@ class SelectObject:
if iter:
data = self.object_model.get_data(iter,range(self.ncols))
the_id = data[4]
return_value = self.db.try_to_find_object_from_handle(the_id)
return_value = self.db.get_object_from_handle(the_id)
else:
return_value = None
self.top.destroy()

View File

@ -116,7 +116,7 @@ class SelectPerson:
return
for key in self.db.sort_person_keys():
person = self.db.get_person(key)
person = self.db.get_person_from_handle(key)
if self.use_filter and not self.filter(person):
continue
@ -143,7 +143,7 @@ class SelectPerson:
idlist = self.get_selected_ids()
if idlist and idlist[0]:
return_value = self.db.get_person(idlist[0])
return_value = self.db.get_person_from_handle(idlist[0])
else:
return_value = None
self.top.destroy()

View File

@ -79,8 +79,8 @@ class Sort:
def by_last_name(self,first_id,second_id):
"""Sort routine for comparing two last names. If last names are equal,
uses the given name and suffix"""
first = self.database.try_to_find_person_from_handle(first_id)
second = self.database.try_to_find_person_from_handle(second_id)
first = self.database.get_person_from_handle(first_id)
second = self.database.get_person_from_handle(second_id)
name1 = first.get_primary_name()
name2 = second.get_primary_name()
@ -101,8 +101,8 @@ class Sort:
def by_birthdate(self,first_id,second_id):
"""Sort routine for comparing two people by birth dates. If the birth dates
are equal, sorts by name"""
first = self.database.try_to_find_person_from_handle(first_id)
second = self.database.try_to_find_person_from_handle(second_id)
first = self.database.get_person_from_handle(first_id)
second = self.database.get_person_from_handle(second_id)
birth_handle1 = first.get_birth_handle()
if birth_handle1:

View File

@ -67,7 +67,6 @@ class SourceView:
def __init__(self,parent,db,glade,update):
self.parent = parent
self.glade = glade
self.db = db
self.update = update
self.list = glade.get_widget("source_list")
self.list.connect('button-press-event',self.button_press)
@ -76,9 +75,9 @@ class SourceView:
self.renderer = gtk.CellRendererText()
if const.nosort_tree:
self.model = DisplayModels.SourceModel(self.db)
self.model = DisplayModels.SourceModel(self.parent.db)
else:
self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.db))
self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.parent.db))
self.list.set_model(self.model)
self.topWindow = self.glade.get_widget("gramps")
@ -133,8 +132,8 @@ class SourceView:
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
store,iter = self.selection.get_selected()
id = store.get_value(iter,1)
source = self.db.get_source(id)
EditSource.EditSource(source,self.db,self.parent,
source = self.parent.db.get_source_from_handle(id)
EditSource.EditSource(source,self.parent.db,self.parent,
self.topWindow,self.update_display)
return 1
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
@ -175,7 +174,7 @@ class SourceView:
menu.popup(None,None,None,event.button,event.time)
def on_add_clicked(self,obj):
EditSource.EditSource(RelLib.Source(),self.db,self.parent,
EditSource.EditSource(RelLib.Source(),self.parent.db,self.parent,
self.topWindow,self.new_after_edit)
def on_delete_clicked(self,obj):
@ -184,10 +183,10 @@ class SourceView:
return
id = store.get_value(iter,1)
source = self.db.get_source(id)
source = self.parent.db.get_source_from_handle(id)
if self.is_used(source):
ans = EditSource.DelSrcQuery(source,self.db,self.build_tree)
ans = EditSource.DelSrcQuery(source,self.parent.db,self.build_tree)
QuestionDialog(_('Delete %s?') % source.get_title(),
_('This source is currently being used. Deleting it '
@ -196,22 +195,22 @@ class SourceView:
_('_Delete Source'),
ans.query_response,self.topWindow)
else:
trans = self.db.start_transaction()
self.db.remove_source_handle(source.get_handle(),trans)
trans = self.parent.db.start_transaction()
self.parent.db.remove_source_handle(source.get_handle(),trans)
n = source.get_title()
self.db.add_transaction(trans,_("Delete Source (%s)") % n)
self.parent.db.add_transaction(trans,_("Delete Source (%s)") % n)
self.build_tree()
def is_used(self,source):
for key in self.db.get_place_handle_keys():
p = self.db.get_place_handle(key)
for key in self.parent.db.get_place_handle_keys():
p = self.parent.db.get_place_from_handle(key)
for sref in p.get_source_references():
if sref.get_base_handle() == source.get_handle():
return 1
for key in self.db.get_person_keys():
p = self.db.get_person(key)
for key in self.parent.db.get_person_keys():
p = self.parent.db.get_person_from_handle(key)
for v_id in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]:
v = self.db.find_event_from_handle(v_id)
v = self.parent.db.find_event_from_handle(v_id)
if v:
for sref in v.get_source_references():
if sref.get_base_handle() == source.get_handle():
@ -228,15 +227,15 @@ class SourceView:
for sref in v.get_source_references():
if sref.get_base_handle() == source.get_handle():
return 1
for p_id in self.db.get_object_keys():
p = self.db.try_to_find_object_from_handle(p_id)
for p_id in self.parent.db.get_object_keys():
p = self.parent.db.get_object_from_handle(p_id)
for sref in p.get_source_references():
if sref.get_base_handle() == source.get_handle():
return 1
for p_id in self.db.get_family_keys():
p = self.db.find_family_from_handle(p_id)
for p_id in self.parent.db.get_family_keys():
p = self.parent.db.find_family_from_handle(p_id)
for v_id in p.get_event_list():
v = self.db.find_event_from_handle(v_id)
v = self.parent.db.find_event_from_handle(v_id)
if v:
for sref in v.get_source_references():
if sref.get_base_handle() == source.get_handle():
@ -251,12 +250,12 @@ class SourceView:
list_store, iter = self.selection.get_selected()
if iter:
id = list_store.get_value(iter,1)
source = self.db.get_source(id)
EditSource.EditSource(source, self.db, self.parent,
source = self.parent.db.get_source_from_handle(id)
EditSource.EditSource(source, self.parent.db, self.parent,
self.topWindow, self.update_display)
def new_after_edit(self,source):
self.db.add_source(source)
self.parent.db.add_source(source)
self.build_tree()
def update_display(self,place):

View File

@ -162,7 +162,7 @@ class SourceSelector:
self.model.clear()
for s in self.list:
base_handle = s.get_base_handle()
base = self.db.try_to_find_source_from_handle(base_handle)
base = self.db.get_source_from_handle(base_handle)
iter = self.model.append()
self.model.set(iter,0,base_handle,1,base.get_title())
@ -244,7 +244,7 @@ class SourceTab:
for s in self.list:
base_handle = s.get_base_handle()
iter = self.model.append()
base = self.db.try_to_find_source_from_handle(base_handle)
base = self.db.get_source_from_handle(base_handle)
self.model.set(iter,0,base_handle,1,base.get_title())
if self.list:
Utils.bold_label(self.parent.sources_label)
@ -335,7 +335,7 @@ class SourceEditor:
self.pub_field = self.get_widget("spubinfo")
if self.source_ref:
self.active_source = self.db.try_to_find_source_from_handle(self.source_ref.get_base_handle())
self.active_source = self.db.get_source_from_handle(self.source_ref.get_base_handle())
else:
self.active_source = None
@ -416,7 +416,7 @@ class SourceEditor:
scom = self.get_widget("scomment")
scom.get_buffer().set_text(self.source_ref.get_comments())
src = self.db.try_to_find_source_from_handle(self.source_ref.get_base_handle())
src = self.db.get_source_from_handle(self.source_ref.get_base_handle())
self.active_source = src
if src:
self.author_field.set_text(src.get_author())
@ -432,7 +432,7 @@ class SourceEditor:
self.list = []
self.active_source = sel
for src_id in keys:
src = self.db.try_to_find_source_from_handle(src_id)
src = self.db.get_source_from_handle(src_id)
l = gtk.Label("%s [%s]" % (src.get_title(),src.get_handle()))
l.show()
l.set_alignment(0,0.5)
@ -454,7 +454,7 @@ class SourceEditor:
def on_sourceok_clicked(self,obj):
if self.active_source != self.db.try_to_find_source_from_handle(self.source_ref.get_base_handle()):
if self.active_source != self.db.get_source_from_handle(self.source_ref.get_base_handle()):
self.source_ref.set_base_handle(self.active_source.get_handle())
date = unicode(self.get_widget("sdate").get_text())

View File

@ -68,7 +68,7 @@ class SubstKeywords:
def __init__(self,database,person_handle):
"""Creates a new object and associates a person with it."""
person = database.try_to_find_person_from_handle(person_handle)
person = database.get_person_from_handle(person_handle)
self.n = person.get_primary_name().get_regular_name()
self.N = person.get_primary_name().get_name()
self.b = ""
@ -86,14 +86,14 @@ class SubstKeywords:
self.b = birth.get_date()
bplace_handle = birth.get_place_handle()
if bplace_handle:
self.B = database.try_to_find_place_from_handle(bplace_handle).get_title()
self.B = database.get_place_from_handle(bplace_handle).get_title()
death_handle = person.get_death_handle()
if death_handle:
death = database.find_event_from_handle(death_handle)
self.d = death.get_date()
dplace_handle = death.get_place_handle()
if dplace_handle:
self.D = database.try_to_find_place_from_handle(dplace_handle).get_title()
self.D = database.get_place_from_handle(dplace_handle).get_title()
self.i = str(person_handle)
if person.get_family_handle_list():
@ -103,12 +103,12 @@ class SubstKeywords:
mother_handle = f.get_mother_handle()
if father_handle == person_handle:
if mother_handle:
mother = database.try_to_find_person_from_handle(mother_handle)
mother = database.get_person_from_handle(mother_handle)
self.s = mother.get_primary_name().get_regular_name()
self.S = mother.get_primary_name().get_name()
else:
if father_handle:
father = database.try_to_find_person_from_handle(father_handle)
father = database.get_person_from_handle(father_handle)
self.s = father.get_primary_name().get_regular_name()
self.S = father.get_primary_name().get_name()
for e_id in f.get_event_list():
@ -119,7 +119,7 @@ class SubstKeywords:
self.m = e.get_date()
mplace_handle = e.get_place_handle()
if mplace_handle:
self.M = database.try_to_find_place_from_handle(mplace_handle).get_title()
self.M = database.get_place_from_handle(mplace_handle).get_title()
def replace(self,line):
"""Returns a new line of text with the substitutions performed."""

View File

@ -123,8 +123,8 @@ def family_name(family,db):
"""Builds a name for the family from the parents names"""
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
father = db.try_to_find_person_from_handle(father_handle)
mother = db.try_to_find_person_from_handle(mother_handle)
father = db.get_person_from_handle(father_handle)
mother = db.get_person_from_handle(mother_handle)
if father and mother:
fname = father.get_primary_name().get_name()
mname = mother.get_primary_name().get_name()
@ -139,8 +139,8 @@ def family_upper_name(family,db):
"""Builds a name for the family from the parents names"""
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
father = db.try_to_find_person_from_handle(father_handle)
mother = db.try_to_find_person_from_handle(mother_handle)
father = db.get_person_from_handle(father_handle)
mother = db.get_person_from_handle(mother_handle)
if father and mother:
fname = father.get_primary_name().get_upper_name()
mname = mother.get_primary_name().get_upper_name()

View File

@ -70,7 +70,7 @@ class WitnessTab:
if s.get_type() == RelLib.Event.ID:
id = s.get_value()
if self.db.has_person_handle(id):
n = self.db.try_to_find_person_from_handle(id).get_primary_name().get_name()
n = self.db.get_person_from_handle(id).get_primary_name().get_name()
else:
n = _('Unknown')
self.model.add([n,s.get_value()],s)
@ -149,7 +149,7 @@ class WitnessEditor:
if self.ref.get_type():
self.in_db.set_active(1)
self.idval = self.ref.get_value()
person = self.db.try_to_find_person_from_handle(self.idval)
person = self.db.get_person_from_handle(self.idval)
self.name.set_text(person.get_primary_name().get_regular_name())
else:
self.name.set_text(self.ref.get_value())

View File

@ -570,7 +570,7 @@ class GedcomWriter:
self.flist = {}
self.slist = {}
for key in self.plist.keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
add_persons_sources(self.db,p,self.slist,self.option_box.private)
for family_handle in p.get_family_handle_list():
add_familys_sources(self.db,family_handle,self.slist,self.option_box.private)
@ -605,7 +605,7 @@ class GedcomWriter:
self.slist = {}
for key in self.plist.keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
add_persons_sources(self.db,p,self.slist,self.private)
for family_handle in p.get_family_handle_list():
add_familys_sources(self.db,family_handle,self.slist,self.private)
@ -686,7 +686,7 @@ class GedcomWriter:
nump = float(len(self.plist))
index = 0.0
for key in pkeys:
self.write_person(self.db.get_person(key))
self.write_person(self.db.get_person_from_handle(key))
index = index + 1
#if index%100 == 0 and not self.cl:
# self.pbar.set_fraction(index/nump)
@ -748,14 +748,14 @@ class GedcomWriter:
self.frefn(family_handle)
person_handle = family.get_father_handle()
if person_handle != None and self.plist.has_key(person_handle):
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
gramps_id = person.get_gramps_id()
self.writeln("1 HUSB @%s@" % gramps_id)
father_alive = person.probably_alive(self.db)
person_handle = family.get_mother_handle()
if person_handle != None and self.plist.has_key(person_handle):
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
gramps_id = person.get_gramps_id()
self.writeln("1 WIFE @%s@" % gramps_id)
mother_alive = person.probably_alive(self.db)
@ -786,7 +786,7 @@ class GedcomWriter:
for person_handle in family.get_child_handle_list():
if not self.plist.has_key(person_handle):
continue
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
self.writeln("1 CHIL @%s@" % person.get_gramps_id())
if self.adopt == GedcomInfo.ADOPT_FTW:
if person.get_main_parents_family_handle() == family.get_handle():
@ -816,7 +816,7 @@ class GedcomWriter:
nump = float(len(self.slist))
index = 0.0
for key in self.slist.keys():
source = self.db.try_to_find_source_from_handle(key)
source = self.db.get_source_from_handle(key)
self.writeln("0 @%s@ SOUR" % self.sid(source.get_handle()))
if source.get_title():
self.writeln("1 TITL %s" % fmtline(self.cnvtxt(source.get_title()),248,1,self.nl))
@ -1008,7 +1008,7 @@ class GedcomWriter:
for photo in photos:
photo_obj_id = photo.get_reference_handle()
photo_obj = self.db.try_to_find_object_from_handle(photo_obj_id)
photo_obj = self.db.get_object_from_handle(photo_obj_id)
if photo_obj and photo_obj.get_mime_type() == "image/jpeg":
self.writeln('1 OBJE')
self.writeln('2 FORM jpeg')
@ -1122,7 +1122,7 @@ class GedcomWriter:
dateobj = event.get_date_object()
self.print_date("2 DATE",dateobj)
if event.get_place_handle():
place_name = self.db.try_to_find_place_from_handle(event.get_place_handle()).get_title()
place_name = self.db.get_place_from_handle(event.get_place_handle()).get_title()
self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(place_name),'\r',' '))
if event.get_cause():
self.writeln("2 CAUS %s" % self.cnvtxt(event.get_cause()))
@ -1141,7 +1141,7 @@ class GedcomWriter:
if ord.get_temple():
self.writeln('%d TEMP %s' % (index+1,ord.get_temple()))
if ord.get_place_handle():
place_name = self.db.try_to_find_place_from_handle(ord.get_place_handle()).get_title()
place_name = self.db.get_place_from_handle(ord.get_place_handle()).get_title()
self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(place_name),'\r',' '))
if ord.get_status() != 0:
self.writeln("2 STAT %s" % self.cnvtxt(statlist[ord.get_status()]))

View File

@ -244,7 +244,7 @@ class XmlWriter:
keys.sort ()
for key in keys:
try:
person = self.db.get_person(key)
person = self.db.get_person_from_handle(key)
except:
print "Key error %s" % key
continue
@ -357,7 +357,7 @@ class XmlWriter:
keys = self.db.get_source_keys ()
keys.sort ()
for key in keys:
source = self.db.get_source(key)
source = self.db.get_source_from_handle(key)
if self.callback and count % delta == 0:
self.callback(float(count)/float(total))
count = count + 1
@ -392,7 +392,7 @@ class XmlWriter:
self.g.write(" <objects>\n")
objList.sort ()
for key in self.db.get_object_keys():
object = self.db.try_to_find_object_from_handle(key)
object = self.db.get_object_from_handle(key)
self.write_object(object)
self.g.write(" </objects>\n")
@ -508,7 +508,7 @@ class XmlWriter:
self.g.write('%s</lds_ord>\n' % sp)
def dump_source_ref(self,source_ref,index=1):
source = self.db.try_to_find_source_from_handle(source_ref.get_base_handle())
source = self.db.get_source_from_handle(source_ref.get_base_handle())
if source:
p = source_ref.get_page()
c = source_ref.get_comments()

View File

@ -37,6 +37,16 @@ import os
from gettext import gettext as _
from TransTable import TransTable
#-------------------------------------------------------------------------
#
# Mime Types
#
#-------------------------------------------------------------------------
app_gramps = "application/x-gramps"
app_gramps_xml = "application/x-gramps-xml"
app_gedcom = "application/x-gedcom"
#-------------------------------------------------------------------------
#
# Paths to external programs
@ -473,12 +483,6 @@ family_relations = [
#
#
#-------------------------------------------------------------------------
def relationship_def(txt):
if _frel2def.has_key(txt):
return _frel2def[txt]
else:
return _("No definition available")
def display_frel(st):
return family_relations.find_value(st)

View File

@ -126,6 +126,7 @@ dist_pkgdata_DATA = \
gnome-mime-application-x-gramps.png \
gnome-mime-application-x-gedcom.png \
gnome-mime-application-x-gramps-package.png \
gnome-mime-application-x-gramps-xml.png \
gramps.applications \
gramps.desktop \
gramps.svg \

View File

@ -153,16 +153,26 @@ class Gramps:
# Don't show main window until ArgHandler is done.
# This prevents a window from annoyingly popping up when
# the command line args are sufficient to operate without it.
GrampsCfg.client.notify_add("/apps/gramps/researcher",self.researcher_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/statusbar",self.statusbar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/toolbar",self.toolbar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/toolbar-on",self.toolbar_on_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/filter",self.filter_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/view",self.sidebar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/familyview",self.familyview_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/name-format",self.familyview_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/date-format",self.date_format_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/date-entry",self.date_entry_key_update)
GrampsCfg.client.notify_add("/apps/gramps/researcher",
self.researcher_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/statusbar",
self.statusbar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/toolbar",
self.toolbar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/toolbar-on",
self.toolbar_on_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/filter",
self.filter_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/view",
self.sidebar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/familyview",
self.familyview_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/name-format",
self.familyview_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/date-format",
self.date_format_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/date-entry",
self.date_entry_key_update)
self.topWindow.show()
if GrampsCfg.get_usetips():
@ -399,7 +409,7 @@ class Gramps:
def undo(self,*args):
self.db.undo()
if self.active_person:
p = self.db.try_to_find_person_from_handle(self.active_person.get_handle())
p = self.db.get_person_from_handle(self.active_person.get_handle())
self.change_active_person(p)
self.place_view.change_db(self.db)
self.people_view.change_db(self.db)
@ -514,7 +524,7 @@ class Gramps:
break
if pid not in haveit:
haveit.append(pid)
person = self.db.get_person(pid)
person = self.db.get_person_from_handle(pid)
item = gtk.MenuItem("_%d. %s [%s]" %
(num,person.get_primary_name().get_name(),pid))
item.connect("activate",self.bookmark_callback,person.get_handle())
@ -546,7 +556,7 @@ class Gramps:
hotkey = "_%s" % chr(ord('a')+num-11)
elif num >= 21:
break
person = self.db.try_to_find_person_from_handle(pid)
person = self.db.get_person_from_handle(pid)
item = gtk.MenuItem("%s. %s [%s]" %
(hotkey,person.get_primary_name().get_name(),pid))
item.connect("activate",self.back_clicked,num)
@ -574,7 +584,7 @@ class Gramps:
hotkey = "_%s" % chr(ord('a')+num-11)
elif num >= 21:
break
person = self.db.get_person(pid)
person = self.db.get_person_from_handle(pid)
item = gtk.MenuItem("%s. %s [%s]" %
(hotkey,person.get_primary_name().get_name(),pid))
item.connect("activate",self.fwd_clicked,num)
@ -602,7 +612,7 @@ class Gramps:
if self.hindex > 0:
try:
self.hindex -= step
self.active_person = self.db.get_person(self.history[self.hindex])
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
self.modify_statusbar()
self.update_display(0)
self.mhistory.append(self.history[self.hindex])
@ -628,7 +638,7 @@ class Gramps:
if self.hindex+1 < len(self.history):
try:
self.hindex += step
self.active_person = self.db.get_person(self.history[self.hindex])
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
self.modify_statusbar()
self.update_display(0)
self.mhistory.append(self.history[self.hindex])
@ -803,8 +813,8 @@ class Gramps:
ErrorDialog(msg,msg2)
else:
import MergeData
p1 = self.db.get_person(mlist[0])
p2 = self.db.get_person(mlist[1])
p1 = self.db.get_person_from_handle(mlist[0])
p2 = self.db.get_person_from_handle(mlist[1])
MergeData.MergePeople(self,self.db,p1,p2,self.merge_update,
self.update_after_edit)
elif page == PLACE_VIEW:
@ -1061,7 +1071,7 @@ class Gramps:
#-------------------------------------------------------------------------
def remove_clicked():
# File is lost => remove all references and the object itself
mobj = self.db.try_to_find_object_from_handle(ObjectId)
mobj = self.db.get_object_from_handle(ObjectId)
for p in self.db.get_family_handle_map().values():
nl = p.get_media_list()
for o in nl:
@ -1069,21 +1079,21 @@ class Gramps:
nl.remove(o)
p.set_media_list(nl)
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == ObjectId:
nl.remove(o)
p.set_media_list(nl)
for key in self.db.get_source_keys():
p = self.db.get_source(key)
p = self.db.get_source_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == ObjectId:
nl.remove(o)
p.set_media_list(nl)
for key in self.db.get_place_handle_keys():
p = self.db.get_place_handle(key)
p = self.db.get_place_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == ObjectId:
@ -1117,13 +1127,13 @@ class Gramps:
name = choose.get_filename()
if os.path.isfile(name):
RelImage.import_media_object(name,filename,base)
object = self.db.try_to_find_object_from_handle(ObjectId)
object = self.db.get_object_from_handle(ObjectId)
object.set_path(name)
choose.destroy()
#-------------------------------------------------------------------------
for ObjectId in self.db.get_object_keys():
object = self.db.try_to_find_object_from_handle(ObjectId)
object = self.db.get_object_from_handle(ObjectId)
if 0:
oldfile = object.get_path()
(base,ext) = os.path.splitext(os.path.basename(oldfile))
@ -1181,7 +1191,7 @@ class Gramps:
mlist = [ self.active_person.get_handle() ]
for sel in mlist:
p = self.db.get_person(sel)
p = self.db.get_person_from_handle(sel)
self.active_person = p
name = GrampsCfg.get_nameof()(p)
@ -1211,7 +1221,7 @@ class Gramps:
if self.active_person.get_handle() == family.get_father_handle():
if family.get_mother_handle() == None:
for child_handle in family.get_child_handle_list():
child = self.db.try_to_find_person_from_handle(child_handle)
child = self.db.get_person_from_handle(child_handle)
child.remove_parent_family_handle(family.get_handle())
self.db.commit_person(child,trans)
self.db.delete_family(family.get_handle(),trans)
@ -1220,7 +1230,7 @@ class Gramps:
else:
if family.get_father_handle() == None:
for child_handle in family.get_child_handle_list():
child = self.db.try_to_find_person_from_handle(child_handle)
child = self.db.get_person_from_handle(child_handle)
child.remove_parent_family_handle(family)
self.db.commit_person(child,trans)
self.db.delete_family(family,trans)
@ -1240,7 +1250,7 @@ class Gramps:
self.db.remove_person_handle(id, trans)
if self.hindex >= 0:
self.active_person = self.db.try_to_find_person_from_handle(self.history[self.hindex])
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
else:
self.change_active_person(None)
self.db.add_transaction(trans,_("Delete Person (%s)") % n)
@ -1265,7 +1275,7 @@ class Gramps:
self.modify_statusbar()
elif self.active_person == None or \
person.get_handle() != self.active_person.get_handle():
self.active_person = self.db.try_to_find_person_from_handle(person.get_handle())
self.active_person = self.db.get_person_from_handle(person.get_handle())
self.modify_statusbar()
self.set_buttons(1)
if person:
@ -1291,7 +1301,7 @@ class Gramps:
self.backbtn.set_sensitive(0)
self.back.set_sensitive(0)
else:
self.active_person = self.db.try_to_find_person_from_handle(person.get_handle())
self.active_person = self.db.get_person_from_handle(person.get_handle())
self.set_buttons(1)
def modify_statusbar(self):
@ -1327,9 +1337,6 @@ class Gramps:
DisplayTrace.DisplayTrace()
return ""
def fs_close_window(self,obj):
self.filesel.destroy()
def on_open_activate(self,obj):
prompter = DbPrompter.ExistingDbPrompter(self,self.topWindow)
prompter.chooser()
@ -1515,7 +1522,7 @@ class Gramps:
the_ids = self.db.get_person_keys()
if the_ids:
the_ids.sort()
person = self.db.get_person(the_ids[0])
person = self.db.get_person_from_handle(the_ids[0])
return person
def load_database(self,name):
@ -1571,7 +1578,7 @@ class Gramps:
def bookmark_callback(self,obj,person_handle):
old_person = self.active_person
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
try:
self.change_active_person(person)
self.update_display(0)

View File

@ -111,7 +111,7 @@ class AncestorChart:
self.lines = max(self.lines,len(self.text[index]))
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = self.database.find_family_from_handle(family_handle)
@ -322,7 +322,7 @@ class AncestorChartBareDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -394,7 +394,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
disp_format = options[2]
return AncestorChart(database, person, max_gen,

View File

@ -225,7 +225,7 @@ class AncestorChart:
self.lines = max(self.lines,len(self.text[index]))
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = self.database.find_family_from_handle(family_handle)
@ -548,7 +548,7 @@ class AncestorChartBareDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -672,7 +672,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
disp_format = options[2]
if options[3]:

View File

@ -69,7 +69,7 @@ class AncestorReport(Report.Report):
return
self.map[index] = person_handle
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = self.database.find_family_from_handle(family_handle)
@ -105,7 +105,7 @@ class AncestorReport(Report.Report):
self.doc.start_paragraph("AHN-Entry","%s." % str(key))
person_handle = self.map[key]
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
name = person.get_primary_name().get_regular_name()
self.doc.start_bold()
@ -124,7 +124,7 @@ class AncestorReport(Report.Report):
date = birth.get_date_object().get_start_date()
place_handle = birth.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle).get_title()
place = self.database.get_place_from_handle(place_handle).get_title()
else:
place = u''
if place[-1:] == '.':
@ -159,7 +159,7 @@ class AncestorReport(Report.Report):
date = death.get_date_object().get_start_date()
place_handle = death.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle).get_title()
place = self.database.get_place_from_handle(place_handle).get_title()
else:
place = u''
if place[-1:] == '.':
@ -204,7 +204,7 @@ class AncestorReport(Report.Report):
date = buried.get_date_object().get_start_date()
place_handle = buried.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle).get_title()
place = self.database.get_place_from_handle(place_handle).get_title()
else:
place = u''
if place[-1:] == '.':
@ -325,7 +325,7 @@ class AncestorBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -387,7 +387,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
return AncestorReport(database, person, max_gen, pg_brk, doc, None, newpage )

View File

@ -138,7 +138,7 @@ class ComprehensiveAncestorsReport (Report.Report):
i = 1
for source_handle in self.sources:
source = self.database.try_to_find_source_from_handle(source_handle)
source = self.database.get_source_from_handle(source_handle)
self.doc.start_paragraph ("AR-Entry")
self.doc.write_text ("[%d] %s" % (i, source.get_title ()))
author = source.get_author ()
@ -186,8 +186,8 @@ class ComprehensiveAncestorsReport (Report.Report):
return ret
father_handle = family.get_father_handle ()
mother_handle = family.get_mother_handle ()
father = self.database.try_to_find_person_from_handle(father_handle)
mother = self.database.try_to_find_person_from_handle(mother_handle)
father = self.database.get_person_from_handle(father_handle)
mother = self.database.get_person_from_handle(mother_handle)
if father:
ret.extend (self.person (father_handle,
short_form = father_handle in already_described,
@ -209,7 +209,7 @@ class ComprehensiveAncestorsReport (Report.Report):
ret.append ((self.doc.end_paragraph, []))
for child_handle in children_ids:
child = self.database.try_to_find_person_from_handle(child_handle)
child = self.database.get_person_from_handle(child_handle)
ret.extend (self.person (child_handle, suppress_children = 1,
short_form=child_handle in already_described,
already_described = already_described,
@ -232,7 +232,7 @@ class ComprehensiveAncestorsReport (Report.Report):
break
relstring = self.relationship.get_grandparents_string (self.start,
self.database.try_to_find_person_from_handle(self.gp))[0]
self.database.get_person_from_handle(self.gp))[0]
heading = _("%(name)s's maternal %(grandparents)s") % \
{ 'name': self.first_name_or_nick (self.start),
'grandparents': relstring }
@ -255,7 +255,7 @@ class ComprehensiveAncestorsReport (Report.Report):
break
relstring = self.relationship.get_grandparents_string (self.start,
self.database.try_to_find_person_from_handle(self.gp))[0]
self.database.get_person_from_handle(self.gp))[0]
if thisgen == 2:
heading = _("%(name)s's %(parents)s") % \
{ 'name': self.first_name_or_nick (self.start),
@ -274,7 +274,7 @@ class ComprehensiveAncestorsReport (Report.Report):
for family_handle in family_handles:
family = self.database.find_family_from_handle(family_handle)
father_handle = family.get_father_handle ()
father = self.database.try_to_find_person_from_handle(father_handle)
father = self.database.get_person_from_handle(father_handle)
if father:
already_described.append (father_handle)
father_family_handle = father.get_main_parents_family_handle ()
@ -283,7 +283,7 @@ class ComprehensiveAncestorsReport (Report.Report):
next_pfamily_handles.append (father_family_handle)
mother_handle = family.get_mother_handle ()
mother = self.database.try_to_find_person_from_handle(mother_handle)
mother = self.database.get_person_from_handle(mother_handle)
if mother:
already_described.append (mother_handle)
mother_family_handle = mother.get_main_parents_family_handle ()
@ -302,7 +302,7 @@ class ComprehensiveAncestorsReport (Report.Report):
needs_name = 0,
from_family = None):
ret = []
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
name = self.person_name (person_handle)
if name:
photos = person.get_media_list ()
@ -335,7 +335,7 @@ class ComprehensiveAncestorsReport (Report.Report):
family = self.database.find_family_from_handle(family_handle)
for partner_id in [family.get_father_handle (),
family.get_mother_handle ()]:
partner = self.database.try_to_find_person_from_handle(partner_id)
partner = self.database.get_person_from_handle(partner_id)
if partner_id == person_handle or not partner:
continue
@ -344,7 +344,7 @@ class ComprehensiveAncestorsReport (Report.Report):
partner != from_family_mother)):
for media_ref in partner.get_media_list ()[:1]:
object_handle = media_ref.get_reference_handle()
mobject = self.database.try_to_find_object_from_handle(object_handle)
mobject = self.database.get_object_from_handle(object_handle)
if mobject.get_mime_type()[0:5] == "image":
spouse.append ((self.doc.add_media_object,
[mobject.get_path (),
@ -377,7 +377,7 @@ class ComprehensiveAncestorsReport (Report.Report):
ret.append ((self.doc.start_cell, ["AR-Photo"]))
for media_ref in photos[:1]:
object_handle = media_ref.get_reference_handle()
mobject = self.database.try_to_find_object_from_handle(object_handle)
mobject = self.database.get_object_from_handle(object_handle)
if mobject.get_mime_type()[0:5] == "image":
ret.append ((self.doc.add_media_object,
[mobject.get_path (), 'left', 2, 2]))
@ -452,7 +452,7 @@ class ComprehensiveAncestorsReport (Report.Report):
info += _(' in %(month_or_year)s') % \
{'month_or_year': dateobj.get_date ()}
placename = self.database.try_to_find_place_from_handle(event.get_place_handle()).get_title()
placename = self.database.get_place_from_handle(event.get_place_handle()).get_title()
if placename:
info += _(' in %(place)s') % {'place': placename}
note = event.get_note ()
@ -531,7 +531,7 @@ class ComprehensiveAncestorsReport (Report.Report):
def parents_of (self, person_handle):
ret = '. '
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
gender = person.get_gender ()
family_handle = person.get_main_parents_family_handle ()
@ -540,11 +540,11 @@ class ComprehensiveAncestorsReport (Report.Report):
fathername = mothername = None
father_handle = family.get_father_handle ()
if father_handle:
#father = self.database.try_to_find_person_from_handle(father_handle)
#father = self.database.get_person_from_handle(father_handle)
fathername = self.person_name (father_handle)
mother_handle = family.get_mother_handle ()
if mother_handle:
#mother = self.database.try_to_find_person_from_handle(mother_handle)
#mother = self.database.get_person_from_handle(mother_handle)
mothername = self.person_name (mother_handle)
if not mother_handle and not father_handle:
@ -632,7 +632,7 @@ class ComprehensiveAncestorsReport (Report.Report):
return citation
def person_name (self, person_handle):
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
primary = person.get_primary_name ()
name = primary.get_title ()
@ -683,9 +683,9 @@ class ComprehensiveAncestorsReport (Report.Report):
for family_handle in person.get_family_handle_list ():
family = self.database.find_family_from_handle(family_handle)
mother_handle = family.get_mother_handle ()
mother = self.database.try_to_find_person_from_handle(mother_handle)
mother = self.database.get_person_from_handle(mother_handle)
for spouse_id in [family.get_father_handle (), mother_handle]:
spouse = self.database.try_to_find_person_from_handle(spouse_id)
spouse = self.database.get_person_from_handle(spouse_id)
if spouse_id == person.get_handle() or not spouse_id:
continue
@ -702,7 +702,7 @@ class ComprehensiveAncestorsReport (Report.Report):
count = 1
for child_handle in childlist:
child = self.database.try_to_find_person_from_handle(child_handle)
child = self.database.get_person_from_handle(child_handle)
children += self.first_name_or_nick (child)
children += self.cite_sources (child.get_primary_name ().
get_source_references ())
@ -997,7 +997,7 @@ class ComprehensiveAncestorsBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -1070,7 +1070,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
opt_cite = int(options[3])

View File

@ -679,7 +679,7 @@ class BookReportSelector:
if data[1] == _("Title"):
data.append(_("Not Applicable"))
else:
pname = self.db.try_to_find_person_from_handle(options[0])
pname = self.db.get_person_from_handle(options[0])
data.append(pname.get_primary_name().get_regular_name())
self.bk_model.add(data)

View File

@ -80,7 +80,7 @@ class ChangeTypes:
new = unicode(self.auto2.child..get_text())
for person_handle in self.db.get_person_keys():
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
for event_handle in person.get_event_list():
if not event_handle:
continue

View File

@ -98,9 +98,9 @@ class CheckIntegrity:
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
if father_handle:
father = self.db.try_to_find_person_from_handle(father_handle)
father = self.db.get_person_from_handle(father_handle)
if mother_handle:
mother = self.db.try_to_find_person_from_handle(mother_handle)
mother = self.db.get_person_from_handle(mother_handle)
if father_handle and family_handle not in father.get_family_handle_list():
self.broken_parent_links.append((father_handle,family_handle))
@ -111,7 +111,7 @@ class CheckIntegrity:
mother.add_family_handle(family_handle)
self.db.commit_person(mother,self.trans)
for child_handle in family.get_child_handle_list():
child = self.db.try_to_find_person_from_handle(child_handle)
child = self.db.get_person_from_handle(child_handle)
if family_handle == child.get_main_parents_family_handle():
continue
for family_type in child.get_parent_family_handle_list():
@ -128,7 +128,7 @@ class CheckIntegrity:
def remove_clicked():
# File is lost => remove all references and the object itself
for person_handle in self.db.get_family_keys():
p = self.db.try_to_find_person_from_handle(person_handle)
p = self.db.get_person_from_handle(person_handle)
nl = p.get_media_list()
changed = 0
for o in nl:
@ -140,7 +140,7 @@ class CheckIntegrity:
self.db.commit_person(p,self.trans)
for key in self.db.get_person_keys():
p = self.db.try_to_find_person_from_handle(key)
p = self.db.get_person_from_handle(key)
nl = p.get_media_list()
changed = 0
for o in nl:
@ -152,7 +152,7 @@ class CheckIntegrity:
self.db.commit_person(p,self.trans)
for key in self.db.get_source_keys():
p = self.db.try_to_find_source_from_handle(key)
p = self.db.get_source_from_handle(key)
nl = p.get_media_list()
changed = 0
for o in nl:
@ -207,7 +207,7 @@ class CheckIntegrity:
#-------------------------------------------------------------------------
for ObjectId in self.db.get_object_keys():
obj = self.db.try_to_find_object_from_handle(ObjectId)
obj = self.db.get_object_from_handle(ObjectId)
photo_name = obj.get_path()
if not os.path.isfile(photo_name):
if cl:
@ -240,7 +240,7 @@ class CheckIntegrity:
def delete_empty_family(self,family_handle):
for key in self.db.get_person_keys():
child = self.db.try_to_find_person_from_handle(key)
child = self.db.get_person_from_handle(key)
child.remove_parent_family_handle(family_handle)
child.remove_family_handle(family_handle)
self.db.delete_family(family_handle,self.trans)
@ -251,9 +251,9 @@ class CheckIntegrity:
mother_handle = family.get_mother_handle()
father_handle = family.get_father_handle()
if father_handle:
father = self.db.try_to_find_person_from_handle(father_handle)
father = self.db.get_person_from_handle(father_handle)
if mother_handle:
mother = self.db.try_to_find_person_from_handle(mother_handle)
mother = self.db.get_person_from_handle(mother_handle)
type = family.get_relationship()
if not father_handle and not mother_handle:
@ -316,11 +316,11 @@ class CheckIntegrity:
else:
self.text.write(_("%d broken child/family links were found\n") % blink)
for (person_handle,family_handle) in self.broken_links:
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
family = self.db.find_family_from_handle(family_handle)
cn = person.get_primary_name().get_name()
f = self.db.try_to_find_person_from_handle(family.get_father_handle())
m = self.db.try_to_find_person_from_handle(family.get_mother_handle())
f = self.db.get_person_from_handle(family.get_father_handle())
m = self.db.get_person_from_handle(family.get_mother_handle())
if f and m:
pn = _("%s and %s") % (f.get_primary_name().get_name(),\
m.get_primary_name().get_name())
@ -339,11 +339,11 @@ class CheckIntegrity:
else:
self.text.write(_("%d broken spouse/family links were found\n") % plink)
for (person_handle,family_handle) in self.broken_parent_links:
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
family = self.db.find_family_from_handle(family_handle)
cn = person.get_primary_name().get_name()
f = self.db.try_to_find_person_from_handle(family.get_father_handle())
m = self.db.try_to_find_person_from_handle(family.get_mother_handle())
f = self.db.get_person_from_handle(family.get_father_handle())
m = self.db.get_person_from_handle(family.get_mother_handle())
if f and m:
pn = _("%s and %s") % (f.get_primary_name().get_name(),\
m.get_primary_name().get_name())

View File

@ -67,7 +67,7 @@ class CountAncestors:
temp = thisgen
thisgen = []
for person_handle in temp:
person = database.try_to_find_person_from_handle(person_handle)
person = database.get_person_from_handle(person_handle)
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = database.find_family_from_handle(family_handle)

View File

@ -141,7 +141,7 @@ class CustomTextDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -259,7 +259,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
top_text = options[1]
middle_text = options[2]
bottom_text = options[3]

View File

@ -402,7 +402,7 @@ class DescendantGraphBareDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -472,7 +472,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
disp_format = options[1]
return DescendantReport(database, person,
disp_format, doc, None, newpage )

View File

@ -118,7 +118,7 @@ class DesBrowse:
def add_to_tree(self,parent_id,sib_id,person_handle):
item_id = self.model.insert_after(parent_id,sib_id)
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
self.model.set(item_id,0,GrampsCfg.get_nameof()(person))
self.model.set(item_id,1,person_handle)
prev_id = None
@ -135,7 +135,7 @@ class DesBrowse:
store,iter = self.tree.get_selection().get_selected()
if iter:
person_handle = store.get_value(iter,1)
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
EditPerson.EditPerson(self.parent,person,self.db,self.callback)
#------------------------------------------------------------------------

View File

@ -133,7 +133,7 @@ class DescendantReport:
childlist.sort(self.by_birthdate)
for child_handle in childlist:
child = self.database.try_to_find_person_from_handle(child_handle)
child = self.database.get_person_from_handle(child_handle)
self.dump(level+1,child)
#------------------------------------------------------------------------
@ -216,7 +216,7 @@ class DescendantBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
@ -279,7 +279,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
return DescendantReport(database, person, max_gen,

View File

@ -79,7 +79,7 @@ class DetAncestorReport(Report.Report):
return
self.map[index] = person_handle
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = self.database.find_family_from_handle(family_handle)
@ -116,14 +116,14 @@ class DetAncestorReport(Report.Report):
self.doc.start_paragraph("DAR-ChildTitle")
mother_handle = family.get_mother_handle()
if mother_handle:
mother_obj = self.database.try_to_find_person_from_handle(mother_handle)
mother_obj = self.database.get_person_from_handle(mother_handle)
mother = mother_obj.get_primary_name().get_regular_name()
else:
mother = _("unknown")
father_handle = family.get_father_handle()
if father_handle:
father_obj = self.database.try_to_find_person_from_handle(father_handle)
father_obj = self.database.get_person_from_handle(father_handle)
father = father_obj.get_primary_name().get_regular_name()
else:
father = _("unknown")
@ -137,7 +137,7 @@ class DetAncestorReport(Report.Report):
for child_handle in family.get_child_handle_list():
self.doc.start_paragraph("DAR-ChildList")
child = self.database.try_to_find_person_from_handle(child_handle)
child = self.database.get_person_from_handle(child_handle)
name = child.get_primary_name().get_regular_name()
birth_handle = child.get_birth_handle()
death_handle = child.get_death_handle()
@ -157,10 +157,10 @@ class DetAncestorReport(Report.Report):
if birth and birth.get_date():
if birth.get_place_handle():
bplace = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title()
bplace = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
if death and death.get_date():
if death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
(name, birth.get_date(), bplace,
death.get_date(), dplace)) # f
@ -169,7 +169,7 @@ class DetAncestorReport(Report.Report):
(name, birth.get_date(), bplace,
death.get_date())) # e
elif death and death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
(name, birth.get_date(), bplace,
dplace)) # d
@ -179,7 +179,7 @@ class DetAncestorReport(Report.Report):
else:
if death and death.get_date():
if death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
(name, birth.get_date(), death.get_date(), \
dplace)) # b
@ -187,7 +187,7 @@ class DetAncestorReport(Report.Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.get_date(), death.get_date())) # a
elif death and death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.get_date(), dplace)) # 9
else:
@ -195,10 +195,10 @@ class DetAncestorReport(Report.Report):
(name, birth.get_date())) # 8
else:
if birth and birth.get_place_handle():
bplace = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title()
bplace = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
if death and death.get_date():
if death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
(name, bplace, \
death.get_date(), dplace)) # 7
@ -206,7 +206,7 @@ class DetAncestorReport(Report.Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, bplace, death.get_date())) # 6
elif death and death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, bplace, dplace)) # 5
else:
@ -215,14 +215,14 @@ class DetAncestorReport(Report.Report):
else:
if death and death.get_date():
if death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Died: %s %s") % \
(name, death.get_date(), dplace)) # 3
else:
self.doc.write_text(_("- %s Died: %s") % \
(name, death.get_date())) # 2
elif death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Died: %s") % \
(name, dplace)) # 1
else:
@ -234,7 +234,7 @@ class DetAncestorReport(Report.Report):
"""Output birth, death, parentage, marriage and notes information """
person_handle = self.map[key]
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
if rptOptions.addImages == reportOptions.Yes:
self.insert_images(person)
@ -305,7 +305,7 @@ class DetAncestorReport(Report.Report):
birth = self.database.find_event_from_handle(birth_handle)
date = birth.get_date_object().get_start_date()
if birth.get_place_handle():
place = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title()
place = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
if place[-1:] == '.':
place = place[:-1]
elif rptOptions.blankDate == reportOptions.Yes:
@ -364,7 +364,7 @@ class DetAncestorReport(Report.Report):
death = self.database.find_event_from_handle(death_handle)
date = death.get_date_object().get_start_date()
if death.get_place_handle():
place = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
place = self.database.get_place_from_handle(death.get_place_handle()).get_title()
if place[-1:] == '.':
place = place[:-1]
elif rptOptions.blankPlace == reportOptions.Yes:
@ -447,12 +447,12 @@ class DetAncestorReport(Report.Report):
if ext_family_handle:
ext_family = self.database.find_family_from_handle(ext_family_handle)
if ext_family.get_father_handle():
father_obj = self.database.try_to_find_person_from_handle(ext_family.get_father_handle())
father_obj = self.database.get_person_from_handle(ext_family.get_father_handle())
father = father_obj.get_primary_name().get_regular_name()
else:
father= ""
if ext_family.get_mother_handle():
mother_obj = self.database.try_to_find_person_from_handle(ext_family.get_mother_handle())
mother_obj = self.database.get_person_from_handle(ext_family.get_mother_handle())
mother = mother_obj.get_primary_name().get_regular_name()
else:
mother= ""
@ -503,7 +503,7 @@ class DetAncestorReport(Report.Report):
t= ""
if person.get_gender() == RelLib.Person.male:
if fam.get_mother_handle():
mother = self.database.try_to_find_person_from_handle(fam.get_mother_handle())
mother = self.database.get_person_from_handle(fam.get_mother_handle())
spouse = mother.get_primary_name().get_regular_name()
if fam_num == 1:
heshe= _("He")
@ -518,7 +518,7 @@ class DetAncestorReport(Report.Report):
else: heshe= _("and she")
if fam.get_father_handle():
father = self.database.try_to_find_person_from_handle(fam.get_father_handle())
father = self.database.get_person_from_handle(fam.get_father_handle())
spouse = father.get_primary_name().get_regular_name()
for event_handle in fam.get_event_list():
@ -534,7 +534,7 @@ class DetAncestorReport(Report.Report):
place = ""
if marriage:
if marriage.get_place_handle():
place = self.database.try_to_find_place_from_handle(marriage.get_place_handle()).get_title()
place = self.database.get_place_from_handle(marriage.get_place_handle()).get_title()
elif rptOptions.blankPlace == reportOptions.Yes:
place= "____________"
@ -584,7 +584,7 @@ class DetAncestorReport(Report.Report):
if mate.get_gender() == RelLib.Person.male:
if fam.get_mother_handle():
ind_id= fam.get_mother_handle()
ind = self.database.try_to_find_person_from_handle(ind_id)
ind = self.database.get_person_from_handle(ind_id)
person = ind.get_primary_name().get_regular_name()
firstName = ind.get_primary_name().get_first_name()
heshe = _("She")
@ -592,7 +592,7 @@ class DetAncestorReport(Report.Report):
heshe= _("He")
if fam.get_father_handle():
ind_id = fam.get_father_handle()
ind = self.database.try_to_find_person_from_handle(ind_id)
ind = self.database.get_person_from_handle(ind_id)
person = ind.get_primary_name().get_regular_name()
firstName = ind.get_primary_name().get_first_name()
@ -629,7 +629,7 @@ class DetAncestorReport(Report.Report):
photos = person.get_media_list()
for photo in photos :
object_handle = photo.get_reference_handle()
object = self.database.try_to_find_object_from_handle(object_handle)
object = self.database.get_object_from_handle(object_handle)
if object.get_mime_type()[0:5] == "image":
file = object.get_path()
self.doc.add_media_object(file,"row",4.0,4.0)
@ -672,7 +672,7 @@ class DetAncestorReport(Report.Report):
self.genIDs.clear()
person_handle = self.map[key]
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
self.genIDs[person_handle]= key
dupPerson= self.write_person(key, rptOpt)
if dupPerson == 0: # Is this a duplicate ind record
@ -989,7 +989,7 @@ class DetAncestorBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -1178,7 +1178,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
rptOpt = reportOptions(database)

View File

@ -85,7 +85,7 @@ class DetDescendantReport(Report.Report):
else:
self.genKeys[cur_gen-1].append(index)
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
for family_handle in person.get_family_handle_list():
family = self.database.find_family_from_handle(family_handle)
for child_handle in family.get_child_handle_list():
@ -122,12 +122,12 @@ class DetDescendantReport(Report.Report):
self.doc.start_paragraph("DDR-ChildTitle")
mother_handle = family.get_mother_handle()
if mother_handle:
mother = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name()
mother = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
else:
mother = _("unknown")
father_handle = family.get_father_handle()
if father_handle:
father = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name()
father = self.database.get_person_from_handle(father_handle).get_primary_name().get_regular_name()
else:
father = _("unknown")
self.doc.start_bold()
@ -139,7 +139,7 @@ class DetDescendantReport(Report.Report):
self.doc.end_paragraph()
for child_handle in family.get_child_handle_list():
child = self.database.try_to_find_person_from_handle(child_handle)
child = self.database.get_person_from_handle(child_handle)
self.doc.start_paragraph("DDR-ChildList")
name = child.get_primary_name().get_regular_name()
birth_handle = child.get_birth_handle()
@ -160,10 +160,10 @@ class DetDescendantReport(Report.Report):
if birth and birth.get_date():
if birth.get_place_handle():
bplace = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title()
bplace = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
if death and death.get_date():
if death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
(name, birth.get_date(), bplace,
death.get_date(), dplace)) # f
@ -172,7 +172,7 @@ class DetDescendantReport(Report.Report):
(name, birth.get_date(), bplace,
death.get_date())) # e
elif death and death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
(name, birth.get_date(), bplace,
dplace)) # d
@ -181,7 +181,7 @@ class DetDescendantReport(Report.Report):
else:
if death and death.get_date():
if death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
(name, birth.get_date(), death.get_date(), \
dplace)) # b
@ -189,7 +189,7 @@ class DetDescendantReport(Report.Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.get_date(), death.get_date())) # a
elif death and death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.get_date(), dplace)) # 9
else:
@ -197,10 +197,10 @@ class DetDescendantReport(Report.Report):
(name, birth.get_date())) # 8
else:
if birth and birth.get_place_handle():
bplace = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title()
bplace = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
if death and death.get_date():
if death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
(name, bplace, \
death.get_date(), dplace)) # 7
@ -208,7 +208,7 @@ class DetDescendantReport(Report.Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, bplace, death.get_date())) # 6
elif death and death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, bplace, dplace)) # 5
else:
@ -217,14 +217,14 @@ class DetDescendantReport(Report.Report):
else:
if death and death.get_date():
if death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Died: %s %s") % \
(name, death.get_date(), dplace)) # 3
else:
self.doc.write_text(_("- %s Died: %s") % \
(name, death.get_date())) # 2
elif death and death.get_place_handle():
dplace = self.database.try_to_find_place_from_handle(death.get_place_handle()).get_title()
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
self.doc.write_text(_("- %s Died: %s") % \
(name, dplace)) # 1
else:
@ -236,7 +236,7 @@ class DetDescendantReport(Report.Report):
"""Output birth, death, parentage, marriage and notes information """
person_handle = self.map[key]
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
if rptOptions.addImages == reportOptions.Yes:
self.insert_images(person)
@ -306,7 +306,7 @@ class DetDescendantReport(Report.Report):
birth = self.database.find_event_from_handle(birth_handle)
date = birth.get_date_object().get_start_date()
if birth.get_place_handle():
place = self.database.try_to_find_place_from_handle(birth.get_place_handle()).get_title()
place = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
if place[-1:] == '.':
place = place[:-1]
elif rptOptions.blankDate == reportOptions.Yes:
@ -363,7 +363,7 @@ class DetDescendantReport(Report.Report):
date = death.get_date_object().get_start_date()
place_handle = death.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle).get_title()
place = self.database.get_place_from_handle(place_handle).get_title()
if place[-1:] == '.':
place = place[:-1]
elif rptOptions.blankPlace == reportOptions.Yes:
@ -450,12 +450,12 @@ class DetDescendantReport(Report.Report):
ext_family = self.database.find_family_from_handle(ext_family_handle)
father_handle = ext_family.get_father_handle()
if father_handle:
father = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name()
father = self.database.get_person_from_handle(father_handle).get_primary_name().get_regular_name()
else:
father = ""
mother_handle = ext_family.get_father_handle()
if mother_handle:
mother = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name()
mother = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
else:
mother = ""
@ -501,7 +501,7 @@ class DetDescendantReport(Report.Report):
if person.get_gender() == RelLib.Person.male:
mother_handle = fam.get_mother_handle()
if mother_handle:
spouse = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name()
spouse = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
if fam_num == 1:
heshe = _("He")
elif fam_num < len(famList):
@ -518,7 +518,7 @@ class DetDescendantReport(Report.Report):
father_handle = fam.get_father_handle()
if father_handle:
spouse = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name()
spouse = self.database.get_person_from_handle(father_handle).get_primary_name().get_regular_name()
for event_handle in fam.get_event_list():
if event_handle:
@ -533,7 +533,7 @@ class DetDescendantReport(Report.Report):
place = ""
if marriage:
if marriage.get_place_handle():
place = self.database.try_to_find_place_from_handle(marriage.get_place_handle()).get_title()
place = self.database.get_place_from_handle(marriage.get_place_handle()).get_title()
elif rptOptions.blankPlace == reportOptions.Yes:
place= "____________"
@ -582,14 +582,14 @@ class DetDescendantReport(Report.Report):
heshe = _("She")
mother_handle = fam.get_mother_handle()
if mother_handle:
mate = self.database.try_to_find_person_from_handle(mother_handle)
mate = self.database.get_person_from_handle(mother_handle)
mateName = mate.get_primary_name().get_regular_name()
mateFirstName = mate.get_primary_name().get_first_name()
else:
heshe = _("He")
father_handle = fam.get_father_handle()
if father_handle:
mate = self.database.try_to_find_person_from_handle(father_handle)
mate = self.database.get_person_from_handle(father_handle)
mateName = mate.get_primary_name().get_regular_name()
mateFirstName = mate.get_primary_name().get_first_name()
@ -622,7 +622,7 @@ class DetDescendantReport(Report.Report):
photos = person.get_media_list()
for photo in photos :
object_handle = photo.get_reference_handle()
object = self.database.try_to_find_object_from_handle(object_handle)
object = self.database.get_object_from_handle(object_handle)
if object.get_mime_type()[0:5] == "image":
file = object.get_path()
self.doc.add_media_object(file,"row",4.0,4.0)
@ -651,11 +651,11 @@ class DetDescendantReport(Report.Report):
if self.start.get_gender() == RelLib.Person.male:
mother_handle = fam.get_mother_handle()
if mother_handle:
spouseName = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_first_name()
spouseName = self.database.get_person_from_handle(mother_handle).get_primary_name().get_first_name()
else:
father_handle = fam.get_father_handle()
if father_handle:
spouseName = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_first_name()
spouseName = self.database.get_person_from_handle(father_handle).get_primary_name().get_first_name()
self.doc.start_paragraph("DDR-Title")
if spouseName:
@ -684,7 +684,7 @@ class DetDescendantReport(Report.Report):
for key in self.genKeys[generation]:
person_handle = self.map[key]
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
self.genIDs[person_handle]= key
dupPerson= self.write_person(key, rptOpt)
if dupPerson == 0: # Is this a duplicate ind record
@ -1001,7 +1001,7 @@ class DetDescendantBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
@ -1190,7 +1190,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
rptOpt = reportOptions(database)

View File

@ -316,7 +316,7 @@ class DisplayChart:
def build_row_data(self):
for individual_id in self.my_list:
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
name = individual.get_primary_name().get_name()
birth_handle = individual.get_birth_handle()
bdate = ""
@ -326,7 +326,7 @@ class DisplayChart:
bdate = birth.get_date()
bplace_handle = birth.get_place_handle()
if bplace_handle:
bplace = self.db.try_to_find_place_from_handle(bplace_handle).get_title()
bplace = self.db.get_place_from_handle(bplace_handle).get_title()
death_handle = individual.get_death_handle()
ddate = ""
dplace = ""
@ -335,7 +335,7 @@ class DisplayChart:
ddate = death.get_date()
dplace_handle = death.get_place_handle()
if dplace_handle:
dplace = self.db.try_to_find_place_from_handle(dplace_handle).get_title()
dplace = self.db.get_place_from_handle(dplace_handle).get_title()
map = {}
elist = individual.get_event_list()[:]
for ievent_handle in elist:
@ -368,7 +368,7 @@ class DisplayChart:
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.db.try_to_find_place_from_handle(place_handle).get_title()
place = self.db.get_place_from_handle(place_handle).get_title()
tlist.append("%s\n%s" % (date, place))
added = 1
else:
@ -387,7 +387,7 @@ class DisplayChart:
name, birth, and death. This should be the column titles of the report"""
map = {}
for individual_id in self.my_list:
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
elist = individual.get_event_list()
for event_handle in elist:
if not event_handle:

View File

@ -135,7 +135,7 @@ class FamilyGroup:
if not person_handle:
return
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
if person.get_gender() == RelLib.Person.male:
id = _("Husband")
@ -160,7 +160,7 @@ class FamilyGroup:
bdate = birth.get_date()
bplace_handle = birth.get_place_handle()
if bplace_handle:
bplace = self.db.try_to_find_place_from_handle(bplace_handle).get_title()
bplace = self.db.get_place_from_handle(bplace_handle).get_title()
death_handle = person.get_death_handle()
ddate = ""
@ -170,7 +170,7 @@ class FamilyGroup:
ddate = death.get_date()
dplace_handle = death.get_place_handle()
if dplace_handle:
dplace = self.db.try_to_find_place_from_handle(dplace_handle).get_title()
dplace = self.db.get_place_from_handle(dplace_handle).get_title()
self.doc.start_row()
self.doc.start_cell("FGR-TextContents")
@ -215,10 +215,10 @@ class FamilyGroup:
family = self.db.find_family_from_handle(family_handle)
father_handle = family.get_father_handle()
if father_handle:
father_name = self.db.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name()
father_name = self.db.get_person_from_handle(father_handle).get_primary_name().get_regular_name()
mother_handle = family.get_mother_handle()
if mother_handle:
mother_name = self.db.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name()
mother_name = self.db.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
self.doc.start_row()
self.doc.start_cell("FGR-TextContents")
@ -255,7 +255,7 @@ class FamilyGroup:
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.db.try_to_find_place_from_handle(place_handle).get_title()
place = self.db.get_place_from_handle(place_handle).get_title()
self.doc.start_row()
self.doc.start_cell(text)
@ -281,7 +281,7 @@ class FamilyGroup:
def dump_child(self,index,person_handle):
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
self.doc.start_row()
self.doc.start_cell('FGR-TextChild1')
self.doc.start_paragraph('FGR-ChildText')
@ -344,7 +344,7 @@ class FamilyGroup:
self.doc.start_cell('FGR-TextContentsEnd',2)
self.doc.start_paragraph('FGR-Normal')
if spouse_id:
spouse = self.db.try_to_find_person_from_handle(spouse_id)
spouse = self.db.get_person_from_handle(spouse_id)
self.doc.write_text(spouse.get_primary_name().get_regular_name())
self.doc.end_paragraph()
self.doc.end_cell()
@ -499,7 +499,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -617,7 +617,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
spouse_name = options[1]
spouse_map = _build_spouse_map(database,person)
if spouse_map:
@ -704,7 +704,7 @@ def _build_spouse_map(database,person):
else:
spouse_id = family.get_father_handle()
if spouse_id:
spouse = database.try_to_find_person_from_handle(spouse_id)
spouse = database.get_person_from_handle(spouse_id)
name = spouse.get_primary_name().get_name()
else:
name= _("unknown")

View File

@ -164,7 +164,7 @@ class FanChart:
self.lines = max(self.lines,len(self.text[index-1]))
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = self.database.find_family_from_handle(family_handle)
@ -201,7 +201,7 @@ class FanChart:
self.doc.close()
def get_info(self,person_handle):
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
pn = person.get_primary_name()
birth_handle = person.get_birth_handle()
@ -392,7 +392,7 @@ class FanChartBareDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -450,7 +450,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
return FanChart(database, person,
"%n", doc, None, newpage )
except Errors.ReportError, msg:

View File

@ -184,7 +184,7 @@ class MyID(gtk.HBox):
def set_text(self,val):
try:
p = self.db.get_person(val)
p = self.db.get_person_from_handle(val)
n = p.get_primary_name().get_name()
self.tooltips.set_tip(self.entry,n)
except:
@ -554,7 +554,7 @@ class EditRule:
self.add_places = []
for p_id in self.db.get_place_handles():
p = self.db.try_to_find_place_from_handle(p_id)
p = self.db.get_place_from_handle(p_id)
self.pmap[p.get_title()] = p_id
self.active_rule = val
@ -787,7 +787,7 @@ class ShowResults:
n = []
for p_id in id_list:
p = db.try_to_find_person_from_handle(p_id)
p = db.get_person_from_handle(p_id)
n.append ("%s [%s]\n" % (p.get_primary_name().get_name(),p.get_handle()))
n.sort ()

View File

@ -69,7 +69,7 @@ class FtmAncestorReport(Report.Report):
return
self.map[index] = (person_handle,generation)
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = self.database.find_family_from_handle(family_handle)
@ -103,7 +103,7 @@ class FtmAncestorReport(Report.Report):
self.doc.end_paragraph()
old_gen = generation
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
pri_name = person.get_primary_name()
self.doc.start_paragraph("FTA-Entry","%d." % key)
name = pri_name.get_regular_name()
@ -119,7 +119,7 @@ class FtmAncestorReport(Report.Report):
birth = self.database.find_event_from_handle(birth_handle)
place_handle = birth.get_place_handle()
if place_handle:
bplace = self.database.try_to_find_place_from_handle(place_handle).get_title()
bplace = self.database.get_place_from_handle(place_handle).get_title()
else:
bplace = u''
bdate = birth.get_date()
@ -134,7 +134,7 @@ class FtmAncestorReport(Report.Report):
death = self.database.find_event_from_handle(death_handle)
place_handle = death.get_place_handle()
if place_handle:
dplace = self.database.try_to_find_place_from_handle(place_handle).get_title()
dplace = self.database.get_place_from_handle(place_handle).get_title()
else:
dplace = u''
ddate = death.get_date()
@ -448,7 +448,7 @@ class FtmAncestorReport(Report.Report):
keys.sort()
for key in keys:
srcref = self.sref_map[key]
base = self.database.try_to_find_source_from_handle(srcref.get_base_handle())
base = self.database.get_source_from_handle(srcref.get_base_handle())
self.doc.start_paragraph('FTA-Endnotes',"%d." % key)
self.doc.write_text(base.get_title())
@ -537,7 +537,7 @@ class FtmAncestorReport(Report.Report):
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle).get_title()
place = self.database.get_place_from_handle(place_handle).get_title()
else:
place = u''
@ -584,7 +584,7 @@ class FtmAncestorReport(Report.Report):
spouse_id = family.get_father_handle()
if not spouse_id:
return
spouse = self.database.try_to_find_person_from_handle(spouse_id)
spouse = self.database.get_person_from_handle(spouse_id)
spouse_name = spouse.get_primary_name().get_regular_name()
for event_handle in family.get_event_list():
@ -598,7 +598,7 @@ class FtmAncestorReport(Report.Report):
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle).get_title()
place = self.database.get_place_from_handle(place_handle).get_title()
else:
place = u''
@ -657,7 +657,7 @@ class FtmAncestorReport(Report.Report):
ddate = death.get_date()
place_handle = death.get_place_handle()
if place_handle:
dplace = self.database.try_to_find_place_from_handle(place_handle).get_title()
dplace = self.database.get_place_from_handle(place_handle).get_title()
else:
dplace = u''
else:
@ -672,7 +672,7 @@ class FtmAncestorReport(Report.Report):
bdate = birth.get_date()
place_handle = birth.get_place_handle()
if place_handle:
bplace = self.database.try_to_find_place_from_handle(place_handle).get_title()
bplace = self.database.get_place_from_handle(place_handle).get_title()
else:
bplace = u''
else:
@ -962,10 +962,10 @@ class FtmAncestorReport(Report.Report):
mother_handle = family.get_mother_handle()
father_handle = family.get_father_handle()
if mother_handle:
mother = self.database.try_to_find_person_from_handle(mother_handle)
mother = self.database.get_person_from_handle(mother_handle)
mother_name = mother.get_primary_name().get_regular_name()
if father_handle:
father = self.database.try_to_find_person_from_handle(father_handle)
father = self.database.get_person_from_handle(father_handle)
father_name = father.get_primary_name().get_regular_name()
if person.get_gender() == RelLib.Person.male:
@ -1150,7 +1150,7 @@ class FtmAncestorBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -1213,7 +1213,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
return FtmAncestorReport(database, person, max_gen, pg_brk, doc, None, newpage )

View File

@ -97,7 +97,7 @@ class FtmDescendantReport(Report.Report):
self.gen_map[generation] = []
self.gen_map[generation].append(index)
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
for family_handle in person.get_family_handle_list():
family = self.database.find_family_from_handle(family_handle)
for child_handle in family.get_child_handle_list():
@ -133,7 +133,7 @@ class FtmDescendantReport(Report.Report):
indexlist.sort()
for key in indexlist:
person_handle = self.anc_map[key]
person = self.database.try_to_find_person_from_handle(person_handle)
person = self.database.get_person_from_handle(person_handle)
pri_name = person.get_primary_name()
self.doc.start_paragraph("FTD-Entry","%d." % key)
@ -152,7 +152,7 @@ class FtmDescendantReport(Report.Report):
bdate = birth.get_date()
bplace_handle = birth.get_place_handle()
if bplace_handle:
bplace = self.database.try_to_find_place_from_handle(bplace_handle).get_title()
bplace = self.database.get_place_from_handle(bplace_handle).get_title()
death_handle = person.get_death_handle()
dplace = ""
@ -162,7 +162,7 @@ class FtmDescendantReport(Report.Report):
ddate = death.get_date()
dplace_handle = death.get_place_handle()
if dplace_handle:
dplace = self.database.try_to_find_place_from_handle(dplace_handle).get_title()
dplace = self.database.get_place_from_handle(dplace_handle).get_title()
birth_valid = bdate or bplace
death_valid = ddate or dplace
@ -476,7 +476,7 @@ class FtmDescendantReport(Report.Report):
for key in keys:
srcref = self.sref_map[key]
base_handle = srcref.get_base_handle()
base = self.database.try_to_find_source_from_handle(base_handle)
base = self.database.get_source_from_handle(base_handle)
self.doc.start_paragraph('FTD-Endnotes',"%d." % key)
self.doc.write_text(base.get_title())
@ -567,7 +567,7 @@ class FtmDescendantReport(Report.Report):
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle)
place = self.database.get_place_from_handle(place_handle)
else:
place = None
@ -612,8 +612,8 @@ class FtmDescendantReport(Report.Report):
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
if father_handle and mother_handle:
husband = self.database.try_to_find_person_from_handle(father_handle).get_primary_name().get_regular_name()
wife = self.database.try_to_find_person_from_handle(mother_handle).get_primary_name().get_regular_name()
husband = self.database.get_person_from_handle(father_handle).get_primary_name().get_regular_name()
wife = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
else:
continue
for event_handle in family.get_event_list():
@ -623,7 +623,7 @@ class FtmDescendantReport(Report.Report):
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle)
place = self.database.get_place_from_handle(place_handle)
else:
place = None
@ -672,11 +672,11 @@ class FtmDescendantReport(Report.Report):
spouse_id = mother_handle
else:
spouse_id = father_handle
spouse = self.database.try_to_find_person_from_handle(spouse_id)
spouse = self.database.get_person_from_handle(spouse_id)
child_index = 0
for child_handle in family.get_child_handle_list():
child = self.database.try_to_find_person_from_handle(child_handle)
child = self.database.get_person_from_handle(child_handle)
child_index = child_index + 1
child_name = child.get_primary_name().get_regular_name()
for (ind,p_id) in self.anc_map.items():
@ -718,7 +718,7 @@ class FtmDescendantReport(Report.Report):
bdate = birth.get_date()
bplace_handle = birth.get_place_handle()
if bplace_handle:
bplace = self.database.try_to_find_place_from_handle(bplace_handle).get_title()
bplace = self.database.get_place_from_handle(bplace_handle).get_title()
death_handle = child.get_death_handle()
dplace = ""
@ -728,7 +728,7 @@ class FtmDescendantReport(Report.Report):
ddate = death.get_date()
dplace_handle = death.get_place_handle()
if dplace_handle:
dplace = self.database.try_to_find_place_from_handle(dplace_handle).get_title()
dplace = self.database.get_place_from_handle(dplace_handle).get_title()
if child.get_gender() == RelLib.Person.male:
if bdate:
@ -1007,7 +1007,7 @@ class FtmDescendantReport(Report.Report):
spouse_id = family.get_father_handle()
if not spouse_id:
return
spouse = self.database.try_to_find_person_from_handle(spouse_id)
spouse = self.database.get_person_from_handle(spouse_id)
for event_handle in family.get_event_list():
if event_handle:
@ -1022,7 +1022,7 @@ class FtmDescendantReport(Report.Report):
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle).get_title()
place = self.database.get_place_from_handle(place_handle).get_title()
else:
place = ""
@ -1080,7 +1080,7 @@ class FtmDescendantReport(Report.Report):
bdate = birth.get_date()
bplace_handle = birth.get_place_handle()
if bplace_handle:
bplace = self.database.try_to_find_place_from_handle(bplace_handle).get_title()
bplace = self.database.get_place_from_handle(bplace_handle).get_title()
death_handle = spouse.get_death_handle()
dplace = ""
@ -1090,7 +1090,7 @@ class FtmDescendantReport(Report.Report):
ddate = death.get_date()
dplace_handle = death.get_place_handle()
if dplace_handle:
dplace = self.database.try_to_find_place_from_handle(dplace_handle).get_title()
dplace = self.database.get_place_from_handle(dplace_handle).get_title()
death_valid = ddate or dplace
birth_valid = bdate or bplace
@ -1384,12 +1384,12 @@ class FtmDescendantReport(Report.Report):
family = self.database.find_family_from_handle(family_handle)
mother_handle = family.get_mother_handle()
if mother_handle:
mother = self.database.try_to_find_person_from_handle(mother_handle)
mother = self.database.get_person_from_handle(mother_handle)
else:
mother = None
father_handle = family.get_father_handle()
if father_handle:
father = self.database.try_to_find_person_from_handle(father_handle)
father = self.database.get_person_from_handle(father_handle)
else:
father = None
if person.get_gender() == RelLib.Person.male:
@ -1584,7 +1584,7 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -1646,7 +1646,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
return FtmDescendantReport(database, person, max_gen,

View File

@ -396,7 +396,7 @@ def dump_person(database,person_list,file,adoptionsdashed,arrowheadstyle,
for person_handle in person_list:
pid = string.replace(person_handle,'-','_')
person = database.try_to_find_person_from_handle(person_handle)
person = database.get_person_from_handle(person_handle)
for family_handle, mrel, frel in person.get_parent_family_handle_list():
family = database.find_family_from_handle(family_handle)
father_handle = family.get_father_handle()
@ -450,7 +450,7 @@ def dump_index(database,person_list,file,includedates,includeurl,colorize,
# don't do it twice.
families_done = []
for person_handle in person_list:
person = database.try_to_find_person_from_handle(person_handle)
person = database.get_person_from_handle(person_handle)
# Output the person's node.
label = person.get_primary_name().get_name()
id = string.replace(person_handle,'-','_')

View File

@ -124,7 +124,7 @@ class IndivComplete(Report.Report):
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.database.try_to_find_place_from_handle(place_handle).get_title()
place = self.database.get_place_from_handle(place_handle).get_title()
else:
place = ""
description = event.get_description()
@ -208,7 +208,7 @@ class IndivComplete(Report.Report):
family = self.database.find_family_from_handle(family_handle)
father_handle = family.get_father_handle()
if father_handle:
father = self.database.try_to_find_person_from_handle(father_handle)
father = self.database.get_person_from_handle(father_handle)
fname = father.get_primary_name().get_regular_name()
frel = const.child_relations.find_value(frel)
self.write_p_entry(_('Father'),fname,frel)
@ -217,7 +217,7 @@ class IndivComplete(Report.Report):
mother_handle = family.get_mother_handle()
if mother_handle:
mother = self.database.try_to_find_person_from_handle(mother_handle)
mother = self.database.get_person_from_handle(mother_handle)
fname = mother.get_primary_name().get_regular_name()
frel = const.child_relations.find_value(frel)
self.write_p_entry(_('Mother'),fname,frel)
@ -281,7 +281,7 @@ class IndivComplete(Report.Report):
self.d.start_cell("IDS-NormalCell",2)
self.d.start_paragraph("IDS-Spouse")
if spouse_id:
spouse = self.database.try_to_find_person_from_handle(spouse_id)
spouse = self.database.get_person_from_handle(spouse_id)
text = spouse.get_primary_name().get_regular_name()
else:
text = _("unknown")
@ -309,7 +309,7 @@ class IndivComplete(Report.Report):
first = 0
else:
self.d.write_text('\n')
child = self.database.try_to_find_person_from_handle(child_handle)
child = self.database.get_person_from_handle(child_handle)
self.d.write_text(child.get_primary_name().get_regular_name())
self.d.end_paragraph()
self.d.end_cell()
@ -336,7 +336,7 @@ class IndivComplete(Report.Report):
self.d.start_row()
s_id = source.get_base_handle()
self.normal_cell(s_id)
src = self.database.try_to_find_source_from_handle(s_id)
src = self.database.get_source_from_handle(s_id)
self.normal_cell(src.get_title())
self.d.end_row()
self.d.end_table()
@ -381,7 +381,7 @@ class IndivComplete(Report.Report):
count = 0
for person_handle in ind_list:
self.person = self.database.try_to_find_person_from_handle(person_handle)
self.person = self.database.get_person_from_handle(person_handle)
self.write_person(count)
count = count + 1
self.end()
@ -402,7 +402,7 @@ class IndivComplete(Report.Report):
if len(media_list) > 0:
object_handle = media_list[0].get_reference_handle()
object = self.database.try_to_find_object_from_handle(object_handle)
object = self.database.get_object_from_handle(object_handle)
if object.get_mime_type()[0:5] == "image":
file = object.get_path()
self.d.start_paragraph("IDS-Normal")
@ -435,13 +435,13 @@ class IndivComplete(Report.Report):
family = self.database.find_family_from_handle(family_handle)
father_inst_id = family.get_father_handle()
if father_inst_id:
father_inst = self.database.try_to_find_person_from_handle(father_inst_id)
father_inst = self.database.get_person_from_handle(father_inst_id)
father = father_inst.get_primary_name().get_regular_name()
else:
father = ""
mother_inst_id = family.get_mother_handle()
if mother_inst_id:
mother_inst = self.database.try_to_find_person_from_handle(mother_inst_id)
mother_inst = self.database.get_person_from_handle(mother_inst_id)
mother = mother_inst.get_primary_name().get_regular_name()
else:
mother = ""
@ -579,7 +579,7 @@ class IndivCompleteBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -648,7 +648,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
filter_num = int(options[3])

View File

@ -118,7 +118,7 @@ class IndivSummary(Report.Report):
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place_obj = self.database.try_to_find_place_from_handle(place_handle)
place_obj = self.database.get_place_from_handle(place_handle)
place = place_obj.get_title()
else:
place = ""
@ -178,7 +178,7 @@ class IndivSummary(Report.Report):
self.d.start_cell("IVS-NormalCell",2)
self.d.start_paragraph("IVS-Spouse")
if spouse_id:
spouse = self.database.try_to_find_person_from_handle(spouse_id)
spouse = self.database.get_person_from_handle(spouse_id)
self.d.write_text(spouse.get_primary_name().get_regular_name())
else:
self.d.write_text(_("unknown"))
@ -208,7 +208,7 @@ class IndivSummary(Report.Report):
first = 0
else:
self.d.write_text('\n')
child = self.database.try_to_find_person_from_handle(child_handle)
child = self.database.get_person_from_handle(child_handle)
self.d.write_text(child.get_primary_name().get_regular_name())
self.d.end_paragraph()
self.d.end_cell()
@ -232,7 +232,7 @@ class IndivSummary(Report.Report):
if len(media_list) > 0:
object_handle = media_list[0].get_reference_handle()
object = self.database.try_to_find_object_from_handle(object_handle)
object = self.database.get_object_from_handle(object_handle)
if object.get_mime_type()[0:5] == "image":
file = object.get_path()
self.d.start_paragraph("IVS-Normal")
@ -277,13 +277,13 @@ class IndivSummary(Report.Report):
family = self.database.find_family_from_handle(fam_id)
father_handle = family.get_father_handle()
if father_handle:
dad = self.database.try_to_find_person_from_handle(father_handle)
dad = self.database.get_person_from_handle(father_handle)
father = dad.get_primary_name().get_regular_name()
else:
father = ""
mother_handle = family.get_mother_handle()
if mother_handle:
mom = self.database.try_to_find_person_from_handle(mother_handle)
mom = self.database.get_person_from_handle(mother_handle)
mother = mom.get_primary_name().get_regular_name()
else:
mother = ""
@ -423,7 +423,7 @@ class IndivSummaryBareReportDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -489,7 +489,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
max_gen = int(options[1])
pg_brk = int(options[2])
return IndivSummary(database, person, None, doc, newpage)

View File

@ -148,7 +148,6 @@ pkgdata_PYTHON = \
IndivSummary.py\
Merge.py\
PatchNames.py\
ReadGedcom.py\
ReadPkg.py\
ReadNative.py\
RelCalc.py\
@ -159,7 +158,6 @@ pkgdata_PYTHON = \
Verify.py\
WebPage.py\
WriteFtree.py\
WriteGedcom.py\
WritePkg.py\
WriteCD.py\
rel_ru.py\
@ -177,8 +175,6 @@ GLADEFILES = \
changetype.glade\
desbrowse.glade\
eventcmp.glade\
gedcomexport.glade\
gedcomimport.glade\
merge.glade\
patchnames.glade\
relcalc.glade\

View File

@ -147,7 +147,7 @@ class Merge:
if (not p1_id) or (p1_id in id_list):
return
id_list.append(p1_id)
p1 = self.db.try_to_find_person_from_handle(p1_id)
p1 = self.db.get_person_from_handle(p1_id)
f1_id = p1.get_main_parents_family_handle()
if f1_id:
f1 = self.db.find_family_from_handle(f1_id)
@ -184,7 +184,7 @@ class Merge:
males = {}
females = {}
for p1_id in self.person_list:
p1 = self.db.try_to_find_person_from_handle(p1_id)
p1 = self.db.get_person_from_handle(p1_id)
key = self.gen_key(p1.get_primary_name().get_surname())
if p1.get_gender() == RelLib.Person.male:
if males.has_key(key):
@ -201,7 +201,7 @@ class Merge:
num = 0
for p1key in self.person_list:
p1 = self.db.try_to_find_person_from_handle(p1key)
p1 = self.db.get_person_from_handle(p1key)
if num % 25 == 0:
self.progress_update((float(num)/float(length))*100)
num = num + 1
@ -217,7 +217,7 @@ class Merge:
index = index + 1
if p1key == p2key:
continue
p2 = self.db.try_to_find_person_from_handle(p2key)
p2 = self.db.get_person_from_handle(p2key)
if self.map.has_key(p2key):
(v,c) = self.map[p2key]
if v == p1key:
@ -297,8 +297,8 @@ class Merge:
for (c,p1key,p2key) in list:
c1 = "%5.2f" % c
c2 = "%5.2f" % (100-c)
pn1 = self.db.try_to_find_person_from_handle(p1key).get_primary_name().get_name()
pn2 = self.db.try_to_find_person_from_handle(p2key).get_primary_name().get_name()
pn1 = self.db.get_person_from_handle(p1key).get_primary_name().get_name()
pn2 = self.db.get_person_from_handle(p2key).get_primary_name().get_name()
self.list.add([c, pn1, pn2,c2],(p1key,p2key))
def on_do_merge_clicked(self,obj):
@ -307,8 +307,8 @@ class Merge:
return
(p1,p2) = self.list.get_object(iter)
pn1 = self.db.try_to_find_person_from_handle(p1)
pn2 = self.db.try_to_find_person_from_handle(p2)
pn1 = self.db.get_person_from_handle(p1)
pn2 = self.db.get_person_from_handle(p2)
MergeData.MergePeople(self.parent,self.db,pn1,pn2,self.on_update)
def on_update(self,p1_id,p2_id,old_id):
@ -443,13 +443,13 @@ class Merge:
if not p1_id:
name1 = ""
else:
p1 = self.db.try_to_find_place_from_handle(p1_id)
p1 = self.db.get_place_from_handle(p1_id)
name1 = p1.get_title()
if not p2_id:
name2 = ""
else:
p2 = self.db.try_to_find_place_from_handle(p2_id)
p2 = self.db.get_place_from_handle(p2_id)
name2 = p2.get_title()
if not (name1 and name2):
@ -545,12 +545,12 @@ class Merge:
f2 = self.db.find_family_from_handle(f2_id)
dad1_id = f1.get_father_handle()
if dad1_id:
dad1 = get_name_obj(self.db.try_to_find_person_from_handle(dad1_id))
dad1 = get_name_obj(self.db.get_person_from_handle(dad1_id))
else:
dad1 = None
dad2_id = f2.get_father_handle()
if dad2_id:
dad2 = get_name_obj(self.db.try_to_find_person_from_handle(dad2_id))
dad2 = get_name_obj(self.db.get_person_from_handle(dad2_id))
else:
dad2 = None
@ -563,12 +563,12 @@ class Merge:
mom1_id = f1.get_mother_handle()
if mom1_id:
mom1 = get_name_obj(self.db.try_to_find_person_from_handle(mom1_id))
mom1 = get_name_obj(self.db.get_person_from_handle(mom1_id))
else:
mom1 = None
mom2_id = f2.get_mother_handle()
if mom2_id:
mom2 = get_name_obj(self.db.try_to_find_person_from_handle(mom2_id))
mom2 = get_name_obj(self.db.get_person_from_handle(mom2_id))
else:
mom2 = None
@ -589,8 +589,8 @@ class Merge:
if father1_id == father2_id:
chance = chance + 1
else:
father1 = self.db.try_to_find_person_from_handle(father1_id)
father2 = self.db.try_to_find_person_from_handle(father2_id)
father1 = self.db.get_person_from_handle(father1_id)
father2 = self.db.get_person_from_handle(father2_id)
fname1 = get_name_obj(father1)
fname2 = get_name_obj(father2)
value = self.name_match(fname1,fname2)
@ -603,8 +603,8 @@ class Merge:
if mother1_id == mother2_id:
chance = chance + 1
else:
mother1 = self.db.try_to_find_person_from_handle(mother1_id)
mother2 = self.db.try_to_find_person_from_handle(mother2_id)
mother1 = self.db.get_person_from_handle(mother1_id)
mother2 = self.db.get_person_from_handle(mother2_id)
mname1 = get_name_obj(mother1)
mname2 = get_name_obj(mother2)
value = self.name_match(mname1,mname2)

View File

@ -89,7 +89,7 @@ class PatchNames:
for key in self.db.get_person_keys():
person = self.db.try_to_find_person_from_handle(key)
person = self.db.get_person_from_handle(key)
first = person.get_primary_name().get_first_name()
match = _title_re.match(first)
if match:
@ -157,7 +157,7 @@ class PatchNames:
self.title_hash = {}
for (id,name,nick) in self.nick_list:
p = self.db.try_to_find_person_from_handle(id)
p = self.db.get_person_from_handle(id)
iter = self.model.append()
self.model.set_value(iter,0,1)
self.model.set_value(iter,1,id)
@ -167,7 +167,7 @@ class PatchNames:
self.nick_hash[id] = iter
for (id,title,nick) in self.title_list:
p = self.db.try_to_find_person_from_handle(id)
p = self.db.get_person_from_handle(id)
iter = self.model.append()
self.model.set_value(iter,0,1)
self.model.set_value(iter,1,id)
@ -205,7 +205,7 @@ class PatchNames:
iter = self.nick_hash[grp[0]]
val = self.model.get_value(iter,0)
if val:
p = self.db.get_person(grp[0])
p = self.db.get_person_from_handle(grp[0])
name = p.get_primary_name()
name.set_first_name(grp[1].strip())
p.set_nick_name(grp[2].strip())
@ -215,7 +215,7 @@ class PatchNames:
iter = self.title_hash[grp[0]]
val = self.model.get_value(iter,0)
if val:
p = self.db.try_to_find_person_from_handle(grp[0])
p = self.db.get_person_from_handle(grp[0])
name = p.get_primary_name()
name.set_first_name(grp[2].strip())
name.set_title(grp[1].strip())

View File

@ -94,7 +94,7 @@ class RelCalc:
self.on_apply_clicked)
self.clist.new_model()
for key in self.db.get_person_keys():
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
if p == self.person:
continue
val = self.db.get_person_display(key)
@ -138,18 +138,18 @@ class RelCalc:
return
id = self.clist.get_object(iter)
other_person = self.db.get_person(id)
other_person = self.db.get_person_from_handle(id)
(rel_string,common) = self.relationship.get_relationship(self.person,other_person)
length = len(common)
if length == 1:
person = self.db.try_to_find_person_from_handle(common[0])
person = self.db.get_person_from_handle(common[0])
name = person.get_primary_name().get_regular_name()
commontext = " " + _("Their common ancestor is %s.") % name
elif length == 2:
p1 = self.db.try_to_find_person_from_handle(common[0])
p2 = self.db.try_to_find_person_from_handle(common[1])
p1 = self.db.get_person_from_handle(common[0])
p2 = self.db.get_person_from_handle(common[1])
commontext = " " + _("Their common ancestors are %s and %s.") % \
(p1.get_primary_name().get_regular_name(),\
p2.get_primary_name().get_regular_name())
@ -157,7 +157,7 @@ class RelCalc:
index = 0
commontext = " " + _("Their common ancestors are : ")
for person_handle in common:
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
if index != 0:
commontext = commontext + ", "
commontext = commontext + person.get_primary_name().get_regular_name()

View File

@ -506,7 +506,7 @@ def _write_graph_box (self):
_write_node(self.File, shape='ellipse', color='black',
fontname=self.FontStyle)
for individual_id in individual_nodes:
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
for family_handle in individual.get_family_handle_list():
if family_handle not in family_nodes:
family_nodes.add(family_handle)
@ -518,7 +518,7 @@ def _write_graph_box (self):
_write_edge(self.File, style="solid",
arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle)
for individual_id in individual_nodes:
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
for family_handle, mother_rel_ship, father_rel_ship\
in individual.get_parent_family_handle_list():
family = self.db.find_family_from_handle(family_handle)
@ -554,7 +554,7 @@ def _write_graph_box (self):
females = 0
unknowns = 0
for individual_id in individual_nodes:
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
if individual.get_gender() == individual.male:
males = males + 1
elif individual.get_gender() == individual.female:
@ -596,7 +596,7 @@ def _write_graph_record (self):
for individual_id in natural_relatives:
# If both husband and wife are members of the IndividualSet,
# only one record, with the husband first, is displayed.
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
if individual.get_gender() == individual.female:
# There are exactly three cases where a female node is added:
family_handle = None # no family
@ -633,7 +633,7 @@ def _write_graph_record (self):
arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle)
for family_from_handle, family_from_handle2 in family_nodes.items():
for individual_from_handle in family_from_handle2:
individual_from = self.db.try_to_find_person_from_handle(individual_from_handle)
individual_from = self.db.get_person_from_handle(individual_from_handle)
for family_handle, mother_rel_ship, father_rel_ship\
in individual_from.get_parent_family_handle_list():
family = self.db.find_family_from_handle(family_handle)
@ -671,7 +671,7 @@ def _write_graph_record (self):
for family_handle, family_handle2 in family_nodes.items():
marriages = marriages + (len(family_handle2) - 1)
for individual_id in family_handle2:
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
if individual.get_gender() == individual.male\
and individual_id not in males:
males.add(individual_id)
@ -692,7 +692,7 @@ def _get_individual_data (self, individual_id):
"""Returns a tuple of individual data"""
# color
color = ''
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
if self.Colorize:
gender = individual.get_gender()
if gender == individual.male:
@ -724,7 +724,7 @@ def _get_event_label (self, event_handle):
elif self.PlaceCause:
place_handle = event.get_place_handle()
if place_handle:
place = self.db.try_to_find_place_from_handle(place_handle)
place = self.db.get_place_from_handle(place_handle)
return place.get_title()
else:
return event.get_cause()
@ -743,7 +743,7 @@ def _get_individual_label (self, individual_id, marriage_event_handle=None, fami
individual's and family's IDs.
"""
# Get data ready
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
name = individual.get_primary_name().get_name()
if self.IncludeDates:
birth = _get_event_label(self, individual.get_birth_handle())
@ -813,9 +813,9 @@ def _get_family_handle_record_label (self, record):
"""Returns a formatted string of a family record suitable for a label"""
labels = []
spouse_id = record[0]
spouse = self.db.try_to_find_person_from_handle(spouse_id)
spouse = self.db.get_person_from_handle(spouse_id)
for individual_id in record:
individual = self.db.try_to_find_person_from_handle(individual_id)
individual = self.db.get_person_from_handle(individual_id)
if spouse_id == individual_id:
label = _get_individual_label(self, individual_id)
else:

View File

@ -207,7 +207,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
@ -423,7 +423,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
if options[1]:
title_string = options[1]
else:

View File

@ -69,7 +69,7 @@ class SoundGen:
names = []
for person_handle in self.db.get_person_keys():
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
lastname = person.get_primary_name().get_surname()
if lastname not in names:
names.append(lastname)

View File

@ -71,14 +71,14 @@ def build_report(database,person):
pobjects = len(database.get_object_keys())
for photo_id in database.get_object_keys():
photo = database.try_to_find_object_from_handle(photo_id)
photo = database.get_object_from_handle(photo_id)
try:
bytes = bytes + posixpath.getsize(photo.get_path())
except:
notfound.append(photo.get_path())
for person_handle in personList:
person = database.try_to_find_person_from_handle(person_handle)
person = database.get_person_from_handle(person_handle)
if not person:
continue
length = len(person.get_media_list())
@ -86,7 +86,7 @@ def build_report(database,person):
with_photos = with_photos + 1
total_photos = total_photos + length
person = database.try_to_find_person_from_handle(person_handle)
person = database.get_person_from_handle(person_handle)
name = person.get_primary_name()
if name.get_first_name() == "" or name.get_surname() == "":
incomp_names = incomp_names + 1

View File

@ -184,7 +184,7 @@ class TimeLine:
self.plist.sort(self.sort_func)
for p_id in self.plist:
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
b_id = p.get_birth_handle()
if b_id:
b = self.db.find_event_from_handle(b_id).get_date_object().get_year()
@ -282,7 +282,7 @@ class TimeLine:
self.plist = self.filter.apply(self.db,self.db.get_person_keys())
for p_id in self.plist:
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
b_id = p.get_birth_handle()
if b_id:
b = self.db.find_event_from_handle(b_id).get_date_object().get_year()
@ -321,7 +321,7 @@ class TimeLine:
size = 0
for p_id in self.plist:
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
n = p.get_primary_name().get_name()
size = max(FontScale.string_width(font,n),size)
return pt2cm(size)
@ -538,7 +538,7 @@ class TimeLineBareDialog(Report.BareReportDialog):
self.options = opt
self.db = database
if self.options[0]:
self.person = self.db.get_person(self.options[0])
self.person = self.db.get_person_from_handle(self.options[0])
else:
self.person = person
self.style_name = stl
@ -636,7 +636,7 @@ def write_book_item(database,person,doc,options,newpage=0):
All user dialog has already been handled and the output file opened."""
try:
if options[0]:
person = database.get_person(options[0])
person = database.get_person_from_handle(options[0])
filter_num = int(options[1])
filters = _get_report_filters(person)
afilter = filters[filter_num]

View File

@ -147,7 +147,7 @@ class Verify:
warn = cStringIO.StringIO()
for person_handle in personList:
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
idstr = "%s (%s)" % (person.get_primary_name().get_name(),person_handle)
# individual checks
@ -278,9 +278,9 @@ class Verify:
mother_handle = family.get_mother_handle()
father_handle = family.get_father_handle()
if mother_handle:
mother = self.db.try_to_find_person_from_handle(mother_handle)
mother = self.db.get_person_from_handle(mother_handle)
if father_handle:
father = self.db.try_to_find_person_from_handle(father_handle)
father = self.db.get_person_from_handle(father_handle)
if mother_handle and father_handle:
if ( mother.get_gender() == father.get_gender() ) and mother.get_gender() != RelLib.Person.unknown:
warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.get_handle() ) )
@ -293,7 +293,7 @@ class Verify:
else:
spouse_id = father_handle
if spouse_id:
spouse = self.db.try_to_find_person_from_handle(spouse_id)
spouse = self.db.get_person_from_handle(spouse_id)
if person.get_gender() == RelLib.Person.male and \
person.get_primary_name().get_surname() == spouse.get_primary_name().get_surname():
warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % (
@ -323,7 +323,7 @@ class Verify:
for child_handle in family.get_child_handle_list():
cnum = cnum + 1
if maryear == 0:
child = self.db.try_to_find_person_from_handle(child_handle)
child = self.db.get_person_from_handle(child_handle)
birthyear = self.get_year( child.get_birth_handle() )
if birthyear > 0:
maryear = birthyear-cnum
@ -391,7 +391,7 @@ class Verify:
cbyears = []
for child_handle in family.get_child_handle_list():
nkids = nkids+1
child = self.db.try_to_find_person_from_handle(child_handle)
child = self.db.get_person_from_handle(child_handle)
cbyear = self.get_year( child.get_birth_handle() )
if cbyear:
cbyears.append(cbyear)

View File

@ -226,7 +226,7 @@ class IndividualPage:
self.doc.start_cell("NormalCell")
self.doc.start_paragraph("Data")
if person_handle:
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
if self.list.has_key(person_handle):
self.doc.start_link("%s.%s" % (person_handle,self.ext))
self.doc.write_text(person.get_primary_name().get_regular_name())
@ -250,7 +250,7 @@ class IndividualPage:
self.doc.write_text('%d. ' % index)
index = index + 1
base_handle = sref.get_base_handle()
base = self.db.try_to_find_source_from_handle(base_handle)
base = self.db.get_source_from_handle(base_handle)
self.write_info(base.get_title())
self.write_info(base.get_author())
self.write_info(base.get_publication_info())
@ -314,7 +314,7 @@ class IndividualPage:
if self.photos and len(media_list) > 0:
object_handle = media_list[0].get_reference_handle()
object = self.db.try_to_find_object_from_handle(object_handle)
object = self.db.get_object_from_handle(object_handle)
if object.get_mime_type()[0:5] == "image":
src = object.get_path()
junk,ext = os.path.splitext(src)
@ -404,7 +404,7 @@ class IndividualPage:
index = 0
for object_ref in self.person.get_media_list():
obj_id = object_ref.get_reference_handle()
obj = self.db.try_to_find_object_from_handle(obj_id)
obj = self.db.get_object_from_handle(obj_id)
if obj.get_mime_type()[0:5] != "image":
continue
if object_ref.get_privacy():
@ -524,7 +524,7 @@ class IndividualPage:
descr = event.get_description()
place_handle = event.get_place_handle()
if place_handle:
place = self.db.try_to_find_place_from_handle(place_handle).get_title()
place = self.db.get_place_from_handle(place_handle).get_title()
else:
place = ""
srcref = event.get_source_references()
@ -581,7 +581,7 @@ class IndividualPage:
date = event.get_date()
place_handle = event.get_place_handle()
if place_handle:
place = self.db.try_to_find_place_from_handle(place_handle).get_title()
place = self.db.get_place_from_handle(place_handle).get_title()
else:
place = ""
descr = event.get_description()
@ -638,7 +638,7 @@ class IndividualPage:
self.doc.start_cell("NormalCell",2)
self.doc.start_paragraph("Spouse")
if spouse_id:
spouse = self.db.try_to_find_person_from_handle(spouse_id)
spouse = self.db.get_person_from_handle(spouse_id)
if self.list.has_key(spouse_id):
self.doc.start_link("%s.%s" % (spouse_id,self.ext))
self.doc.write_text(spouse.get_primary_name().get_regular_name())
@ -673,7 +673,7 @@ class IndividualPage:
first = 1
for child_handle in family.get_child_handle_list():
child = self.db.try_to_find_person_from_handle(child_handle)
child = self.db.get_person_from_handle(child_handle)
name = child.get_primary_name().get_regular_name()
if first == 1:
first = 0
@ -790,7 +790,7 @@ class WebReport(Report.Report):
except:
return
for p_id in person_handle_list:
p = self.db.try_to_find_person_from_handle(p_id)
p = self.db.get_person_from_handle(p_id)
name = p.get_primary_name()
firstName = name.get_first_name()
surName = name.get_surname()
@ -810,7 +810,7 @@ class WebReport(Report.Report):
if e:
f.write("%s|" % self.make_date(e.get_date_object()))
if e.get_place_handle():
f.write('%s|' % self.db.try_to_find_place_from_handle(e.get_place_handle()).get_title())
f.write('%s|' % self.db.get_place_from_handle(e.get_place_handle()).get_title())
else:
f.write('|')
else:
@ -834,7 +834,7 @@ class WebReport(Report.Report):
a = {}
for person_handle in person_handle_list:
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
n = person.get_primary_name().get_surname()
if n:
a[n[0]] = 1
@ -865,8 +865,8 @@ class WebReport(Report.Report):
doc.close()
for n in link_keys:
p_id_list = [ p_id for p_id in person_handle_list if \
(self.db.try_to_find_person_from_handle(p_id).get_primary_name().get_surname() \
and (self.db.try_to_find_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ]
(self.db.get_person_from_handle(p_id).get_primary_name().get_surname() \
and (self.db.get_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ]
doc = HtmlLinkDoc(self.selected_style,None,template,None)
doc.set_extension(self.ext)
doc.set_title(_("Section %s") % n)
@ -884,10 +884,10 @@ class WebReport(Report.Report):
col_len = n_rows
for person_handle in p_id_list:
name = self.db.try_to_find_person_from_handle(person_handle).get_primary_name().get_name()
name = self.db.get_person_from_handle(person_handle).get_primary_name().get_name()
if self.birth_dates:
birth_handle = self.db.try_to_find_person_from_handle(person_handle).get_birth_handle()
birth_handle = self.db.get_person_from_handle(person_handle).get_birth_handle()
if birth_handle:
birth_event = self.db.find_event_from_handle(birth_handle)
if self.year_only:
@ -925,8 +925,8 @@ class WebReport(Report.Report):
col_len = n_rows
for n in link_keys:
p_id_list = [ p_id for p_id in person_handle_list if \
(self.db.try_to_find_person_from_handle(p_id).get_primary_name().get_surname() \
and (self.db.try_to_find_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ]
(self.db.get_person_from_handle(p_id).get_primary_name().get_surname() \
and (self.db.get_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ]
doc.start_paragraph('IndexLabel')
if self.include_alpha_links:
doc.write_linktarget("%03d" % a[n])
@ -935,10 +935,10 @@ class WebReport(Report.Report):
col_len = col_len - 1
for person_handle in p_id_list:
name = self.db.try_to_find_person_from_handle(person_handle).get_primary_name().get_name()
name = self.db.get_person_from_handle(person_handle).get_primary_name().get_name()
if self.birth_dates:
birth_handle = self.db.try_to_find_person_from_handle(person_handle).get_birth_handle()
birth_handle = self.db.get_person_from_handle(person_handle).get_birth_handle()
if birth_handle:
birth_event = self.db.find_event_from_handle(birth_handle)
if self.year_only:
@ -1021,7 +1021,7 @@ class WebReport(Report.Report):
for l in ind_list:
my_map[l] = l
for person_handle in ind_list:
person = self.db.try_to_find_person_from_handle(person_handle)
person = self.db.get_person_from_handle(person_handle)
tdoc = HtmlLinkDoc(self.selected_style,None,None,None,doc)
tdoc.set_extension(self.ext)
tdoc.set_keywords([person.get_primary_name().get_surname(),
@ -1598,13 +1598,13 @@ class MiniTree:
mother_indent = indent[:-1] + ' ' + ' ' * len(name) + '|'
if father_handle:
father = self.db.try_to_find_person_from_handle(father_handle)
father = self.db.get_person_from_handle(father_handle)
next_pos = position - offset
self.lines_map[position] += '|'
self.draw_parents(father,next_pos,father_indent,generations,1)
if mother_handle:
mother = self.db.try_to_find_person_from_handle(mother_handle)
mother = self.db.get_person_from_handle(mother_handle)
next_pos = position + offset
self.draw_parents(mother,next_pos,mother_indent,generations,0)

View File

@ -146,7 +146,7 @@ class PackageWriter:
return
for obj_id in self.db.get_object_keys():
obj = self.db.try_to_find_object_from_handle(obj_id)
obj = self.db.get_object_from_handle(obj_id)
oldfile = obj.get_path()
root = os.path.basename(oldfile)
if os.path.isfile(oldfile):
@ -210,7 +210,7 @@ class PackageWriter:
self.db.commit_family(p,None)
for key in self.db.get_person_keys():
p = self.db.try_to_find_person_from_handle(key)
p = self.db.get_person_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == self.object_handle:
@ -218,7 +218,7 @@ class PackageWriter:
p.set_media_list(nl)
self.db.commit_person(p,None)
for key in self.db.get_source_keys():
p = self.db.try_to_find_source_from_handle(key)
p = self.db.get_source_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == self.object_handle:
@ -226,7 +226,7 @@ class PackageWriter:
p.set_media_list(nl)
self.db.commit_source(p,None)
for key in self.db.get_place_handle_keys():
p = self.db.try_to_find_place_from_handle(key)
p = self.db.get_place_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == self.object_handle:
@ -273,7 +273,7 @@ class PackageWriter:
# during the process (i.e. when removing object)
for obj_id in self.db.get_object_keys():
obj = self.db.try_to_find_object_from_handle(obj_id)
obj = self.db.get_object_from_handle(obj_id)
oldfile = obj.get_path()
root = os.path.basename(oldfile)
if os.path.isfile(oldfile):

View File

@ -164,7 +164,7 @@ class FtreeWriter:
id_map = {}
id_name = {}
for key in self.plist:
pn = self.db.get_person(key).get_primary_name()
pn = self.db.get_person_from_handle(key).get_primary_name()
fn = ""
sn = pn.get_surname()
items = pn.get_first_name().split()
@ -191,7 +191,7 @@ class FtreeWriter:
f = open(filename,"w")
for key in self.plist:
p = self.db.get_person(key)
p = self.db.get_person_from_handle(key)
name = id_name[key]
father = ""
mother = ""

View File

@ -93,7 +93,7 @@ class PackageWriter:
p.set_media_list(nl)
self.db.commit_family(p,None)
for key in self.db.get_person_keys():
p = self.db.try_to_find_person_from_handle(key)
p = self.db.get_person_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == m_id:
@ -101,7 +101,7 @@ class PackageWriter:
p.set_media_list(nl)
self.db.commit_person(p,None)
for key in self.db.get_source_keys():
p = self.db.try_to_find_source_from_handle(key)
p = self.db.get_source_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == m_id:
@ -109,7 +109,7 @@ class PackageWriter:
p.set_media_list(nl)
self.db.commit_source(p,None)
for key in self.db.get_place_handle_keys():
p = self.db.try_to_find_place_from_handle(key)
p = self.db.get_place_from_handle(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_handle() == m_id:
@ -157,7 +157,7 @@ class PackageWriter:
# Write media files first, since the database may be modified
# during the process (i.e. when removing object)
for m_id in self.db.get_object_keys():
mobject = self.db.try_to_find_object_from_handle(m_id)
mobject = self.db.get_object_from_handle(m_id)
oldfile = mobject.get_path()
base = os.path.basename(oldfile)
if os.path.isfile(oldfile):