* various: Updated cleaned up API

svn: r3388
This commit is contained in:
Don Allingham 2004-08-13 04:34:07 +00:00
parent 35105859a1
commit 3a9130f5ad
60 changed files with 1992 additions and 2186 deletions

View File

@ -1,3 +1,6 @@
2004-08-12 Don Allingham <dallingham@users.sourceforge.net>
* various: Updated cleaned up API
2004-08-11 Don Allingham <dallingham@users.sourceforge.net>
* src/GenericFilter.py: fixed find/get_family_from_handle
* src/WriteGedcom.py: fixed find/get_family_from_handle

View File

@ -124,7 +124,7 @@ class AddMediaObject:
mobj.set_description(description)
mobj.set_mime_type(mtype)
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.add_object(mobj,trans)
name = filename
@ -132,7 +132,7 @@ class AddMediaObject:
self.object = mobj
self.db.commit_media_object(mobj,trans)
self.db.add_transaction(trans,_("Add Media Object"))
self.db.transaction_commit(trans,_("Add Media Object"))
if self.update:
self.update()

View File

@ -212,11 +212,11 @@ class AddSpouse:
been closed.
"""
person = epo.person
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
handle = self.db.add_person(person,trans)
n = person.get_primary_name().get_name()
self.db.add_transaction(trans,_('Add Person (%s)' % n))
self.db.transaction_commit(trans,_('Add Person (%s)' % n))
self.addperson(person)
self.update_data(handle)
@ -252,10 +252,11 @@ class AddSpouse:
Utils.destroy_passed_object(obj)
return
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
if not self.active_family:
self.active_family = self.db.new_family(trans)
self.active_family = RelLib.Family()
self.db.add_family(family,trans)
self.person.add_family_handle(self.active_family.get_handle())
self.db.commit_person(self.person,trans)
@ -272,7 +273,7 @@ class AddSpouse:
rtype = self.rel_combo.get_active()
self.active_family.set_relationship(rtype)
self.db.commit_family(self.active_family,trans)
self.db.add_transaction(trans,_("Add Spouse"))
self.db.transaction_commit(trans,_("Add Spouse"))
Utils.destroy_passed_object(obj)
self.update(self.active_family)

View File

@ -414,7 +414,7 @@ class ArgHandler:
try:
# 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():
for m_id in self.parent.db.get_media_object_handles():
mobject = self.parent.db.get_object_from_handle(m_id)
oldfile = mobject.get_path()
base = os.path.basename(oldfile)

View File

@ -316,7 +316,7 @@ class ChooseParents:
self.father_nsort.reset_visible()
self.build_exclude_list()
for pid in self.db.get_person_keys():
for pid in self.db.get_person_handles(sort_handles=False):
person = self.db.get_person_from_handle(pid)
visible = self.father_filter(person)
if visible:
@ -339,7 +339,7 @@ class ChooseParents:
self.mother_nsort.reset_visible()
self.build_exclude_list()
for pid in self.db.get_person_keys():
for pid in self.db.get_person_handles(sort_handles=False):
person = self.db.get_person_from_handle(pid)
visible = self.mother_filter(person)
if visible:
@ -385,7 +385,7 @@ class ChooseParents:
if not father_handle and not mother_handle:
return None
for family_handle in self.db.get_family_keys():
for family_handle in self.db.get_family_handles():
family = self.db.find_family_from_handle(family_handle)
if family.get_father_handle() == father_handle and family.get_mother_handle() == mother_handle:
family.add_child_handle(self.person.get_handle())
@ -396,10 +396,11 @@ class ChooseParents:
self.db.commit_family(family,trans)
return family
family = self.db.new_family(trans)
family = RelLib.Family()
family.set_father_handle(father_handle)
family.set_mother_handle(mother_handle)
family.add_child_handle(self.person.get_handle())
self.db.add_family(family,trans)
if father_handle:
self.father = self.db.get_person_from_handle(father_handle)
@ -515,7 +516,7 @@ class ChooseParents:
except KeyError:
father_rel = const.child_relations.find_value("Birth")
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
if self.father or self.mother:
if self.mother and not self.father:
if self.mother.get_gender() == RelLib.Person.male:
@ -561,7 +562,7 @@ class ChooseParents:
self.change_family_type(self.family,mother_rel,father_rel)
self.db.commit_family(self.family,trans)
self.family_update(None)
self.db.add_transaction(trans,_("Choose Parents"))
self.db.transaction_commit(trans,_("Choose Parents"))
self.close(obj)
def add_new_parent(self,epo,trans):
@ -625,14 +626,14 @@ class ChooseParents:
else:
self.person.add_parent_family_handle(family.get_handle(),mother_rel,father_rel)
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.commit_person(self.person,trans)
self.db.commit_family(family,trans)
if self.father:
self.db.commit_person(self.father,trans)
if self.mother:
self.db.commit_person(self.mother,trans)
self.db.add_transaction(trans,_("Choose Parents"))
self.db.transaction_commit(trans,_("Choose Parents"))
class ModifyParents:
def __init__(self,db,person,family_handle,family_update,full_update,parent_window=None):
@ -752,7 +753,7 @@ class ModifyParents:
mod = 1
if mod:
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.commit_person(self.person,trans)
self.db.add_transaction(trans,_("Modify Parents"))
self.db.transaction_commit(trans,_("Modify Parents"))
self.family_update(None)

View File

@ -125,7 +125,7 @@ class BaseModel(gtk.GenericTreeModel):
class SourceModel(BaseModel):
def __init__(self,db):
self.sort_keys = db.sort_source_keys
self.sort_keys = db.get_source_handles
self.map = db.source_map
self.fmap = [
self.column_title,
@ -163,7 +163,7 @@ class SourceModel(BaseModel):
class PlaceModel(BaseModel):
def __init__(self,db):
self.sort_keys = db.sort_place_keys
self.sort_keys = db.get_place_handles
self.map = db.place_map
self.fmap = [
self.column_name,
@ -232,7 +232,7 @@ class PlaceModel(BaseModel):
class MediaModel(BaseModel):
def __init__(self,db):
self.sort_keys = db.sort_media_keys
self.sort_keys = db.get_media_object_handles
self.map = db.media_map
self.fmap = [

View File

@ -61,6 +61,14 @@ from QuestionDialog import QuestionDialog, WarningDialog, ErrorDialog, SaveDialo
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_PICTURE_WIDTH = 200.0
_temple_names = const.lds_temple_codes.keys()
_temple_names.sort()
_temple_names = [""] + _temple_names
@ -102,8 +110,8 @@ class EditPerson:
person.get_gender () ==
RelLib.Person.unknown)
for key in db.get_place_handle_keys():
p = db.get_place_display(key)
for key in db.get_place_handles():
p = db.get_place_from_handle(key).get_display_info()
self.pdmap[p[0]] = key
self.load_obj = None
@ -287,7 +295,7 @@ class EditPerson:
build_dropdown(self.bplace,self.place_list)
build_dropdown(self.dplace,self.place_list)
build_dropdown(self.surname,self.db.get_surnames())
build_dropdown(self.surname,self.db.get_surname_list())
self.gid.set_text(person.get_gramps_id())
self.gid.set_editable(1)
@ -418,7 +426,7 @@ class EditPerson:
self.top.get_widget('edit_src'),
self.top.get_widget('del_src'))
if self.person.get_complete():
if self.person.get_complete_flag():
self.complete.set_active(1)
self.redraw_event_list()
@ -1092,7 +1100,7 @@ class EditPerson:
changed = 0
name = self.person.get_primary_name()
if self.complete.get_active() != self.person.get_complete():
if self.complete.get_active() != self.person.get_complete_flag():
changed = 1
if self.person.get_gramps_id() != idval:
@ -1412,7 +1420,7 @@ class EditPerson:
try:
i = pixbuf_new_from_file(photo)
ratio = float(max(i.get_height(),i.get_width()))
scale = float(const.picWidth)/ratio
scale = float(_PICTURE_WIDTH)/ratio
x = int(scale*(i.get_width()))
y = int(scale*(i.get_height()))
i = i.scale_simple(x,y,INTERP_BILINEAR)
@ -1434,7 +1442,7 @@ class EditPerson:
def on_apply_person_clicked(self,obj):
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
surname = unicode(self.surname.get_text())
suffix = unicode(self.suffix.get_text())
@ -1495,8 +1503,8 @@ class EditPerson:
self.person.set_nick_name(nick)
self.pdmap.clear()
for key in self.db.get_place_handle_keys():
p = self.db.get_place_display(key)
for key in self.db.get_place_handles():
p = self.db.get_place_from_handle(key).get_display_info()
self.pdmap[p[0]] = key
if self.orig_birth == None:
@ -1581,8 +1589,8 @@ class EditPerson:
if format != self.person.get_note_format():
self.person.set_note_format(format)
if self.complete.get_active() != self.person.get_complete():
self.person.set_complete(self.complete.get_active())
if self.complete.get_active() != self.person.get_complete_flag():
self.person.set_complete_flag(self.complete.get_active())
if self.lds_not_loaded == 0:
self.check_lds()
@ -1607,7 +1615,7 @@ class EditPerson:
self.db.commit_person(self.person, trans)
n = self.person.get_primary_name().get_regular_name()
self.db.add_transaction(trans,_("Edit Person (%s)") % n)
self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
self.close()
def get_place(self,field,makenew=0):
@ -1618,9 +1626,9 @@ class EditPerson:
elif makenew:
place = RelLib.Place()
place.set_title(text)
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.add_place(place,trans)
self.db.add_transaction(trans,_('Add Place (%s)' % text))
self.db.transaction_commit(trans,_('Add Place (%s)' % text))
self.pdmap[text] = place.get_handle()
self.add_places.append(place)
return place.get_handle()

View File

@ -201,7 +201,7 @@ class EditPlace:
self.top_window.get_widget('edit_src'),
self.top_window.get_widget('del_src'))
if self.place.get_handle() == "":
if self.place.get_handle() == None:
self.top_window.get_widget("add_photo").set_sensitive(0)
self.top_window.get_widget("delete_photo").set_sensitive(0)
@ -368,9 +368,9 @@ class EditPlace:
self.update_lists()
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.commit_place(self.place,trans)
self.db.add_transaction(trans,_("Edit Place (%s)") % self.place.get_title())
self.db.transaction_commit(trans,_("Edit Place (%s)") % self.place.get_title())
if self.callback:
self.callback(self.place)
@ -477,13 +477,13 @@ class EditPlace:
pevent = []
fevent = []
msg = ""
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
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:
pevent.append((p,event))
for family_handle in self.db.get_family_keys():
for family_handle in self.db.get_family_handles():
f = self.db.get_family_from_handle(family_handle)
for event_handle in f.get_event_list():
event = self.db.find_event_from_handle(event_handle)
@ -555,11 +555,11 @@ class DeletePlaceQuery:
self.update = update
def query_response(self):
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.remove_place(self.place.get_handle(),trans)
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
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)
@ -567,7 +567,7 @@ class DeletePlaceQuery:
event.set_place_handle(None)
self.db.commit_event(event,trans)
for fid in self.db.get_family_keys():
for fid in self.db.get_family_handles():
f = self.db.get_family_from_handle(fid)
for event_handle in f.get_event_list():
event = self.db.find_event_from_handle(event_handle)
@ -575,5 +575,5 @@ class DeletePlaceQuery:
event.set_place_handle(None)
self.db.commit_event(event,trans)
self.db.add_transaction(trans,_("Delete Place (%s)") % self.place.get_title())
self.db.transaction_commit(trans,_("Delete Place (%s)") % self.place.get_title())
self.update(None)

View File

@ -121,7 +121,7 @@ class EditSource:
"on_sourceEditor_delete_event" : self.on_delete_event,
})
if self.source.get_handle() == "":
if self.source.get_handle() == None:
self.top_window.get_widget("edit_photo").set_sensitive(0)
self.top_window.get_widget("delete_photo").set_sensitive(0)
@ -190,13 +190,13 @@ class EditSource:
f_event_list = []
f_attr_list = []
p_list = []
for key in self.db.get_place_handle_keys():
for key in self.db.get_place_handles():
p = self.db.get_place_from_handle(key)
name = p.get_title()
for sref in p.get_source_references():
if sref.get_base_handle() == self.source.get_handle():
p_list.append(name)
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
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()]:
@ -217,13 +217,13 @@ class EditSource:
for sref in v.get_source_references():
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():
for object_handle in self.db.get_media_object_handles():
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():
m_list.append(name)
for family_handle in self.db.get_family_keys():
for family_handle in self.db.get_family_handles():
family = self.db.get_family_from_handle(family_handle)
f_id = family.get_father_handle()
m_id = family.get_mother_handle()
@ -327,9 +327,9 @@ class EditSource:
self.gallery_ok = 1
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.commit_source(self.source,trans)
self.db.add_transaction(trans,_("Edit Source (%s)") % title)
self.db.transaction_commit(trans,_("Edit Source (%s)") % title)
if self.callback:
self.callback(self.source)
@ -369,9 +369,9 @@ class DelSrcQuery:
return m
def query_response(self):
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
commit = 0
p = self.db.get_person_from_handle(key)
for v_id in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]:
@ -390,7 +390,7 @@ class DelSrcQuery:
if commit > 0:
self.db.commit_person(p,trans)
for p_id in self.db.get_family_keys():
for p_id in self.db.get_family_handles():
commit = 0
p = self.db.find_family_from_handle(p_id)
for v_id in p.get_event_list():
@ -403,16 +403,16 @@ class DelSrcQuery:
if commit > 0:
self.db.commit_family(p,trans)
for p_id in self.db.get_object_keys():
for p_id in self.db.get_media_object_handles():
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():
for key in self.db.get_place_handles():
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)
self.db.add_transaction(trans,_("Delete Source (%s)") % self.source.get_title())
self.db.remove_source(self.source.get_handle(),trans)
self.db.transaction_commit(trans,_("Delete Source (%s)") % self.source.get_title())
self.update()

View File

@ -81,14 +81,14 @@ class EventEditor:
values = {}
for v in elist:
values[v] = 1
for v in self.db.get_eventnames():
for v in self.db.get_person_event_type_list():
values[v] = 1
self.elist = values.keys()
self.elist.sort()
for key in self.parent.db.get_place_handle_keys():
p = self.parent.db.get_place_display(key)
for key in self.parent.db.get_place_handles():
p = self.parent.db.get_place_from_handle(key).get_display_info()
self.pmap[p[0]] = key
if event:
@ -302,7 +302,7 @@ class EventEditor:
def on_event_edit_ok_clicked(self,obj):
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
ename = unicode(self.event_menu.child.get_text())
self.date.set(unicode(self.date_field.get_text()))
@ -331,7 +331,7 @@ class EventEditor:
self.update_event(ename,self.date,eplace_obj,edesc,enote,eformat,
epriv,ecause,trans)
self.db.add_transaction(trans,_("Edit Event"))
self.db.transaction_commit(trans,_("Edit Event"))
self.close(obj)
self.parent.redraw_event_list()
self.callback(self.event)

View File

@ -550,10 +550,10 @@ class FamilyView:
def set_preferred_spouse(self,obj):
if self.selected_spouse:
self.person.set_preferred_family_handle(self.family)
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
self.parent.db.commit_person(self.person,trans)
n = self.person.get_primary_name().get_regular_name()
self.parent.db.add_transaction(trans,_("Set Preferred Spouse (%s)") % n)
self.parent.db.transaction_commit(trans,_("Set Preferred Spouse (%s)") % n)
self.load_family()
def edit_spouse_callback(self,obj):
@ -622,7 +622,7 @@ class FamilyView:
if epo:
self.parent.db.commit_person(epo.person,trans)
n = epo.person.get_primary_name().get_regular_name()
self.parent.db.add_transaction(trans,_("Add Person (%s)") % n)
self.parent.db.transaction_commit(trans,_("Add Person (%s)") % n)
self.parent.people_view.remove_from_person_list(epo.person)
self.parent.people_view.redisplay_person_list(epo.person)
@ -632,7 +632,8 @@ class FamilyView:
def new_spouse_after_edit(self,epo,trans):
self.parent.db.add_person(epo.person,trans)
self.family = self.parent.db.new_family(trans)
self.family = RelLib.Family()
self.parent.db.add_family(self.family,trans)
self.parent.people_view.add_to_person_list(epo.person,0)
self.person.add_family_handle(self.family.get_handle())
@ -681,8 +682,11 @@ class FamilyView:
DisplayTrace.DisplayTrace()
def update_person_list(self,person):
trans = self.db.transaction_begin()
if not self.family:
self.family = self.parent.db.new_family()
self.family = RelLib.Family()
self.parent.db.add_family(self.family,trans)
person.add_family_handle(self.family.get_handle())
if person.get_gender() == RelLib.Person.male:
self.family.set_father_handle(person)
@ -693,6 +697,9 @@ class FamilyView:
person.add_parent_family_handle(self.family.get_handle(),"Birth","Birth")
self.parent.update_person_list(person)
self.load_family(self.family)
self.db.commit_person(person,trans)
self.db.commit_family(self.family,trans)
self.db.transaction_commit(trans,_("Modify family"))
def new_child_after_edit(self,epo,trans):
@ -700,7 +707,8 @@ class FamilyView:
self.parent.people_view.add_to_person_list(epo.person,0)
if not self.family:
self.family = self.parent.db.new_family()
self.family = RelLib.Family()
self.parent.db.add_family(self.family,trans)
self.person.add_family_handle(self.family.get_handle())
if self.person.get_gender() == RelLib.Person.male:
self.family.set_father_handle(self.person.get_handle())
@ -734,7 +742,7 @@ class FamilyView:
id = self.child_model.get_value(iter,7)
child = self.parent.db.get_person_from_handle(id)
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
self.family.remove_child_handle(child.get_handle())
child.remove_parent_family_handle(self.family.get_handle())
@ -748,7 +756,7 @@ class FamilyView:
self.parent.db.commit_person(child,trans)
self.parent.db.commit_family(self.family,trans)
n = child.get_primary_name().get_regular_name()
self.parent.db.add_transaction(trans,_("Remove Child (%s)") % n)
self.parent.db.transaction_commit(trans,_("Remove Child (%s)") % n)
self.load_family()
@ -775,7 +783,7 @@ class FamilyView:
else:
self.family.set_mother_handle(None)
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
if self.selected_spouse:
self.selected_spouse.remove_family_handle(self.family.get_handle())
@ -796,7 +804,7 @@ class FamilyView:
else:
self.load_family(self.family)
n = self.person.get_primary_name().get_regular_name()
self.parent.db.add_transaction(trans,_("Remove Spouse (%s)") % n)
self.parent.db.transaction_commit(trans,_("Remove Spouse (%s)") % n)
if len(self.person.get_family_handle_list()) <= 1:
self.spouse_selection.set_mode(gtk.SELECTION_NONE)
@ -825,7 +833,7 @@ class FamilyView:
model, iter = self.ap_selection.get_selected()
path = model.get_path(iter)
family_handle,m,r = plist[path[0]]
family = self.parent.db.find_family_from_handle(family_handle)
family = self.parent.db.get_family_from_handle(family_handle)
if family.get_father_handle():
person_handle = family.get_father_handle()
@ -835,9 +843,9 @@ class FamilyView:
self.parent.change_active_person(person)
n = person.get_primary_name().get_name()
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
self.parent.db.commit_family(family,trans)
self.parent.db.add_transaction(trans,_("Select Parents (%s)") % n)
self.parent.db.transaction_commit(trans,_("Select Parents (%s)") % n)
self.load_family(family)
def clear(self):
@ -899,7 +907,7 @@ class FamilyView:
for f in splist:
if not f:
continue
fm = self.parent.db.find_family_from_handle(f,None)
fm = self.parent.db.get_family_from_handle(f)
if fm.get_father_handle() == self.person.get_handle():
sp_id = fm.get_mother_handle()
@ -982,7 +990,7 @@ class FamilyView:
return _("%s: unknown") % (l)
def delete_family_from(self,person):
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
person.remove_family_handle(self.family.get_handle(),trans)
self.parent.db.delete_family(self.family.get_handle(),trans)
flist = self.person.get_family_handle_list()
@ -991,7 +999,7 @@ class FamilyView:
else:
self.family = None
n = person.get_primary_name().get_name()
self.parent.db.add_transaction(trans,_("Remove from family (%s)") % n)
self.parent.db.transaction_commit(trans,_("Remove from family (%s)") % n)
def display_marriage(self,family):
self.child_model.clear()
@ -1040,7 +1048,7 @@ class FamilyView:
if fiter == None:
fiter = self.child_model.get_path(iter)
val = self.parent.db.get_person_display(child.get_handle())
val = child.get_display_info()
i += 1
event = self.parent.db.find_event_from_handle(val[3])
@ -1267,7 +1275,7 @@ class FamilyView:
if not person:
return
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
plist = person.get_parent_family_handle_list()
if len(plist) == 0:
@ -1300,7 +1308,7 @@ class FamilyView:
self.parent.db.commit_person(person,trans)
n = person.get_primary_name().get_regular_name()
self.parent.db.add_transaction(trans,_("Remove Parents (%s)") % n)
self.parent.db.transaction_commit(trans,_("Remove Parents (%s)") % n)
self.load_family()
@ -1336,9 +1344,9 @@ class FamilyView:
_("Children must be ordered by their birth dates."))
return
self.family.set_child_handle_list(list)
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
self.parent.db.commit_family(self.family,trans)
self.parent.db.add_transaction(trans,_('Reorder children'))
self.parent.db.transaction_commit(trans,_('Reorder children'))
self.display_marriage(self.family)
def drag_data_get(self,widget, context, sel_data, info, time):

View File

@ -1,219 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""interface for opening a find person dialog for gramps
"""
__author__ = 'Don Allingham'
#-------------------------------------------------------------------------
#
# python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import Utils
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# FindBase
#
#-------------------------------------------------------------------------
class FindBase:
"""Opens find person dialog for gramps"""
def __init__(self,task,name,db,valid_map=None):
"""Opens a dialog box instance that allows users to
search for a person.
task - function to call to change the active person"""
self.t = type(u' ')
self.db = db
self.task = task
self.glade = gtk.glade.XML(const.gladeFile,"find","gramps")
self.glade.signal_autoconnect({
'on_next_clicked' : self.on_next_clicked,
'on_back_clicked' : self.on_prev_clicked,
'on_close_clicked' : self.on_close_clicked,
})
self.top = self.glade.get_widget('find')
self.top.connect('delete_event',self.on_destroy)
self.entry = self.glade.get_widget('entry')
self.forward_button = self.glade.get_widget('forward')
self.back_button = self.glade.get_widget('back')
Utils.set_titles(self.top, self.glade.get_widget('title'), name)
self.list = None
self.index = 0
self.visible = 1
self.valid = valid_map
def get_value(self,id):
return id
def advance(self,func):
text = unicode(self.entry.get_text().upper())
orow = self.index
func()
while self.index != orow:
vals = self.list[self.index]
id = vals[1]
name = vals[0]
if id == None:
func()
continue
if self.valid and not self.valid.has_key(id):
func()
continue
if string.find(name.upper(),text) >= 0:
self.back_button.set_sensitive(0)
self.forward_button.set_sensitive(0)
self.task(self.get_value(id))
self.back_button.set_sensitive(1)
self.forward_button.set_sensitive(1)
return
func()
def forward(self):
self.index = self.index + 1
if self.index == len(self.list):
self.index = 0
def backward(self):
self.index = self.index - 1
if self.index < 0:
self.index = len(self.list)-1
def on_close_clicked(self,obj):
"""Destroys the window in response to a close window button press"""
self.visible = 0
self.top.hide()
def on_destroy(self,obj,event):
self.on_close_clicked(obj)
return 1
def show(self):
self.top.window.raise_()
self.top.show()
self.entry.grab_focus ()
def on_next_clicked(self,obj):
"""Advances to the next person that matches the dialog text"""
self.advance(self.forward)
def on_prev_clicked(self,obj):
"""Advances to the previous person that matches the dialog text"""
self.advance(self.backward)
#-------------------------------------------------------------------------
#
# FindPerson
#
#-------------------------------------------------------------------------
class FindPerson(FindBase):
"""Opens a Find Person dialog for GRAMPS"""
def __init__(self,task,db,valid_map):
"""Opens a dialog box instance that allows users to
search for a person.
task - function to call to change the active person"""
FindBase.__init__(self,task,_("Find Person"),db,valid_map)
self.list = []
for val in db.sort_person_keys():
self.list.append(db.get_person_display(val))
def get_value(self,id):
return self.db.get_person_from_handle(id)
#-------------------------------------------------------------------------
#
# FindPlace
#
#-------------------------------------------------------------------------
class FindPlace(FindBase):
"""Opens a Find Place dialog for GRAMPS"""
def __init__(self,task,db):
"""Opens a dialog box instance that allows users to
search for a place.
task - function to call to change the active person"""
FindBase.__init__(self,task,_("Find Place"),db)
self.list = db.placeTable.values()
self.list.sort()
#-------------------------------------------------------------------------
#
# FindSource
#
#-------------------------------------------------------------------------
class FindSource(FindBase):
"""Opens a Find Place dialog for GRAMPS"""
def __init__(self,task,db):
"""Opens a dialog box instance that allows users to
search for a place.
task - function to call to change the active person"""
FindBase.__init__(self,task,_("Find Source"),db)
self.list = db.sourceTable.values()
self.list.sort()
#-------------------------------------------------------------------------
#
# FindMedia
#
#-------------------------------------------------------------------------
class FindMedia(FindBase):
"""Opens a Find Media Object dialog for GRAMPS"""
def __init__(self,task,db):
"""Opens a dialog box instance that allows users to
search for a place.
task - function to call to change the active person"""
FindBase.__init__(self,task,_("Find Media Object"),db)
self.list = []
for n in self.db.get_object_map().values():
self.list.append((n.get_description(),n.get_handle()))
self.list.sort()

View File

@ -279,7 +279,7 @@ class HasCompleteRecord(Rule):
return _('Matches all people whose records are complete')
def apply(self,db,p_id):
return db.get_person_from_handle(p_id).get_complete() == 1
return db.get_person_from_handle(p_id).get_complete_flag() == 1
#-------------------------------------------------------------------------
#
@ -393,7 +393,7 @@ class IsDescendantOfFilterMatch(IsDescendantOf):
if not self.init:
self.init = 1
filter = MatchesFilter(self.list)
for person_handle in db.get_person_keys():
for person_handle in db.get_person_handles(sort_handles=False):
if filter.apply (db, person_handle):
self.init_list (person_handle, first)
return self.map.has_key(p_id)
@ -524,7 +524,7 @@ class IsChildOfFilterMatch(Rule):
if not self.init:
self.init = 1
filter = MatchesFilter(self.list)
for person_handle in db.get_person_keys():
for person_handle in db.get_person_handles(sort_handles=False):
if filter.apply (db, person_handle):
self.init_list (person_handle)
return self.map.has_key(p_id)
@ -682,7 +682,7 @@ class IsAncestorOfFilterMatch(IsAncestorOf):
if not self.init:
self.init = 1
filter = MatchesFilter(self.list[0])
for person_handle in db.get_person_keys():
for person_handle in db.get_person_handles(sort_handles=False):
if filter.apply (db, person_handle):
self.init_ancestor_list (person_handle,first)
return self.map.has_key(p_id)
@ -827,7 +827,7 @@ class IsParentOfFilterMatch(Rule):
if not self.init:
self.init = 1
filter = MatchesFilter(self.list)
for person_handle in db.get_person_keys():
for person_handle in db.get_person_handles(sort_handles=False):
if filter.apply (db, person_handle):
self.init_list (person_handle)
return self.map.has_key(p_id)
@ -912,7 +912,7 @@ class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith):
def init_ancestor_cache(self,db):
filter = MatchesFilter(self.list)
def init(self,pid): self.ancestor_cache[pid] = 1
for p_id in db.get_person_keys():
for p_id in db.get_person_handles(sort_handles=False):
if (not self.ancestor_cache.has_key (p_id)
and filter.apply (db, p_id)):
for_each_ancestor([p_id],init,self)

View File

@ -124,7 +124,7 @@ class GrampsBSDDB(GrampsDbBase):
self.env = None
self.metadata = None
def get_surnames(self):
def get_surname_list(self):
names = self.surnames.keys()
a = {}
for name in names:
@ -133,7 +133,7 @@ class GrampsBSDDB(GrampsDbBase):
vals.sort()
return vals
def get_eventnames(self):
def get_person_event_type_list(self):
names = self.eventnames.keys()
a = {}
for name in names:
@ -142,20 +142,26 @@ class GrampsBSDDB(GrampsDbBase):
vals.sort()
return vals
def remove_person_handle(self,handle,transaction):
def remove_person(self,handle,transaction):
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)
self.person_map.delete(handle)
def remove_source_handle(self,handle,transaction):
def remove_source(self,handle,transaction):
if transaction != None:
old_data = self.source_map.get(str(handle))
transaction.add(SOURCE_KEY,handle,old_data)
self.source_map.delete(str(handle))
def remove_event_handle(self,handle,transaction):
def remove_family_handle(self,handle,transaction):
if transaction != None:
old_data = self.family_map.get(str(handle))
transaction.add(FAMILY_KEY,handle,old_data)
self.family_map.delete(str(handle))
def remove_event(self,handle,transaction):
if transaction != None:
old_data = self.event_map.get(str(handle))
transaction.add(EVENT_KEY,handle,old_data)

View File

@ -265,22 +265,22 @@ def save_usetips(val):
set_bool("/apps/gramps/behavior/use-tips",val)
# preferences keys
def get_iprefix():
def get_person_id_prefix():
return get_string("/apps/gramps/preferences/iprefix")
def get_eprefix():
def get_event_id_prefix():
return get_string("/apps/gramps/preferences/iprefix")
def save_iprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/iprefix",val)
def get_oprefix():
def get_object_id_prefix():
return get_string("/apps/gramps/preferences/oprefix")
def save_oprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/oprefix",val)
def get_sprefix():
def get_source_id_prefix():
return get_string("/apps/gramps/preferences/sprefix")
def save_sprefix(val):
@ -289,13 +289,13 @@ def save_sprefix(val):
def save_eprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/eprefix",val)
def get_pprefix():
def get_place_id_prefix():
return get_string("/apps/gramps/preferences/pprefix")
def save_pprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/pprefix",val)
def get_fprefix():
def get_family_id_prefix():
return get_string("/apps/gramps/preferences/fprefix")
def save_fprefix(val):
@ -741,19 +741,19 @@ class GrampsPreferences:
index_vis.connect('toggled',lambda obj: save_index_visible(obj.get_active()))
ipr = self.top.get_widget("iprefix")
ipr.set_text(get_iprefix())
ipr.set_text(get_person_id_prefix())
ipr.connect('changed',lambda obj: save_iprefix(obj.get_text()))
opr = self.top.get_widget("oprefix")
opr.set_text(get_oprefix())
opr.set_text(get_object_id_prefix())
opr.connect('changed',lambda obj: save_oprefix(obj.get_text()))
fpr = self.top.get_widget("fprefix")
fpr.set_text(get_fprefix())
fpr.set_text(get_family_id_prefix())
fpr.connect('changed',lambda obj: save_fprefix(obj.get_text()))
spr = self.top.get_widget("sprefix")
spr.set_text(get_sprefix())
spr.set_text(get_source_id_prefix())
spr.connect('changed',lambda obj: save_sprefix(obj.get_text()))
ppr = self.top.get_widget("pprefix")
ppr.set_text(get_pprefix())
ppr.set_text(get_place_id_prefix())
ppr.connect('changed',lambda obj: save_pprefix(obj.get_text()))
sb2 = self.top.get_widget("stat2")

File diff suppressed because it is too large Load Diff

View File

@ -63,16 +63,16 @@ class GrampsGEDDB(GrampsDbBase):
writer = WriteGedcom.GedcomWriter(self,self.get_default_person())
writer.export_data(self.filename)
def get_surnames(self):
def get_surname_list(self):
a = {}
for person_id in self.get_person_keys():
for person_id in self.get_person_handles(sort_handles=False):
p = self.get_person_from_handle(person_id)
a[p.get_primary_name().get_surname()] = 1
vals = a.keys()
vals.sort()
return vals
def get_eventnames(self):
def get_person_event_type_list(self):
names = self.eventnames.keys()
a = {}
for name in names:
@ -81,20 +81,26 @@ class GrampsGEDDB(GrampsDbBase):
vals.sort()
return vals
def remove_person_handle(self,handle,transaction):
def remove_person(self,handle,transaction):
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)
del self.person_map[handle]
def remove_source_handle(self,handle,transaction):
def remove_source(self,handle,transaction):
if transaction != None:
old_data = self.source_map.get(str(handle))
transaction.add(SOURCE_KEY,handle,old_data)
del self.source_map[str(handle)]
def remove_event_handle(self,handle,transaction):
def remove_family_handle(self,handle,transaction):
if transaction != None:
old_data = self.family_map.get(str(handle))
transaction.add(FAMILY_KEY,handle,old_data)
del self.family_map[str(handle)]
def remove_event(self,handle,transaction):
if transaction != None:
old_data = self.event_map.get(str(handle))
transaction.add(EVENT_KEY,handle,old_data)

View File

@ -71,16 +71,16 @@ class GrampsXMLDB(GrampsDbBase):
def close(self):
WriteXML.quick_write(self,self.filename)
def get_surnames(self):
def get_surname_list(self):
a = {}
for person_id in self.get_person_keys():
for person_id in self.get_person_handles(sort_handles=False):
p = self.get_person_from_handle(person_id)
a[p.get_primary_name().get_surname()] = 1
vals = a.keys()
vals.sort()
return vals
def get_eventnames(self):
def get_person_event_type_list(self):
names = self.eventnames.keys()
a = {}
for name in names:
@ -89,20 +89,26 @@ class GrampsXMLDB(GrampsDbBase):
vals.sort()
return vals
def remove_person_handle(self,handle,transaction):
def remove_person(self,handle,transaction):
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)
del self.person_map[handle]
def remove_source_handle(self,handle,transaction):
def remove_source(self,handle,transaction):
if transaction != None:
old_data = self.source_map.get(str(handle))
transaction.add(SOURCE_KEY,handle,old_data)
del self.source_map[str(handle)]
def remove_event_handle(self,handle,transaction):
def remove_family_handle(self,handle,transaction):
if transaction != None:
old_data = self.family_map.get(str(handle))
transaction.add(FAMILY_KEY,handle,old_data)
del self.family_map[str(handle)]
def remove_event(self,handle,transaction):
if transaction != None:
old_data = self.event_map.get(str(handle))
transaction.add(EVENT_KEY,handle,old_data)

View File

@ -168,8 +168,8 @@ class ImageSelect:
already_imported = None
trans = self.db.start_transaction()
for o_id in self.db.get_object_keys():
trans = self.db.transaction_begin()
for o_id in self.db.get_media_object_handles():
o = self.db.get_object_from_handle(o_id)
if o.get_path() == filename:
already_imported = o
@ -194,7 +194,7 @@ class ImageSelect:
mobj.set_path(filename)
self.db.commit_media_object(mobj,trans)
self.db.add_transaction(trans,'Edit Media Objects')
self.db.transaction_commit(trans,'Edit Media Objects')
self.parent.lists_changed = 1
self.load_images()
@ -819,9 +819,9 @@ class LocalMediaProperties:
self.parent.lists_changed = 1
self.parent.parent.lists_changed = 1
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.commit_media_object(self.object,trans)
self.db.add_transaction(trans,_("Edit Media Object"))
self.db.transaction_commit(trans,_("Edit Media Object"))
def on_help_clicked(self, obj):
"""Display the relevant portion of GRAMPS manual"""
@ -1056,25 +1056,25 @@ class GlobalMediaProperties:
self.refmodel = ListModel.ListModel(self.change_dialog.get_widget("refinfo"),
titles,event_func=self.button_press)
any = 0
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
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)])
any = 1
for key in self.db.get_family_keys():
for key in self.db.get_family_handles():
p = self.db.find_family_from_handle(key)
for o in p.get_media_list():
if o.get_reference_handle() == self.object.get_handle():
self.refmodel.add([_("Family"),p.get_handle(),Utils.family_name(p,self.db)])
any = 1
for key in self.db.get_source_keys():
for key in self.db.get_source_handles():
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():
for key in self.db.get_place_handles():
p = self.db.get_place_from_handle(key)
for o in p.get_media_list():
if o.get_reference_handle() == self.object.get_handle():
@ -1111,9 +1111,9 @@ class GlobalMediaProperties:
self.object.set_source_reference_list(self.srcreflist)
if self.update != None:
self.update()
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.commit_media_object(self.object,trans)
self.db.add_transaction(trans,_("Edit Media Object"))
self.db.transaction_commit(trans,_("Edit Media Object"))
def on_help_clicked(self, obj):
"""Display the relevant portion of GRAMPS manual"""
@ -1167,9 +1167,9 @@ class DeleteMediaQuery:
self.update = update
def query_response(self):
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
p = self.db.get_person_from_handle(key)
nl = []
change = 0
@ -1182,7 +1182,7 @@ class DeleteMediaQuery:
p.set_media_list(nl)
self.db.commit_person(p,trans)
for fid in self.db.get_family_keys():
for fid in self.db.get_family_handles():
p = self.db.find_family_from_handle(fid)
nl = []
change = 0
@ -1195,7 +1195,7 @@ class DeleteMediaQuery:
p.set_media_list(nl)
self.db.commit_family(p,trans)
for key in self.db.get_source_keys():
for key in self.db.get_source_handles():
sid = self.db.get_source_from_handle(key)
nl = []
change = 0
@ -1208,7 +1208,7 @@ class DeleteMediaQuery:
p.set_media_list(nl)
self.db.commit_source(p,trans)
for key in self.db.get_place_handle_keys():
for key in self.db.get_place_handles():
p = self.db.get_place_from_handle(key)
nl = []
change = 0
@ -1222,7 +1222,7 @@ class DeleteMediaQuery:
self.db.commit_place(p,trans)
self.db.remove_object(self.media.get_handle(),trans)
self.db.add_transaction(trans,_("Remove Media Object"))
self.db.transaction_commit(trans,_("Remove Media Object"))
if self.update:
self.update()

View File

@ -154,7 +154,6 @@ gdir_PYTHON = \
Errors.py\
EventEdit.py\
FamilyView.py\
Find.py\
FontScale.py\
FrenchRepublic.py\
GedcomInfo.py\

View File

@ -89,8 +89,8 @@ class Marriage:
else:
self.srcreflist = []
for key in db.get_place_handle_keys():
p = db.get_place_display(key)
for key in db.get_place_handles():
p = db.get_place_from_handle(key).get_display_info()
self.pmap[p[0]] = key
self.top = gtk.glade.XML(const.marriageFile,"marriageEditor","gramps")
@ -224,7 +224,7 @@ class Marriage:
self.lds_place.child.set_text("")
self.seal_stat = 0
if self.family.get_complete():
if self.family.get_complete_flag():
self.complete.set_active(1)
self.build_seal_menu()
@ -498,7 +498,7 @@ class Marriage:
if self.type_field.get_active() != self.family.get_relationship():
changed = 1
if self.complete.get_active() != self.family.get_complete():
if self.complete.get_active() != self.family.get_complete_flag():
changed = 1
text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
@ -561,7 +561,7 @@ class Marriage:
def on_close_marriage_editor(self,*obj):
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
idval = unicode(self.gid.get_text())
family = self.family
@ -591,8 +591,8 @@ class Marriage:
if format != self.family.get_note_format():
self.family.set_note_format(format)
if self.complete.get_active() != self.family.get_complete():
self.family.set_complete(self.complete.get_active())
if self.complete.get_active() != self.family.get_complete_flag():
self.family.set_complete_flag(self.complete.get_active())
date = unicode(self.lds_date.get_text())
temple = unicode(self.lds_temple.child.get_text())
@ -628,7 +628,7 @@ class Marriage:
self.update_lists()
self.db.commit_family(self.family,trans)
self.db.add_transaction(trans,_("Edit Marriage"))
self.db.transaction_commit(trans,_("Edit Marriage"))
self.update_fv(self.family)
self.close(1)

View File

@ -87,10 +87,7 @@ class MediaView:
self.topWindow = glade.get_widget("gramps")
self.renderer = gtk.CellRendererText()
if const.nosort_tree:
self.model = DisplayModels.MediaModel(self.db)
else:
self.model = gtk.TreeModelSort(DisplayModels.MediaModel(self.db))
self.model = gtk.TreeModelSort(DisplayModels.MediaModel(self.db))
self.selection = self.list.get_selection()
@ -132,9 +129,8 @@ class MediaView:
column = gtk.TreeViewColumn(_('Title'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
if not const.nosort_tree:
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(0)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(0)
column.set_min_width(225)
self.list.append_column(column)
self.columns = [column]
@ -146,9 +142,8 @@ class MediaView:
name = column_names[pair[1]]
column = gtk.TreeViewColumn(name, self.renderer, text=pair[1])
column.set_resizable(gtk.TRUE)
if not const.nosort_tree:
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(index)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(index)
column.set_min_width(75)
self.columns.append(column)
self.list.append_column(column)
@ -161,10 +156,7 @@ class MediaView:
def build_tree(self):
self.list.set_model(None)
if const.nosort_tree:
self.model = DisplayModels.MediaModel(self.parent.db)
else:
self.model = gtk.TreeModelSort(DisplayModels.MediaModel(self.parent.db))
self.model = gtk.TreeModelSort(DisplayModels.MediaModel(self.parent.db))
self.list.set_model(self.model)
self.selection = self.list.get_selection()
@ -313,28 +305,28 @@ class MediaView:
_('_Delete Media Object'),
ans.query_response)
else:
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.remove_object(mobj.get_handle(),trans)
self.db.add_transaction(trans,_("Remove Media Object"))
self.db.transaction_commit(trans,_("Remove Media Object"))
self.build_tree()
def is_object_used(self,mobj):
for family_handle in self.db.get_family_keys():
for family_handle in self.db.get_family_handles():
p = self.db.find_family_from_handle(family_handle)
for o in p.get_media_list():
if o.get_reference_handle() == mobj.get_handle():
return 1
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
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():
for key in self.db.get_source_handles():
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
for key in self.db.get_place_handle_keys():
for key in self.db.get_place_handles():
p = self.db.get_place_handle(key)
for o in p.get_media_list():
if o.get_reference_handle() == mobj.get_handle():
@ -376,7 +368,7 @@ class MediaView:
photo.set_mime_type(mime)
description = os.path.basename(name)
photo.set_description(description)
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.add_object(photo,trans)
self.load_media()
if GrampsCfg.get_media_reference() == 0:
@ -387,7 +379,7 @@ class MediaView:
photo.set_path(name)
self.db.commit_media_object(photo,trans)
self.db.add_transaction(trans,_("Add Media Object"))
self.db.transaction_commit(trans,_("Add Media Object"))
if GrampsCfg.get_media_global():
ImageSelect.GlobalMediaProperties(self.db,photo,self.load_media,
@ -405,7 +397,7 @@ class MediaView:
photo.set_mime_type(mime)
photo.set_description(d)
photo.set_path(tfile)
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.add_object(photo,trans)
oref = RelLib.MediaRef()
oref.set_reference_handle(photo.get_handle())
@ -420,7 +412,7 @@ class MediaView:
return
self.db.commit_media_object(photo,trans)
self.db.add_transaction(trans,_("Add Media Object"))
self.db.transaction_commit(trans,_("Add Media Object"))
if GrampsCfg.get_media_global():
ImageSelect.GlobalMediaProperties(self.db,photo,None,

View File

@ -315,7 +315,7 @@ class MergePeople:
orig_family.remove_child_handle(self.p1)
self.p1.remove_parent_family_handle(orig_family)
(source_family,mrel,frel) = self.p2.get_main_parents_family_handleRel()
(source_family,mrel,frel) = self.p2.get_main_parents_family_handle()
self.p1.set_main_parent_family_handle(source_family)
if source_family:
@ -346,7 +346,7 @@ class MergePeople:
self.p1.set_note(old_note + self.p2.get_note())
try:
self.db.remove_person_handle(self.p2.get_handle())
self.db.remove_person(self.p2.get_handle())
self.db.personMap[self.p1.get_handle()] = self.p1
except:
print "%s is not in the person map!" % (GrampsCfg.get_nameof()(self.p2))
@ -361,7 +361,7 @@ class MergePeople:
father = family.get_father_handle()
mother = self.p1.get_handle()
for myfamily_handle in self.db.get_family_keys():
for myfamily_handle in self.db.get_family_handles():
myfamily = self.db.find_family_from_handle(myfamily_handle)
if myfamily.get_father_handle() == father and myfamily.get_mother_handle() == mother:
return myfamily
@ -887,7 +887,7 @@ class MergePlaces:
self.p1.add_alternate_locations(l)
# loop through people, changing event references to P2 to P1
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
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:

View File

@ -70,7 +70,7 @@ class NameEditor:
self.combo = self.top.get_widget("alt_surname_list")
self.surname_field = self.top.get_widget("alt_last")
AutoComp.fill_combo(self.combo,self.parent.db.get_surnames())
AutoComp.fill_combo(self.combo,self.parent.db.get_surname_list())
self.type_field = self.top.get_widget("name_type")
self.note_field = self.top.get_widget("alt_note")

View File

@ -485,7 +485,7 @@ class PedigreeView:
if depth > 5 or person == None:
return
(family_handle,m,f) = person.get_main_parents_family_handleRel()
(family_handle,m,f) = person.get_main_parents_family_handle()
if family_handle:
mrel = (m != "Birth")
frel = (f != "Birth")

View File

@ -136,7 +136,7 @@ class PeopleModel(gtk.GenericTreeModel):
if not self.db.is_open():
return
for person_handle in self.db.get_person_keys():
for person_handle in self.db.get_person_handles(sort_handles=False):
person = self.db.get_person_from_handle(person_handle)
surname = unicode(person.get_primary_name().get_surname())
@ -147,7 +147,7 @@ class PeopleModel(gtk.GenericTreeModel):
self.sname_sub[surname] = [person_handle]
sval = 0
name_list = self.db.get_surnames()
name_list = self.db.get_surname_list()
for name in name_list:
if self.sname_sub.has_key(name):
self.top_iter2path[name] = (sval,)
@ -181,7 +181,7 @@ class PeopleModel(gtk.GenericTreeModel):
inscol = 0
sval = 0
name_list = self.db.get_surnames()
name_list = self.db.get_surname_list()
for name in name_list:
if self.sname_sub.has_key(name):
self.top_iter2path[name] = (sval,)

View File

@ -102,7 +102,7 @@ class PeopleView:
self.columns = [column]
index = 1
for pair in self.parent.db.get_column_order():
for pair in self.parent.db.get_person_column_order():
if not pair[0]:
continue
name = column_names[pair[1]]
@ -210,7 +210,7 @@ class PeopleView:
self.person_model.rebuild_data()
self.parent.status_text(_('Updating display...'))
keys = self.DataFilter.apply(self.parent.db,
self.parent.db.get_person_keys())
self.parent.db.get_person_handles(sort_handles=False))
self.person_model.reset_visible()
for person_handle in keys:
self.person_model.set_visible(person_handle,1)

View File

@ -186,11 +186,11 @@ class PlaceView:
mlist = []
self.selection.selected_foreach(self.blist,mlist)
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
for place in mlist:
used = 0
for key in self.parent.db.get_person_keys():
for key in self.parent.db.get_person_handles(sort_handles=False):
p = self.parent.db.get_person_from_handle(key)
event_list = []
for e in [p.get_birth_handle(),p.get_death_handle()] + p.get_event_list():
@ -207,7 +207,7 @@ class PlaceView:
if event.get_place_handle() == place.get_handle():
used = 1
for fid in self.parent.db.get_family_keys():
for fid in self.parent.db.get_family_handles():
f = self.parent.db.find_family_from_handle(fid)
event_list = []
for e in f.get_event_list():
@ -230,9 +230,9 @@ class PlaceView:
_('_Delete Place'),
ans.query_response)
else:
trans = self.parent.db.start_transaction()
trans = self.parent.db.transaction_begin()
self.parent.db.remove_place(place.get_handle(),trans)
self.parent.db.add_transaction(trans,_("Delete Place (%s)") % place.title())
self.parent.db.transaction_commit(trans,_("Delete Place (%s)") % place.title())
self.build_tree()
def on_edit_clicked(self,obj):

View File

@ -389,7 +389,7 @@ class GedcomParser:
def parse_gedcom_file(self):
self.trans = self.db.start_transaction()
self.trans = self.db.transaction_begin()
t = time.time()
self.index = 0
self.fam_count = 0
@ -410,7 +410,7 @@ class GedcomParser:
t = time.time() - t
msg = _('Import Complete: %d seconds') % t
self.db.add_transaction(self.trans,_("GEDCOM import"))
self.db.transaction_commit(self.trans,_("GEDCOM import"))
if self.window:
self.infomsg("\n%s" % msg)
@ -1773,7 +1773,7 @@ class GedcomParser:
# new ID is not used
if not self.db.has_person_handle(new_key):
self.db.remove_person_handle(pid,self.trans)
self.db.remove_person(pid,self.trans)
person.set_handle(new_key)
person.set_gramps_id(new_key)
self.db.add_person(person,self.trans)
@ -1781,7 +1781,7 @@ class GedcomParser:
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)
self.db.remove_person(pid,self.trans)
person.set_handle(new_key)
person.set_gramps_id(new_key)
self.db.add_person(person,self.trans)

View File

@ -152,7 +152,7 @@ def importData(database, filename, callback=None,cl=0):
img_dir = "%s/%s.images" % (db_dir,db_base)
first = not os.path.exists(img_dir)
for m_id in database.get_object_keys():
for m_id in database.get_media_object_handles():
mobject = database.get_object_from_handle(m_id)
oldfile = mobject.get_path()
if oldfile[0] != '/':
@ -176,28 +176,28 @@ def importData(database, filename, callback=None,cl=0):
# def remove_clicked():
# # File is lost => remove all references and the object itself
# mobj = database.find_object_from_handle(NewMediaID)
# for fid in database.get_family_keys():
# for fid in database.get_family_handles():
# p = database.find_family_from_handle(fid)
# nl = p.get_media_list()
# for o in nl:
# if o.get_reference() == mobj:
# nl.remove(o)
# p.set_media_list(nl)
# for key in database.get_person_keys():
# for key in database.get_person_handles(sort_handles=False):
# p = database.find_person_from_handle(key)
# nl = p.get_media_list()
# for o in nl:
# if o.get_reference_handle() == mobj.get_handle():
# nl.remove(o)
# p.set_media_list(nl)
# for key in database.get_source_keys():
# for key in database.get_source_handles():
# p = database.find_source_from_handle(key)
# nl = p.get_media_list()
# for o in nl:
# if o.get_reference_handle() == mobj.get_handle():
# nl.remove(o)
# p.set_media_list(nl)
# for key in database.get_place_handle_keys():
# for key in database.get_place_handles():
# p = database.find_place_from_handle(key)
# nl = p.get_media_list()
# for o in nl:
@ -429,13 +429,13 @@ class GrampsParser:
def map_gid(self,id):
if not self.idswap.get(id):
if self.db.id_trans.get(str(id)):
self.idswap[id] = self.db.find_next_gramps_id()
self.idswap[id] = self.db.find_next_person_gramps_id()
else:
self.idswap[id] = id
return self.idswap[id]
def parse(self,file):
self.trans = self.db.start_transaction()
self.trans = self.db.transaction_begin()
p = xml.parsers.expat.ParserCreate()
p.StartElementHandler = self.startElement
p.EndElementHandler = self.endElement
@ -454,7 +454,7 @@ class GrampsParser:
del self.func_map
del self.func_list
del p
self.db.add_transaction(self.trans,_("GRAMPS XML import"))
self.db.transaction_commit(self.trans,_("GRAMPS XML import"))
def start_lds_ord(self,attrs):
type = attrs['type']
@ -590,9 +590,9 @@ class GrampsParser:
self.person = self.find_person_by_gramps_id(new_id)
if attrs.has_key("complete"):
self.person.set_complete(int(attrs['complete']))
self.person.set_complete_flag(int(attrs['complete']))
else:
self.person.set_complete(0)
self.person.set_complete_flag(0)
def start_people(self,attrs):
if attrs.has_key("default"):
@ -641,9 +641,9 @@ class GrampsParser:
self.family.set_relationship(_FAMILY_TRANS.get(attrs["type"],
const.FAMILY_UNKNOWN))
if attrs.has_key("complete"):
self.family.set_complete(int(attrs['complete']))
self.family.set_complete_flag(int(attrs['complete']))
else:
self.family.set_complete(0)
self.family.set_complete_flag(0)
def start_childof(self,attrs):
family = self.db.find_family_from_handle(attrs["ref"],self.trans)

File diff suppressed because it is too large Load Diff

View File

@ -195,7 +195,7 @@ class SelectChild:
slist[c] = 1
person_list = []
for key in self.db.sort_person_keys():
for key in self.db.get_person_handles(sort_handles=True):
person = self.db.get_person_from_handle(key)
if filter:
if slist.has_key(key) or person.get_main_parents_family_handle():
@ -243,7 +243,7 @@ class SelectChild:
iter = None
for idval in person_list:
dinfo = self.db.get_person_display(idval)
dinfo = self.db.get_person_from_handle(idval).get_display_info()
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
new_iter = self.refmodel.add(rdata)
names = dinfo[0].split(',')
@ -282,9 +282,12 @@ class SelectChild:
_("A person cannot be linked as his/her own child"),
self.top)
return
trans = self.db.transaction_begin()
if self.family == None:
self.family = self.db.new_family()
self.family = RelLib.Family()
self.db.add_family(self.family,trans)
self.person.add_family_handle(self.family.get_handle())
if self.person.get_gender() == RelLib.Person.male:
self.family.set_father_handle(self.person)
@ -313,11 +316,10 @@ class SelectChild:
select_child.add_parent_family_handle(self.family.get_handle(),mrel,frel)
trans = self.db.start_transaction()
self.db.commit_person(select_child,trans)
self.db.commit_family(self.family,trans)
n = select_child.get_primary_name().get_regular_name()
self.db.add_transaction(trans,_("Add Child to Family (%s)") % n)
self.db.transaction_commit(trans,_("Add Child to Family (%s)") % n)
self.redraw(self.family)
self.close(obj)
@ -449,10 +451,10 @@ class EditRel:
frel = "Unknown"
self.child.change_parent_family_handle(self.family.get_handle(),mrel,frel)
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.commit_person(self.child,trans)
n = self.child.get_primary_name().get_regular_name()
self.db.add_transaction(trans,_("Parent Relationships (%s)") % n)
self.db.transaction_commit(trans,_("Parent Relationships (%s)") % n)
self.update()
self.top.destroy()

View File

@ -98,7 +98,7 @@ class SelectObject:
self.object_model.clear()
self.object_model.new_model()
for key in self.db.get_object_keys():
for key in self.db.get_media_object_handles():
object = self.db.get_object_from_handle(key)
title = object.get_description()
the_id = object.get_handle()

View File

@ -115,12 +115,12 @@ class SelectPerson:
return
for key in self.db.sort_person_keys():
for key in self.db.get_person_handles(sort_handles=True):
person = self.db.get_person_from_handle(key)
if self.use_filter and not self.filter(person):
continue
data = self.db.get_person_display(key)
data = self.db.get_person_from_handle(key).get_display_info()
gender = person.get_gender()
if gender == RelLib.Person.plist:
self.mmodel.add([data[0],data[1],data[3],data[5],data[6]],key)

View File

@ -76,10 +76,7 @@ class SourceView:
self.renderer = gtk.CellRendererText()
if const.nosort_tree:
self.model = DisplayModels.SourceModel(self.parent.db)
else:
self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.parent.db))
self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.parent.db))
self.list.set_model(self.model)
self.topWindow = self.glade.get_widget("gramps")
@ -92,9 +89,8 @@ class SourceView:
column = gtk.TreeViewColumn(_('Title'), self.renderer,text=0)
column.set_resizable(gtk.TRUE)
if not const.nosort_tree:
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(0)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(0)
column.set_min_width(225)
self.list.append_column(column)
self.columns = [column]
@ -106,9 +102,8 @@ class SourceView:
name = column_names[pair[1]]
column = gtk.TreeViewColumn(name, self.renderer, text=pair[1])
column.set_resizable(gtk.TRUE)
if not const.nosort_tree:
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(index)
column.set_clickable(gtk.TRUE)
column.set_sort_column_id(index)
column.set_min_width(75)
self.columns.append(column)
self.list.append_column(column)
@ -123,10 +118,7 @@ class SourceView:
def build_tree(self):
self.list.set_model(None)
if const.nosort_tree:
self.model = DisplayModels.SourceModel(self.parent.db)
else:
self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.parent.db))
self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.parent.db))
self.list.set_model(self.model)
self.selection = self.list.get_selection()
@ -197,19 +189,19 @@ class SourceView:
_('_Delete Source'),
ans.query_response,self.topWindow)
else:
trans = self.parent.db.start_transaction()
self.parent.db.remove_source_handle(source.get_handle(),trans)
trans = self.parent.db.transaction_begin()
self.parent.db.remove_source(source.get_handle(),trans)
n = source.get_title()
self.parent.db.add_transaction(trans,_("Delete Source (%s)") % n)
self.parent.db.transaction_commit(trans,_("Delete Source (%s)") % n)
self.build_tree()
def is_used(self,source):
for key in self.parent.db.get_place_handle_keys():
for key in self.parent.db.get_place_handles():
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.parent.db.get_person_keys():
for key in self.parent.db.get_person_handles(sort_handles=False):
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.parent.db.find_event_from_handle(v_id)
@ -229,12 +221,12 @@ class SourceView:
for sref in v.get_source_references():
if sref.get_base_handle() == source.get_handle():
return 1
for p_id in self.parent.db.get_object_keys():
for p_id in self.parent.db.get_media_object_handles():
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.parent.db.get_family_keys():
for p_id in self.parent.db.get_family_handles():
p = self.parent.db.find_family_from_handle(p_id)
for v_id in p.get_event_list():
v = self.parent.db.find_event_from_handle(v_id)

View File

@ -425,7 +425,7 @@ class SourceEditor:
self.author_field.set_text("")
self.pub_field.set_text("")
keys = self.db.get_source_keys()
keys = self.db.get_source_handles()
keys.sort(self.db.sortbysource)
sel_child = None

View File

@ -556,11 +556,11 @@ class GedcomWriter:
self.nl = self.option_box.nl
if self.option_box.cfilter == None:
for p in self.db.get_person_keys():
for p in self.db.get_person_handles(sort_handles=False):
self.plist[p] = 1
else:
try:
for p in self.option_box.cfilter.apply(self.db, self.db.get_person_keys()):
for p in self.option_box.cfilter.apply(self.db, self.db.get_person_handles(sort_handles=False)):
self.plist[p] = 1
except Errors.FilterError, msg:
(m1,m2) = msg.messages()
@ -582,7 +582,7 @@ class GedcomWriter:
self.copy = 0
self.images = 0
for p in self.db.get_person_keys():
for p in self.db.get_person_handles(sort_handles=False):
self.plist[p] = 1
gedmap = GedcomInfo.GedcomInfoDB()

View File

@ -198,12 +198,12 @@ class XmlWriter:
date = string.split(time.ctime(time.time()))
owner = self.db.get_researcher()
familyList = self.db.get_family_keys()
familyList = self.db.get_family_handles()
person_len = self.db.get_number_of_people()
family_len = len(familyList)
source_len = len(self.db.get_source_keys())
place_len = len(self.db.get_place_handle_keys())
objList = self.db.get_object_keys()
source_len = len(self.db.get_source_handles())
place_len = len(self.db.get_place_handles())
objList = self.db.get_media_object_handles()
total = person_len + family_len + place_len + source_len
@ -240,18 +240,14 @@ class XmlWriter:
self.g.write(' default="%s"' % person.get_gramps_id())
self.g.write(">\n")
keys = self.db.get_person_keys()
keys = self.db.get_person_handles(sort_handles=False)
keys.sort ()
for key in keys:
try:
person = self.db.get_person_from_handle(key)
except:
print "Key error %s" % key
continue
person = self.db.get_person_from_handle(key)
if self.callback and count % delta == 0:
self.callback(float(count)/float(total))
count = count + 1
count += 1
self.write_id("person",person,2)
if person.get_gender() == RelLib.Person.male:
@ -324,7 +320,7 @@ class XmlWriter:
self.g.write(" <families>\n")
familyList.sort ()
for key in self.db.get_family_keys():
for key in self.db.get_family_handles():
family = self.db.find_family_from_handle(key)
if self.callback and count % delta == 0:
self.callback(float(count)/float(total))
@ -354,7 +350,7 @@ class XmlWriter:
if source_len > 0:
self.g.write(" <sources>\n")
keys = self.db.get_source_keys ()
keys = self.db.get_source_handles ()
keys.sort ()
for key in keys:
source = self.db.get_source_from_handle(key)
@ -374,7 +370,7 @@ class XmlWriter:
if place_len > 0:
self.g.write(" <places>\n")
keys = self.db.get_place_handle_keys()
keys = self.db.get_place_handles()
keys.sort ()
for key in keys:
try:
@ -391,7 +387,7 @@ class XmlWriter:
if len(objList) > 0:
self.g.write(" <objects>\n")
objList.sort ()
for key in self.db.get_object_keys():
for key in self.db.get_media_object_handles():
object = self.db.get_object_from_handle(key)
self.write_object(object)
self.g.write(" </objects>\n")
@ -536,7 +532,7 @@ class XmlWriter:
def write_id(self,label,person,index=1):
if person:
self.g.write('%s<%s id="%s"' % (" "*index,label,person.get_gramps_id()))
comp = person.get_complete()
comp = person.get_complete_flag()
if comp:
self.g.write(' complete="1"')
self.g.write('>\n')
@ -544,7 +540,7 @@ class XmlWriter:
def write_family_handle(self,family,index=1):
if family:
rel = family.get_relationship()
comp = family.get_complete()
comp = family.get_complete_flag()
sp = " " * index
self.g.write('%s<family id="%s"' % (sp,family.get_handle()))
if comp:

View File

@ -107,14 +107,6 @@ fdl = "%s/fdl.txt" % dataDir
startup = 1
dnd_images = 1
#-------------------------------------------------------------------------
#
# Paths to external programs
#
#-------------------------------------------------------------------------
nosort_tree = os.environ.has_key('NOSORT') and os.environ['NOSORT'] == "1"
#-------------------------------------------------------------------------
#
# About box information
@ -145,10 +137,8 @@ translators = _('TRANSLATORS: Translate this to your name in your native languag
# Constants
#
#-------------------------------------------------------------------------
picWidth = 200.0
thumbScale = 96.0
xmlFile = "data.gramps"
zodbFile = "gramps.zodb"
male = _("male")
female = _("female")
unknown = _("unknown")
@ -271,9 +261,6 @@ family_events = TransTable( {
def display_fevent(st):
return family_events.find_value(st)
def save_fevent(st):
return family_events.find_key(st)
#-------------------------------------------------------------------------
#
#
@ -364,9 +351,6 @@ personal_events = TransTable({
def display_pevent(st):
return personal_events.find_value(st)
def save_pevent(st):
return personal_events.find_key(st)
#-------------------------------------------------------------------------
#
# Merged functions for events: personal, family, whatever else
@ -434,22 +418,12 @@ family_attributes = TransTable({"Number of Children" : _("Number of Children")})
def display_fattr(st):
return family_attributes.find_value(st)
def save_fattr(st):
return family_attributes.find_key(st)
#-------------------------------------------------------------------------
#
# Merged functions for attributes: personal, family, whatever else
# there might be in the future.
#
#-------------------------------------------------------------------------
def display_attr(st):
if personal_attributes.has_key(st):
return personal_attributes.find_value(st)
if family_attributes.has_key(st):
return family_attributes.find_value(st)
return _(st)
def save_attr(st):
if personal_attributes.has_value(st):
return personal_attributes.find_key(st)
@ -483,9 +457,6 @@ family_relations = [
#
#
#-------------------------------------------------------------------------
def display_frel(st):
return family_relations.find_value(st)
def save_frel(st):
try:
return family_relations[st][0]

View File

@ -69,7 +69,6 @@ import Utils
import Bookmarks
import GrampsCfg
import EditPerson
import Find
import DbPrompter
import TipOfDay
import ArgHandler
@ -188,11 +187,12 @@ class Gramps:
GrampsCfg.set_calendar_date_entry()
def researcher_key_update(self,client,cnxn_id,entry,data):
self.db.set_iprefix(GrampsCfg.get_iprefix())
self.db.set_fprefix(GrampsCfg.get_fprefix())
self.db.set_sprefix(GrampsCfg.get_sprefix())
self.db.set_oprefix(GrampsCfg.get_oprefix())
self.db.set_pprefix(GrampsCfg.get_pprefix())
self.db.set_person_id_prefix(GrampsCfg.get_person_id_prefix())
self.db.set_family_id_prefix(GrampsCfg.get_family_id_prefix())
self.db.set_source_id_prefix(GrampsCfg.get_source_id_prefix())
self.db.set_object_id_prefix(GrampsCfg.get_object_id_prefix())
self.db.set_place_id_prefix(GrampsCfg.get_place_id_prefix())
self.db.set_event_id_prefix(GrampsCfg.get_event_id_prefix())
def statusbar_key_update(self,client,cnxn_id,entry,data):
self.modify_statusbar()
@ -276,8 +276,8 @@ class Gramps:
self.undolabel = self.gtop.get_widget('undolabel')
self.redolabel = self.gtop.get_widget('redolabel')
self.db.set_undo_label(self.undolabel)
self.db.set_redo_label(self.redolabel)
self.db.set_undo_callback(self.undo_callback)
self.db.set_redo_callback(self.redo_callback)
self.child_model = gtk.ListStore(
gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_STRING,
@ -405,6 +405,25 @@ class Gramps:
self.back = gtk.ImageMenuItem(gtk.STOCK_GO_BACK)
self.forward = gtk.ImageMenuItem(gtk.STOCK_GO_FORWARD)
def undo_callback(self,text):
if text == None:
self.undolabel.set_sensitive(0)
self.undolabel.get_children()[0].set_text(_("_Undo"))
else:
self.undolabel.set_sensitive(1)
label = self.undolabel.get_children()[0]
label.set_text(text)
label.set_use_underline(1)
def redo_callback(self,text):
if text == None:
self.redolabel.set_sensitive(0)
self.redolabel.get_children()[0].set_text(_("_Redo"))
else:
self.redolabel.set_sensitive(1)
label = self.redolabel.get_children()[0]
label.set_text(text)
label.set_use_underline(1)
def undo(self,*args):
self.db.undo()
@ -418,8 +437,8 @@ class Gramps:
self.media_view.change_db(self.db)
self.family_view.load_family()
def set_column_order(self,list):
self.db.set_column_order(list)
def set_person_column_order(self,list):
self.db.set_person_column_order(list)
self.people_view.build_columns()
def set_place_column_order(self,list):
@ -439,9 +458,9 @@ class Gramps:
cpage = self.views.get_current_page()
if cpage == PERSON_VIEW:
ColumnOrder.ColumnOrder(self.db.get_column_order(),
ColumnOrder.ColumnOrder(self.db.get_person_column_order(),
PeopleView.column_names,
self.set_column_order)
self.set_person_column_order)
elif cpage == SOURCE_VIEW:
ColumnOrder.ColumnOrder(self.db.get_source_column_order(),
SourceView.column_names,
@ -1078,21 +1097,21 @@ class Gramps:
if o.get_reference_handle() == ObjectId:
nl.remove(o)
p.set_media_list(nl)
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
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():
for key in self.db.get_source_handles():
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():
for key in self.db.get_place_handles():
p = self.db.get_place_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -1100,9 +1119,9 @@ class Gramps:
nl.remove(o)
p.set_media_list(nl)
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
self.db.remove_object(ObjectId)
self.db.add_transaction(trans,_("Save Media Object"))
self.db.transaction_commit(trans,_("Save Media Object"))
def leave_clicked():
# File is lost => do nothing, leave as is
@ -1132,7 +1151,7 @@ class Gramps:
choose.destroy()
#-------------------------------------------------------------------------
for ObjectId in self.db.get_object_keys():
for ObjectId in self.db.get_media_object_handles():
object = self.db.get_object_from_handle(ObjectId)
if 0:
oldfile = object.get_path()
@ -1207,12 +1226,12 @@ class Gramps:
self.update_display(0)
def delete_person_response(self):
trans = self.db.start_transaction()
trans = self.db.transaction_begin()
n = self.active_person.get_primary_name().get_regular_name()
if self.db.get_default_person() == self.active_person:
self.db.set_default_person(None)
self.db.set_default_person_handle(None)
for family_handle in self.active_person.get_family_handle_list():
if not family_handle:
@ -1247,13 +1266,13 @@ class Gramps:
id = self.active_person.get_handle()
self.people_view.remove_from_person_list(self.active_person)
self.people_view.remove_from_history(id)
self.db.remove_person_handle(id, trans)
self.db.remove_person(id, trans)
if self.hindex >= 0:
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)
self.db.transaction_commit(trans,_("Delete Person (%s)") % n)
self.redraw_histmenu()
def merge_update(self,p1,p2,old_id):
@ -1516,7 +1535,7 @@ class Gramps:
def find_initial_person(self):
person = self.db.get_default_person()
if not person:
the_ids = self.db.get_person_keys()
the_ids = self.db.get_person_handles(sort_handles=False)
if the_ids:
the_ids.sort()
person = self.db.get_person_from_handle(the_ids[0])
@ -1533,7 +1552,6 @@ class Gramps:
return 0
self.status_text('')
self.db.clear_added_media_objects()
return self.post_load(name)
def setup_bookmarks(self):
@ -1598,7 +1616,7 @@ class Gramps:
self.set_person)
def set_person(self):
self.db.set_default_person(self.active_person)
self.db.set_default_person_handle(self.active_person.get_handle())
def export_callback(self,obj,plugin_function):
"""Call the export plugin, with the active person and database"""

View File

@ -54,7 +54,7 @@ class ChangeTypes:
def __init__(self,db,person,parent):
self.person = person
self.db = db
self.trans = db.start_transaction()
self.trans = db.transaction_begin()
base = os.path.dirname(__file__)
glade_file = "%s/%s" % (base,"changetype.glade")
self.glade = gtk.glade.XML(glade_file,"top","gramps")
@ -79,7 +79,7 @@ class ChangeTypes:
original = unicode(self.auto1.child.get_text())
new = unicode(self.auto2.child..get_text())
for person_handle in self.db.get_person_keys():
for person_handle in self.db.get_person_handles(sort_handles=False):
person = self.db.get_person_from_handle(person_handle)
for event_handle in person.get_event_list():
if not event_handle:
@ -96,7 +96,7 @@ class ChangeTypes:
msg = _("%d event records were modified") % modified
OkDialog(_('Change types'),msg)
self.db.add_transaction(self.trans,_('Change types'))
self.db.transaction_commit(self.trans,_('Change types'))
Utils.destroy_passed_object(obj)
#------------------------------------------------------------------------

View File

@ -58,13 +58,13 @@ from QuestionDialog import OkDialog, MissingMediaDialog
def runTool(database,active_person,callback,parent=None):
try:
trans = database.start_transaction()
trans = database.transaction_begin()
checker = CheckIntegrity(database,parent,trans)
checker.check_for_broken_family_links()
checker.cleanup_missing_photos(0)
checker.check_parent_relationships()
checker.cleanup_empty_families(0)
database.add_transaction(trans, _("Check Integrity"))
database.transaction_commit(trans, _("Check Integrity"))
errs = checker.build_report(0)
if errs:
@ -93,7 +93,7 @@ class CheckIntegrity:
def check_for_broken_family_links(self):
self.broken_links = []
for family_handle in self.db.get_family_keys():
for family_handle in self.db.get_family_handles():
family = self.db.find_family_from_handle(family_handle)
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
@ -127,7 +127,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():
for person_handle in self.db.get_family_handles():
p = self.db.get_person_from_handle(person_handle)
nl = p.get_media_list()
changed = 0
@ -139,7 +139,7 @@ class CheckIntegrity:
p.set_media_list(nl)
self.db.commit_person(p,self.trans)
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
p = self.db.get_person_from_handle(key)
nl = p.get_media_list()
changed = 0
@ -151,7 +151,7 @@ class CheckIntegrity:
p.set_media_list(nl)
self.db.commit_person(p,self.trans)
for key in self.db.get_source_keys():
for key in self.db.get_source_handles():
p = self.db.get_source_from_handle(key)
nl = p.get_media_list()
changed = 0
@ -163,7 +163,7 @@ class CheckIntegrity:
p.set_media_list(nl)
self.db.commit_source(p,self.trans)
for key in self.db.get_place_handle_keys():
for key in self.db.get_place_handles():
p = self.db.get_place_handle(key)
nl = p.get_media_list()
changed = 0
@ -206,7 +206,7 @@ class CheckIntegrity:
#-------------------------------------------------------------------------
for ObjectId in self.db.get_object_keys():
for ObjectId in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(ObjectId)
photo_name = obj.get_path()
if not os.path.isfile(photo_name):
@ -232,21 +232,21 @@ class CheckIntegrity:
select_clicked()
def cleanup_empty_families(self,automatic):
for family_handle in self.db.get_family_keys():
for family_handle in self.db.get_family_handles():
family = self.db.find_family_from_handle(family_handle)
if not family.get_father_handle() and not family.get_mother_handle():
self.empty_family.append(family_handle)
self.delete_empty_family(family_handle)
def delete_empty_family(self,family_handle):
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
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)
self.db.remove_family_handle(family_handle,self.trans)
def check_parent_relationships(self):
for key in self.db.get_family_keys():
for key in self.db.get_family_handles():
family = self.db.find_family_from_handle(key)
mother_handle = family.get_mother_handle()
father_handle = family.get_father_handle()

View File

@ -95,7 +95,7 @@ class DescendantReport:
else:
self.standalone = 0
plist = self.database.get_person_keys()
plist = self.database.get_person_handles(sort_handles=False)
self.layout = GraphLayout.DescendLine(self.database,plist,person.get_handle())
(self.v,self.e) = self.layout.layout()

View File

@ -206,7 +206,7 @@ class EventComparison:
def on_apply_clicked(self,obj):
cfilter = self.filter_menu.get_active().get_data("filter")
plist = cfilter.apply(self.db,self.db.get_person_keys())
plist = cfilter.apply(self.db,self.db.get_person_handles(sort_handles=False))
if len(plist) == 0:
WarningDialog(_("No matches were found"))

View File

@ -355,7 +355,7 @@ class FilterEditor:
store,iter = self.clist.get_selected()
if iter:
filt = self.clist.get_object(iter)
id_list = filt.apply(self.db,self.db.get_person_keys())
id_list = filt.apply(self.db,self.db.get_person_handles(sort_handles=False))
ShowResults(self,self.db,id_list,filt.get_name())
def delete_filter(self,obj):

View File

@ -325,7 +325,7 @@ class GraphVizDialog(Report.ReportDialog):
file = open(self.target_path,"w")
try:
ind_list = self.filter.apply(self.db, self.db.get_person_keys())
ind_list = self.filter.apply(self.db, self.db.get_person_handles(sort_handles=False))
except Errors.FilterError, msg:
from QuestionDialog import ErrorDialog
(m1,m2) = msg.messages()

View File

@ -373,7 +373,7 @@ class IndivComplete(Report.Report):
self.d.page_break()
#plist = self.database.get_person_handle_map().values()
plist = self.database.get_person_keys()
plist = self.database.get_person_handles(sort_handles=False)
if self.filter:
ind_list = self.filter.apply(self.database,plist)
else:

View File

@ -85,8 +85,8 @@ class Merge:
self.update = callback
self.use_soundex = 1
self.family_list = database.get_family_keys()[:]
self.person_list = database.get_person_keys()[:]
self.family_list = database.get_family_handles()[:]
self.person_list = database.get_person_handles(sort_handles=False)[:]
base = os.path.dirname(__file__)
self.glade_file = "%s/%s" % (base,"merge.glade")

View File

@ -185,7 +185,7 @@ def report(db, person):
database = RelLib.GrampsDB()
work_on_person( database, p )
person_len = len(database.get_person_keys())
person_len = len(database.get_person_handles(sort_handles=False))
if person_len > 0:
g = WriteXML.XmlWriter(database,None,0,0)
g.write(prefix+str(count)+".xml")
@ -194,7 +194,7 @@ def report(db, person):
g = WriteXML.XmlWriter(database_for_unlinked_persons,None,0,0)
g.write(prefix+".xml")
text += "partition "+prefix+".xml written ( "+str(len(database_for_unlinked_persons.get_person_keys()))+" persons)\n"
text += "partition "+prefix+".xml written ( "+str(len(database_for_unlinked_persons.get_person_handles(sort_handles=False)))+" persons)\n"
base = os.path.dirname(__file__)
glade_file = "%s/summary.glade" % base

View File

@ -81,13 +81,13 @@ class PatchNames:
self.cb = callback
self.db = db
self.parent = parent
self.trans = db.start_transaction()
self.trans = db.transaction_begin()
self.win_key = self
self.child_windows = {}
self.title_list = []
self.nick_list = []
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
person = self.db.get_person_from_handle(key)
first = person.get_primary_name().get_first_name()
@ -221,7 +221,7 @@ class PatchNames:
name.set_title(grp[1].strip())
self.db.commit_person(p,self.trans)
self.db.add_transaction(self.trans,_("Extract information from names"))
self.db.transaction_commit(self.trans,_("Extract information from names"))
self.close(obj)
self.cb(1)

View File

@ -93,11 +93,11 @@ class RelCalc:
('',-1,0),('',-1,0)],
self.on_apply_clicked)
self.clist.new_model()
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
p = self.db.get_person_from_handle(key)
if p == self.person:
continue
val = self.db.get_person_display(key)
val = self.db.get_person_from_handle(key).get_display_info()
self.clist.add([val[0],val[1],val[3],val[5],val[6]],p.get_handle())
self.clist.connect_model()

View File

@ -408,7 +408,7 @@ class RelGraphDialog(Report.ReportDialog):
try:
self.individual_set =\
Set(self.filter.apply(self.db, self.db.get_person_keys()))
Set(self.filter.apply(self.db, self.db.get_person_handles(sort_handles=False)))
self.individual_set.add(self.person.get_handle())
except Errors.FilterError, msg:
from QuestionDialog import ErrorDialog
@ -586,7 +586,7 @@ def _write_graph_record (self):
filter = GenericFilter.GenericFilter()
filter.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle()]))
natural_relatives =\
Set(filter.apply(self.db, self.db.get_person_keys()))
Set(filter.apply(self.db, self.db.get_person_handles(sort_handles=False)))
natural_relatives.add(self.person.get_handle())
else:
natural_relatives = self.individual_set

View File

@ -68,7 +68,7 @@ class SoundGen:
self.name.connect('changed',self.on_apply_clicked)
names = []
for person_handle in self.db.get_person_keys():
for person_handle in self.db.get_person_handles(sort_handles=False):
person = self.db.get_person_from_handle(person_handle)
lastname = person.get_primary_name().get_surname()
if lastname not in names:

View File

@ -55,8 +55,8 @@ from gnome.ui import *
#------------------------------------------------------------------------
def build_report(database,person):
personList = database.get_person_keys()
familyList = database.get_family_keys()
personList = database.get_person_handles(sort_handles=False)
familyList = database.get_family_handles()
with_photos = 0
total_photos = 0
@ -69,8 +69,8 @@ def build_report(database,person):
namelist = []
notfound = []
pobjects = len(database.get_object_keys())
for photo_id in database.get_object_keys():
pobjects = len(database.get_media_object_handles())
for photo_id in database.get_media_object_handles():
photo = database.get_object_from_handle(photo_id)
try:
bytes = bytes + posixpath.getsize(photo.get_path())

View File

@ -279,7 +279,7 @@ class TimeLine:
low = 999999
high = -999999
self.plist = self.filter.apply(self.db,self.db.get_person_keys())
self.plist = self.filter.apply(self.db,self.db.get_person_handles(sort_handles=False))
for p_id in self.plist:
p = self.db.get_person_from_handle(p_id)
@ -314,7 +314,7 @@ class TimeLine:
return (low,high)
def name_size(self):
self.plist = self.filter.apply(self.db,self.db.get_person_keys())
self.plist = self.filter.apply(self.db,self.db.get_person_handles(sort_handles=False))
style_name = self.d.draw_styles['TLG-text'].get_paragraph_style()
font = self.d.style_list[style_name].get_font()

View File

@ -125,7 +125,7 @@ class Verify:
def on_apply_clicked(self,obj):
personList = self.db.get_person_keys()
personList = self.db.get_person_handles(sort_handles=False)
oldage = int(self.top.get_widget("oldage").get_text())
hwdif = int(self.top.get_widget("hwdif").get_text())

View File

@ -1007,7 +1007,7 @@ class WebReport(Report.Report):
image_dir_name)
return
ind_list = self.filter.apply(self.db,self.db.get_person_keys())
ind_list = self.filter.apply(self.db,self.db.get_person_handles(sort_handles=False))
self.progress_bar_setup(float(len(ind_list)))
doc = HtmlLinkDoc(self.selected_style,None,self.template_name,None)

View File

@ -145,7 +145,7 @@ class PackageWriter:
"2 %s " % str(msg))
return
for obj_id in self.db.get_object_keys():
for obj_id in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(obj_id)
oldfile = obj.get_path()
root = os.path.basename(oldfile)
@ -200,7 +200,7 @@ class PackageWriter:
#--------------------------------------------------------
def remove_clicked():
# File is lost => remove all references and the object itself
for p_id in self.db.get_family_keys():
for p_id in self.db.get_family_handles():
p = self.db.find_family_from_handle(p_id)
nl = p.get_media_list()
for o in nl:
@ -209,7 +209,7 @@ class PackageWriter:
p.set_media_list(nl)
self.db.commit_family(p,None)
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
p = self.db.get_person_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -217,7 +217,7 @@ class PackageWriter:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_person(p,None)
for key in self.db.get_source_keys():
for key in self.db.get_source_handles():
p = self.db.get_source_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -225,7 +225,7 @@ class PackageWriter:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_source(p,None)
for key in self.db.get_place_handle_keys():
for key in self.db.get_place_handles():
p = self.db.get_place_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -233,7 +233,7 @@ class PackageWriter:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_place(p,None)
for key in self.db.get_event_keys():
for key in self.db.get_event_handles():
p = self.db.find_event_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -272,7 +272,7 @@ class PackageWriter:
# Write media files first, since the database may be modified
# during the process (i.e. when removing object)
for obj_id in self.db.get_object_keys():
for obj_id in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(obj_id)
oldfile = obj.get_path()
root = os.path.basename(oldfile)

View File

@ -149,7 +149,7 @@ class FtreeWriter:
def export(self, filename, cfilter, restrict ):
if cfilter == None:
for p in self.db.get_person_keys():
for p in self.db.get_person_handles(sort_handles=False):
self.plist[p] = 1
else:
try:

View File

@ -84,7 +84,7 @@ class PackageWriter:
#--------------------------------------------------------------
def remove_clicked():
# File is lost => remove all references and the object itself
for p_id in self.db.get_family_keys():
for p_id in self.db.get_family_handles():
p = self.db.find_family_from_handle(p_id)
nl = p.get_media_list()
for o in nl:
@ -92,7 +92,7 @@ class PackageWriter:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_family(p,None)
for key in self.db.get_person_keys():
for key in self.db.get_person_handles(sort_handles=False):
p = self.db.get_person_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -100,7 +100,7 @@ class PackageWriter:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_person(p,None)
for key in self.db.get_source_keys():
for key in self.db.get_source_handles():
p = self.db.get_source_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -108,7 +108,7 @@ class PackageWriter:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_source(p,None)
for key in self.db.get_place_handle_keys():
for key in self.db.get_place_handles():
p = self.db.get_place_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -116,7 +116,7 @@ class PackageWriter:
nl.remove(o)
p.set_media_list(nl)
self.db.commit_place(p,None)
for key in self.db.get_event_keys():
for key in self.db.get_event_handles():
p = self.db.find_event_from_handle(key)
nl = p.get_media_list()
for o in nl:
@ -156,7 +156,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():
for m_id in self.db.get_media_object_handles():
mobject = self.db.get_object_from_handle(m_id)
oldfile = mobject.get_path()
base = os.path.basename(oldfile)