* src/AddSpouse.py: new database callback scheme. This scheme
provides a registration mechanism to signal interested objects when database commits occur. The eliminates most of all callback functions tied to interface windows. * src/AddrEdit.py: new database callback scheme * src/AttrEdit.py: new database callback scheme * src/ChooseParents.py: new database callback scheme * src/EditPerson.py: new database callback scheme * src/EditPlace.py: new database callback scheme * src/EditSource.py: new database callback scheme * src/EventEdit.py: new database callback scheme * src/FamilyView.py: new database callback scheme * src/GrampsBSDDB.py: new database callback scheme * src/GrampsDbBase.py: new database callback scheme * src/GrampsInMemDB.py: new database callback scheme * src/Marriage.py: new database callback scheme * src/NameEdit.py: new database callback scheme * src/PeopleView.py: new database callback scheme * src/PlaceView.py: new database callback scheme * src/ReadGedcom.py: new database callback scheme * src/ReadXML.py: new database callback scheme * src/SourceView.py: new database callback scheme * src/Sources.py: new database callback scheme * src/gramps_main.py: new database callback scheme svn: r4267
This commit is contained in:
parent
ff098f8093
commit
19fe252c4c
@ -1,3 +1,29 @@
|
||||
2005-03-31 Don Allingham <don@gramps-project.org>
|
||||
* src/AddSpouse.py: new database callback scheme. This scheme
|
||||
provides a registration mechanism to signal interested objects
|
||||
when database commits occur. The eliminates most of all callback
|
||||
functions tied to interface windows.
|
||||
* src/AddrEdit.py: new database callback scheme
|
||||
* src/AttrEdit.py: new database callback scheme
|
||||
* src/ChooseParents.py: new database callback scheme
|
||||
* src/EditPerson.py: new database callback scheme
|
||||
* src/EditPlace.py: new database callback scheme
|
||||
* src/EditSource.py: new database callback scheme
|
||||
* src/EventEdit.py: new database callback scheme
|
||||
* src/FamilyView.py: new database callback scheme
|
||||
* src/GrampsBSDDB.py: new database callback scheme
|
||||
* src/GrampsDbBase.py: new database callback scheme
|
||||
* src/GrampsInMemDB.py: new database callback scheme
|
||||
* src/Marriage.py: new database callback scheme
|
||||
* src/NameEdit.py: new database callback scheme
|
||||
* src/PeopleView.py: new database callback scheme
|
||||
* src/PlaceView.py: new database callback scheme
|
||||
* src/ReadGedcom.py: new database callback scheme
|
||||
* src/ReadXML.py: new database callback scheme
|
||||
* src/SourceView.py: new database callback scheme
|
||||
* src/Sources.py: new database callback scheme
|
||||
* src/gramps_main.py: new database callback scheme
|
||||
|
||||
2005-03-31 Alex Roitman <shura@gramps-project.org>
|
||||
* src/GrampsBSDDB.py (upgrade): Delegate particular versioned
|
||||
upgrades to separate methods; provide upgrade_5 method.
|
||||
|
@ -211,13 +211,7 @@ class AddSpouse:
|
||||
been closed.
|
||||
"""
|
||||
person = epo.person
|
||||
trans = self.db.transaction_begin()
|
||||
handle = self.db.add_person(person,trans)
|
||||
|
||||
n = NameDisplay.displayer.display(person)
|
||||
self.db.transaction_commit(trans,_('Add Person (%s)' % n))
|
||||
self.addperson(person)
|
||||
self.update_data(handle)
|
||||
self.update_data(person.get_handle())
|
||||
|
||||
self.slist = PeopleModel.PeopleModel(self.db)
|
||||
self.slist.rebuild_data()
|
||||
@ -227,8 +221,6 @@ class AddSpouse:
|
||||
top_path = self.slist.on_get_path(person.get_primary_name().get_surname())
|
||||
self.spouse_list.expand_row(top_path,0)
|
||||
self.selection.select_path(path)
|
||||
#self.spouse_list.scroll_to_cell(path,None,1,0.5,0)
|
||||
#self.slist.center_selected()
|
||||
|
||||
def select_spouse_clicked(self,obj):
|
||||
"""
|
||||
@ -298,10 +290,7 @@ class AddSpouse:
|
||||
|
||||
Utils.destroy_passed_object(obj)
|
||||
self.update(self.active_family)
|
||||
m = Marriage.Marriage(self.parent, self.active_family,
|
||||
self.parent.db, self.parent.new_after_edit,
|
||||
self.parent.family_view.load_family,
|
||||
self.parent.source_view.build_tree)
|
||||
m = Marriage.Marriage(self.parent, self.active_family, self.parent.db)
|
||||
m.on_add_clicked()
|
||||
|
||||
def relation_type_changed(self,obj):
|
||||
@ -311,8 +300,9 @@ class AddSpouse:
|
||||
return person.get_gender() != self.sgender
|
||||
|
||||
def likely_filter(self, person):
|
||||
print self.sgender
|
||||
if person.get_gender() == self.sgender:
|
||||
return 0
|
||||
return False
|
||||
|
||||
pd_id = person.get_death_handle()
|
||||
pb_id = person.get_birth_handle()
|
||||
|
@ -61,8 +61,7 @@ class AddressEditor:
|
||||
"""
|
||||
Displays a dialog that allows the user to edit an address.
|
||||
"""
|
||||
def __init__(self,parent,addr,callback,parent_window=None,
|
||||
update_sources=None):
|
||||
def __init__(self,parent,addr,callback,parent_window=None):
|
||||
"""
|
||||
Displays the dialog box.
|
||||
|
||||
@ -70,7 +69,6 @@ class AddressEditor:
|
||||
addr - The address that is to be edited
|
||||
"""
|
||||
|
||||
self.update_sources = update_sources
|
||||
self.parent = parent
|
||||
if addr:
|
||||
if self.parent.child_windows.has_key(addr):
|
||||
@ -132,8 +130,7 @@ class AddressEditor:
|
||||
self.sourcetab = Sources.SourceTab(
|
||||
self.srcreflist, self, self.top, self.window, self.slist,
|
||||
self.top.get_widget('add_src'), self.top.get_widget('edit_src'),
|
||||
self.top.get_widget('del_src'), self.db.readonly,
|
||||
self.update_sources)
|
||||
self.top.get_widget('del_src'), self.db.readonly)
|
||||
|
||||
date_stat = self.top.get_widget("date_stat")
|
||||
self.date_check = DateEdit.DateEdit(
|
||||
|
@ -65,7 +65,7 @@ class AttributeEditor:
|
||||
Displays a dialog that allows the user to edit an attribute.
|
||||
"""
|
||||
def __init__(self, parent, attrib, title, list, callback,
|
||||
parent_window=None, update_sources=None):
|
||||
parent_window=None):
|
||||
"""
|
||||
Displays the dialog box.
|
||||
|
||||
@ -75,7 +75,6 @@ class AttributeEditor:
|
||||
list - list of options for the pop down menu
|
||||
"""
|
||||
|
||||
self.update_sources = update_sources
|
||||
self.parent = parent
|
||||
if attrib:
|
||||
if self.parent.child_windows.has_key(attrib):
|
||||
@ -114,9 +113,7 @@ class AttributeEditor:
|
||||
self.sourcetab = Sources.SourceTab(
|
||||
self.srcreflist, self, self.top, self.window, self.slist,
|
||||
self.top.get_widget('add_src'), self.top.get_widget('edit_src'),
|
||||
self.top.get_widget('del_src'), self.db.readonly,
|
||||
self.update_sources
|
||||
)
|
||||
self.top.get_widget('del_src'), self.db.readonly)
|
||||
|
||||
if title == ", ":
|
||||
title = _("Attribute Editor")
|
||||
|
@ -67,15 +67,13 @@ class ChooseParents:
|
||||
Displays the Choose Parents dialog box, allowing the parents
|
||||
to be edited.
|
||||
"""
|
||||
def __init__(self,parent,db,person,family,family_update,full_update):
|
||||
def __init__(self,parent,db,person,family):
|
||||
"""
|
||||
Creates a ChoosePerson dialog box.
|
||||
|
||||
db - database associated the person
|
||||
person - person whose parents we are selecting
|
||||
family - current family
|
||||
family_update - task that updates the family display
|
||||
full_update - task that updates the main display
|
||||
"""
|
||||
self.parent = parent
|
||||
self.db = db
|
||||
@ -85,8 +83,6 @@ class ChooseParents:
|
||||
self.family = self.db.get_family_from_handle(family.get_handle())
|
||||
else:
|
||||
self.family = None
|
||||
self.family_update = family_update
|
||||
self.full_update = full_update
|
||||
self.old_type = ""
|
||||
self.type = ""
|
||||
self.parent_selected = 0
|
||||
@ -476,7 +472,6 @@ class ChooseParents:
|
||||
self.family.set_relationship(self.type)
|
||||
self.change_family_type(self.family,mother_rel,father_rel)
|
||||
self.db.commit_family(self.family,trans)
|
||||
self.family_update(None)
|
||||
self.db.transaction_commit(trans,_("Choose Parents"))
|
||||
self.close(None)
|
||||
|
||||
@ -505,7 +500,6 @@ class ChooseParents:
|
||||
self.mother_list.expand_row(top_path,0)
|
||||
self.mother_selection.select_path(path)
|
||||
self.mother_list.scroll_to_cell(path,None,1,0.5,0)
|
||||
self.full_update()
|
||||
|
||||
def add_parent_clicked(self,obj):
|
||||
"""Called with the Add New Person button is pressed. Calls the QuickAdd
|
||||
@ -555,22 +549,17 @@ class ChooseParents:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class ModifyParents:
|
||||
def __init__(self, db, person, family_handle, family_update,
|
||||
full_update, parent_window=None):
|
||||
def __init__(self, db, person, family_handle, parent_window=None):
|
||||
"""
|
||||
Creates a ChoosePerson dialog box.
|
||||
|
||||
db - database associated the person
|
||||
person - person whose parents we are selecting
|
||||
family - current family
|
||||
family_update - task that updates the family display
|
||||
full_update - task that updates the main display
|
||||
"""
|
||||
self.db = db
|
||||
self.person = person
|
||||
self.family = self.db.get_family_from_handle(family_handle)
|
||||
self.family_update = family_update
|
||||
self.full_update = full_update
|
||||
|
||||
fid = self.family.get_father_handle()
|
||||
mid = self.family.get_mother_handle()
|
||||
@ -698,5 +687,3 @@ class ModifyParents:
|
||||
trans = self.db.transaction_begin()
|
||||
self.db.commit_person(self.person,trans)
|
||||
self.db.transaction_commit(trans,_("Modify Parents"))
|
||||
if self.family_update:
|
||||
self.family_update(None)
|
||||
|
@ -496,19 +496,10 @@ class EditPerson:
|
||||
"on_help_person_clicked" : self.on_help_clicked,
|
||||
})
|
||||
|
||||
if self.parent:
|
||||
try:
|
||||
self.update_sources = self.parent.source_view.build_tree
|
||||
except AttributeError:
|
||||
self.update_sources = None
|
||||
else:
|
||||
self.update_sources = None
|
||||
|
||||
self.sourcetab = Sources.SourceTab(
|
||||
self.srcreflist, self, self.top, self.window, self.slist,
|
||||
self.top.get_widget('add_src'), self.top.get_widget('edit_src'),
|
||||
self.top.get_widget('del_src'), self.db.readonly,
|
||||
self.update_sources)
|
||||
self.top.get_widget('del_src'), self.db.readonly)
|
||||
|
||||
self.complete.set_active(self.person.get_complete_flag())
|
||||
self.private.set_active(self.person.get_privacy())
|
||||
@ -1108,15 +1099,12 @@ class EditPerson:
|
||||
def on_add_addr_clicked(self,obj):
|
||||
"""Invokes the address editor to add a new address"""
|
||||
import AddrEdit
|
||||
AddrEdit.AddressEditor(self,None,self.addr_edit_callback,self.window,
|
||||
self.update_sources)
|
||||
AddrEdit.AddressEditor(self,None,self.addr_edit_callback,self.window)
|
||||
|
||||
def on_add_aka_clicked(self,obj):
|
||||
"""Invokes the name editor to add a new name"""
|
||||
import NameEdit
|
||||
NameEdit.NameEditor(
|
||||
self, None, self.name_edit_callback, self.window,
|
||||
self.update_sources)
|
||||
NameEdit.NameEditor(self, None, self.name_edit_callback, self.window)
|
||||
|
||||
def on_add_url_clicked(self,obj):
|
||||
"""Invokes the url editor to add a new name"""
|
||||
@ -1129,8 +1117,7 @@ class EditPerson:
|
||||
import AttrEdit
|
||||
pname = self.name_display.display(self.person)
|
||||
AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes,
|
||||
self.attr_edit_callback,self.window,
|
||||
self.update_sources)
|
||||
self.attr_edit_callback,self.window)
|
||||
|
||||
def on_up_clicked(self,obj):
|
||||
sel = obj.get_selection()
|
||||
@ -1154,8 +1141,7 @@ class EditPerson:
|
||||
self,pname,const.personalEvents,
|
||||
const.personal_events,None,None,0,
|
||||
self.event_edit_callback,
|
||||
noedit=self.db.readonly,
|
||||
redraw_main_source_list=self.update_sources)
|
||||
noedit=self.db.readonly)
|
||||
|
||||
def on_edit_birth_clicked(self,obj):
|
||||
"""Brings up the EventEditor for the birth record, event
|
||||
|
@ -59,7 +59,7 @@ from DdTargets import DdTargets
|
||||
#-------------------------------------------------------------------------
|
||||
class EditPlace:
|
||||
|
||||
def __init__(self,parent,place,func=None,parent_window=None):
|
||||
def __init__(self,parent,place,parent_window=None):
|
||||
self.parent = parent
|
||||
if place.get_handle():
|
||||
if self.parent.child_windows.has_key(place.get_handle()):
|
||||
@ -73,7 +73,6 @@ class EditPlace:
|
||||
self.place = place
|
||||
self.db = parent.db
|
||||
self.child_windows = {}
|
||||
self.callback = func
|
||||
self.path = parent.db.get_save_path()
|
||||
self.not_loaded = 1
|
||||
self.ref_not_loaded = 1
|
||||
@ -394,11 +393,9 @@ class EditPlace:
|
||||
self.db.commit_place(self.place,trans)
|
||||
else:
|
||||
self.db.add_place(self.place,trans)
|
||||
self.db.transaction_commit(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)
|
||||
|
||||
self.close(obj)
|
||||
|
||||
def on_switch_page(self,obj,a,page):
|
||||
@ -587,10 +584,9 @@ def disp_loc(loc):
|
||||
#-------------------------------------------------------------------------
|
||||
class DeletePlaceQuery:
|
||||
|
||||
def __init__(self,place,db,update):
|
||||
def __init__(self,place,db):
|
||||
self.db = db
|
||||
self.place = place
|
||||
self.update = update
|
||||
|
||||
def query_response(self):
|
||||
trans = self.db.transaction_begin()
|
||||
@ -613,5 +609,5 @@ class DeletePlaceQuery:
|
||||
event.set_place_handle(None)
|
||||
self.db.commit_event(event,trans)
|
||||
|
||||
self.db.transaction_commit(trans,_("Delete Place (%s)") % self.place.get_title())
|
||||
self.update(self.place.get_handle())
|
||||
self.db.transaction_commit(trans,
|
||||
_("Delete Place (%s)") % self.place.get_title())
|
||||
|
@ -55,8 +55,7 @@ import NameDisplay
|
||||
|
||||
class EditSource:
|
||||
|
||||
def __init__(self,source,db,parent,parent_window=None,
|
||||
func=None,readonly=False):
|
||||
def __init__(self,source,db,parent,parent_window=None,readonly=False):
|
||||
if source:
|
||||
self.source = source
|
||||
else:
|
||||
@ -73,7 +72,6 @@ class EditSource:
|
||||
else:
|
||||
self.win_key = self
|
||||
self.child_windows = {}
|
||||
self.callback = func
|
||||
self.path = db.get_save_path()
|
||||
self.not_loaded = 1
|
||||
self.ref_not_loaded = 1
|
||||
@ -359,9 +357,6 @@ class EditSource:
|
||||
else:
|
||||
self.db.commit_source(self.source,trans)
|
||||
self.db.transaction_commit(trans,_("Edit Source (%s)") % title)
|
||||
|
||||
if self.callback:
|
||||
self.callback(self.source)
|
||||
self.close(obj)
|
||||
|
||||
def on_switch_page(self,obj,a,page):
|
||||
|
@ -61,9 +61,7 @@ from QuestionDialog import WarningDialog, ErrorDialog
|
||||
class EventEditor:
|
||||
|
||||
def __init__(self,parent,name,elist,trans,event,def_placename,
|
||||
read_only, cb, def_event=None, noedit=False,
|
||||
redraw_main_source_list=None):
|
||||
self.redraw_main_source_list = redraw_main_source_list
|
||||
read_only, cb, def_event=None, noedit=False):
|
||||
self.parent = parent
|
||||
self.db = self.parent.db
|
||||
if event:
|
||||
@ -170,7 +168,7 @@ class EventEditor:
|
||||
self.sourcetab = Sources.SourceTab(
|
||||
self.srcreflist, self, self.top, self.window, self.slist,
|
||||
add_src, self.top.get_widget('edit_src'), del_src,
|
||||
self.db.readonly, self.redraw_main_source_list )
|
||||
self.db.readonly)
|
||||
|
||||
add_witness = self.top.get_widget('add_witness')
|
||||
add_witness.set_sensitive(not noedit)
|
||||
|
@ -95,6 +95,19 @@ class FamilyView:
|
||||
self.cadded = [ 0, 0 ]
|
||||
self.in_drag = False
|
||||
self.init_interface()
|
||||
self.change_db()
|
||||
|
||||
def change_db(self):
|
||||
self.parent.db.add_family_callbacks(
|
||||
'family_view', self.update_callback, self.update_callback,
|
||||
self.update_callback, self.load_family)
|
||||
|
||||
self.parent.db.add_person_callbacks(
|
||||
'family_view', self.update_callback, self.update_callback,
|
||||
self.update_callback, self.load_family)
|
||||
|
||||
def update_callback(self,handle):
|
||||
self.load_family()
|
||||
|
||||
def set_widgets(self,val):
|
||||
already_init = self.cadded[val]
|
||||
@ -551,13 +564,13 @@ class FamilyView:
|
||||
def child_rel(self,obj):
|
||||
handle = obj.get_data('o')
|
||||
person = self.parent.db.get_person_from_handle(handle)
|
||||
ChooseParents.ModifyParents(self.parent.db, person, self.family.get_handle(),
|
||||
None,self.load_family)
|
||||
ChooseParents.ModifyParents(self.parent.db, person,
|
||||
self.family.get_handle())
|
||||
|
||||
def child_rel_by_id(self,handle):
|
||||
person = self.parent.db.get_person_from_handle(handle)
|
||||
ChooseParents.ModifyParents(self.parent.db, person, self.family.get_handle(),
|
||||
None,self.load_family)
|
||||
ChooseParents.ModifyParents(self.parent.db, person,
|
||||
self.family.get_handle())
|
||||
|
||||
def spouse_changed(self,obj):
|
||||
if self.in_drag:
|
||||
@ -684,45 +697,35 @@ class FamilyView:
|
||||
|
||||
def spouse_after_edit(self,epo,val):
|
||||
ap = self.parent.active_person
|
||||
if epo:
|
||||
#trans = self.parent.db.transaction_begin()
|
||||
#self.parent.db.commit_person(epo.person,trans)
|
||||
#n = epo.person.get_primary_name().get_regular_name()
|
||||
#self.parent.db.transaction_commit(trans,_("Add Spouse (%s)") % n)
|
||||
self.parent.people_view.remove_from_person_list(epo.person)
|
||||
self.parent.people_view.redisplay_person_list(epo.person)
|
||||
|
||||
self.parent.active_person = ap
|
||||
self.load_family()
|
||||
|
||||
def new_spouse_after_edit(self,epo,val):
|
||||
|
||||
#self.parent.db.add_person(epo.person,trans)
|
||||
new_person = epo.person
|
||||
old_person = self.person
|
||||
trans = self.parent.db.transaction_begin()
|
||||
self.family = RelLib.Family()
|
||||
self.parent.db.add_family(self.family,trans)
|
||||
fhandle = self.parent.db.create_id()
|
||||
family = RelLib.Family()
|
||||
family.set_handle(fhandle)
|
||||
family.set_gramps_id(self.parent.db.find_next_family_gramps_id())
|
||||
|
||||
self.parent.people_view.add_to_person_list(epo.person,0)
|
||||
self.person.add_family_handle(self.family.get_handle())
|
||||
epo.person.add_family_handle(self.family.get_handle())
|
||||
|
||||
self.parent.db.commit_person(epo.person,trans)
|
||||
self.parent.db.commit_person(self.person,trans)
|
||||
old_person.add_family_handle(fhandle)
|
||||
new_person.add_family_handle(fhandle)
|
||||
|
||||
if self.person.get_gender() == RelLib.Person.MALE:
|
||||
self.family.set_mother_handle(epo.person.get_handle())
|
||||
self.family.set_father_handle(self.person.get_handle())
|
||||
family.set_mother_handle(epo.person.get_handle())
|
||||
family.set_father_handle(self.person.get_handle())
|
||||
else:
|
||||
self.family.set_father_handle(epo.person.get_handle())
|
||||
self.family.set_mother_handle(self.person.get_handle())
|
||||
|
||||
self.parent.db.commit_family(self.family,trans)
|
||||
self.load_family(self.family)
|
||||
family.set_father_handle(epo.person.get_handle())
|
||||
family.set_mother_handle(self.person.get_handle())
|
||||
|
||||
self.parent.db.commit_person(new_person,trans)
|
||||
self.parent.db.commit_person(old_person,trans)
|
||||
self.parent.db.commit_family(family,trans)
|
||||
self.parent.db.transaction_commit(trans,_("Add Spouse"))
|
||||
m = Marriage.Marriage(
|
||||
self.parent,self.family,self.parent.db, self.parent.new_after_edit,
|
||||
self.load_family, self.parent.source_view.build_tree)
|
||||
self.family = family
|
||||
self.person = old_person
|
||||
m = Marriage.Marriage(self.parent,self.family,self.parent.db)
|
||||
|
||||
m.on_add_clicked()
|
||||
|
||||
@ -764,8 +767,6 @@ class FamilyView:
|
||||
|
||||
self.family.add_child_handle(person)
|
||||
person.add_parent_family_handle(self.family.get_handle(),"Birth","Birth")
|
||||
self.parent.update_person_list(person)
|
||||
self.load_family(self.family)
|
||||
self.parent.db.commit_person(person,trans)
|
||||
self.parent.db.commit_family(self.family,trans)
|
||||
self.parent.db.transaction_commit(trans,_("Modify family"))
|
||||
@ -788,7 +789,9 @@ class FamilyView:
|
||||
|
||||
trans = self.parent.db.transaction_begin()
|
||||
self.family.add_child_handle(epo.person.get_handle())
|
||||
epo.person.add_parent_family_handle(self.family.get_handle(),RelLib.Person.CHILD_REL_BIRTH,RelLib.Person.CHILD_REL_BIRTH)
|
||||
epo.person.add_parent_family_handle(self.family.get_handle(),
|
||||
RelLib.Person.CHILD_REL_BIRTH,
|
||||
RelLib.Person.CHILD_REL_BIRTH)
|
||||
self.parent.db.commit_person(epo.person,trans)
|
||||
self.parent.db.commit_family(self.family,trans)
|
||||
self.parent.db.transaction_commit(trans,_("Add Child to Family"))
|
||||
@ -831,8 +834,6 @@ class FamilyView:
|
||||
self.parent.db.commit_family(self.family,trans)
|
||||
n = child.get_primary_name().get_regular_name()
|
||||
self.parent.db.transaction_commit(trans,_("Remove Child (%s)") % n)
|
||||
|
||||
self.load_family()
|
||||
|
||||
def remove_spouse(self,obj):
|
||||
if self.selected_spouse:
|
||||
@ -878,11 +879,6 @@ class FamilyView:
|
||||
if len(self.person.get_family_handle_list()) > 0:
|
||||
handle = self.person.get_family_handle_list()[0]
|
||||
family = self.parent.db.find_family_from_handle(handle,trans)
|
||||
self.load_family(family)
|
||||
else:
|
||||
self.load_family(self.family)
|
||||
else:
|
||||
self.load_family(self.family)
|
||||
|
||||
person_id = self.person.get_handle()
|
||||
self.person = self.parent.db.get_person_from_handle(person_id)
|
||||
@ -961,7 +957,6 @@ class FamilyView:
|
||||
self.select_spouse_btn.set_sensitive(mode)
|
||||
|
||||
def load_family(self,family=None):
|
||||
|
||||
self.set_buttons()
|
||||
if self.parent.active_person:
|
||||
handle = self.parent.active_person.get_handle()
|
||||
@ -1338,8 +1333,6 @@ class FamilyView:
|
||||
|
||||
try:
|
||||
ChooseParents.ModifyParents(self.parent.db,person,parents,
|
||||
self.load_family,
|
||||
self.parent.full_update,
|
||||
self.parent.topWindow)
|
||||
except:
|
||||
DisplayTrace.DisplayTrace()
|
||||
@ -1351,9 +1344,7 @@ class FamilyView:
|
||||
ChooseParents.ChooseParents(self.parent,
|
||||
self.parent.db,
|
||||
person,
|
||||
None,
|
||||
self.load_family,
|
||||
self.parent.full_update)
|
||||
None)
|
||||
except:
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
|
@ -277,14 +277,17 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.genderStats.uncount_person (person)
|
||||
if transaction != None:
|
||||
transaction.add(PERSON_KEY,handle,person.serialize())
|
||||
if transaction and not transaction.batch:
|
||||
self.run_person_delete_callbacks([str(handle)])
|
||||
self.person_map.delete(str(handle))
|
||||
self.run_person_delete_callbacks(str(handle))
|
||||
|
||||
def remove_source(self,handle,transaction):
|
||||
if not self.readonly:
|
||||
if transaction != None:
|
||||
old_data = self.source_map.get(str(handle))
|
||||
transaction.add(SOURCE_KEY,handle,old_data)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_source_delete_callbacks([handle])
|
||||
self.source_map.delete(str(handle))
|
||||
|
||||
def remove_family(self,handle,transaction):
|
||||
@ -292,6 +295,8 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
if transaction != None:
|
||||
old_data = self.family_map.get(str(handle))
|
||||
transaction.add(FAMILY_KEY,handle,old_data)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_family_delete_callbacks([str(handle)])
|
||||
self.family_map.delete(str(handle))
|
||||
|
||||
def remove_event(self,handle,transaction):
|
||||
@ -306,6 +311,8 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
if transaction != None:
|
||||
old_data = self.place_map.get(handle)
|
||||
transaction.add(PLACE_KEY,handle,old_data)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_person_delete_callbacks([handle])
|
||||
self.place_map.delete(str(handle))
|
||||
|
||||
def remove_object(self,handle,transaction):
|
||||
|
@ -168,14 +168,62 @@ class GrampsDbBase:
|
||||
self.person_add_callback = {}
|
||||
self.person_update_callback = {}
|
||||
self.person_delete_callback = {}
|
||||
self.person_rebuild_callback = {}
|
||||
|
||||
def add_person_callbacks(self, key, add, update, delete):
|
||||
self.family_add_callback = {}
|
||||
self.family_update_callback = {}
|
||||
self.family_delete_callback = {}
|
||||
self.family_rebuild_callback = {}
|
||||
|
||||
self.place_add_callback = {}
|
||||
self.place_update_callback = {}
|
||||
self.place_delete_callback = {}
|
||||
self.place_rebuild_callback = {}
|
||||
|
||||
self.source_add_callback = {}
|
||||
self.source_update_callback = {}
|
||||
self.source_delete_callback = {}
|
||||
self.source_rebuild_callback = {}
|
||||
|
||||
def add_person_callbacks(self, key, add, update, delete, rebuild):
|
||||
if add:
|
||||
self.person_add_callback[key] = add
|
||||
if update:
|
||||
self.person_update_callback[key] = update
|
||||
if delete:
|
||||
self.person_delete_callback[key] = delete
|
||||
if rebuild:
|
||||
self.person_rebuild_callback[key] = rebuild
|
||||
|
||||
def add_place_callbacks(self, key, add, update, delete, rebuild):
|
||||
if add:
|
||||
self.place_add_callback[key] = add
|
||||
if update:
|
||||
self.place_update_callback[key] = update
|
||||
if delete:
|
||||
self.place_delete_callback[key] = delete
|
||||
if rebuild:
|
||||
self.place_rebuild_callback[key] = rebuild
|
||||
|
||||
def add_source_callbacks(self, key, add, update, delete, rebuild):
|
||||
if add:
|
||||
self.source_add_callback[key] = add
|
||||
if update:
|
||||
self.source_update_callback[key] = update
|
||||
if delete:
|
||||
self.source_delete_callback[key] = delete
|
||||
if rebuild:
|
||||
self.source_rebuild_callback[key] = rebuild
|
||||
|
||||
def add_family_callbacks(self, key, add, update, delete, rebuild):
|
||||
if add:
|
||||
self.family_add_callback[key] = add
|
||||
if update:
|
||||
self.family_update_callback[key] = update
|
||||
if delete:
|
||||
self.family_delete_callback[key] = delete
|
||||
if rebuild:
|
||||
self.family_rebuild_callback[key] = rebuild
|
||||
|
||||
def remove_person_callbacks(self, key):
|
||||
if self.person_add_callback.has_key(key):
|
||||
@ -184,18 +232,102 @@ class GrampsDbBase:
|
||||
del self.person_update_callback[key]
|
||||
if self.person_delete_callback.has_key(key):
|
||||
del self.person_delete_callback[key]
|
||||
if self.person_rebuild_callback.has_key(key):
|
||||
del self.person_rebuild_callback[key]
|
||||
|
||||
def run_person_add_callbacks(self,handle):
|
||||
def remove_place_callbacks(self, key):
|
||||
if self.place_add_callback.has_key(key):
|
||||
del self.place_add_callback[key]
|
||||
if self.place_update_callback.has_key(key):
|
||||
del self.place_update_callback[key]
|
||||
if self.place_delete_callback.has_key(key):
|
||||
del self.place_delete_callback[key]
|
||||
if self.place_rebuild_callback.has_key(key):
|
||||
del self.place_rebuild_callback[key]
|
||||
|
||||
def remove_family_callbacks(self, key):
|
||||
if self.family_add_callback.has_key(key):
|
||||
del self.family_add_callback[key]
|
||||
if self.family_update_callback.has_key(key):
|
||||
del self.family_update_callback[key]
|
||||
if self.family_delete_callback.has_key(key):
|
||||
del self.family_delete_callback[key]
|
||||
if self.family_rebuild_callback.has_key(key):
|
||||
del self.family_rebuild_callback[key]
|
||||
|
||||
def remove_source_callbacks(self, key):
|
||||
if self.source_add_callback.has_key(key):
|
||||
del self.source_add_callback[key]
|
||||
if self.source_update_callback.has_key(key):
|
||||
del self.source_update_callback[key]
|
||||
if self.source_delete_callback.has_key(key):
|
||||
del self.source_delete_callback[key]
|
||||
if self.source_rebuild_callback.has_key(key):
|
||||
del self.source_rebuild_callback[key]
|
||||
|
||||
def run_person_add_callbacks(self,handle_list):
|
||||
for func in self.person_add_callback.values():
|
||||
func(handle)
|
||||
func(handle_list)
|
||||
|
||||
def run_person_update_callbacks(self,handle):
|
||||
def run_person_update_callbacks(self,handle_list):
|
||||
for func in self.person_update_callback.values():
|
||||
func(handle)
|
||||
func(handle_list)
|
||||
|
||||
def run_person_delete_callbacks(self,handle):
|
||||
def run_person_delete_callbacks(self,handle_list):
|
||||
for func in self.person_delete_callback.values():
|
||||
func(handle)
|
||||
func(handle_list)
|
||||
|
||||
def run_person_rebuild_callbacks(self):
|
||||
for func in self.person_rebuild_callback.values():
|
||||
func()
|
||||
|
||||
def run_family_add_callbacks(self,handle_list):
|
||||
for func in self.family_add_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_family_update_callbacks(self,handle_list):
|
||||
for func in self.family_update_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_family_delete_callbacks(self,handle_list):
|
||||
for func in self.family_delete_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_family_rebuild_callbacks(self):
|
||||
for func in self.family_rebuild_callback.values():
|
||||
func()
|
||||
|
||||
def run_source_add_callbacks(self,handle_list):
|
||||
for func in self.source_add_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_source_update_callbacks(self,handle_list):
|
||||
for func in self.source_update_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_source_delete_callbacks(self,handle_list):
|
||||
for func in self.source_delete_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_source_rebuild_callbacks(self):
|
||||
for func in self.source_rebuild_callback.values():
|
||||
func()
|
||||
|
||||
def run_place_add_callbacks(self,handle_list):
|
||||
for func in self.place_add_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_place_update_callbacks(self,handle_list):
|
||||
for func in self.place_update_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_place_delete_callbacks(self,handle_list):
|
||||
for func in self.place_delete_callback.values():
|
||||
func(handle_list)
|
||||
|
||||
def run_place_rebuild_callbacks(self):
|
||||
for func in self.place_rebuild_callback.values():
|
||||
func()
|
||||
|
||||
def need_upgrade(self):
|
||||
return False
|
||||
@ -272,7 +404,11 @@ class GrampsDbBase:
|
||||
transaction.add(PERSON_KEY,handle,old_data)
|
||||
|
||||
self.person_map[handle] = person.serialize()
|
||||
self.run_person_update_callbacks(handle)
|
||||
if transaction and not transaction.batch:
|
||||
if old_data:
|
||||
self.run_person_update_callbacks([handle])
|
||||
else:
|
||||
self.run_person_add_callbacks([handle])
|
||||
|
||||
def commit_media_object(self,obj,transaction,change_time=None):
|
||||
"""
|
||||
@ -307,6 +443,11 @@ class GrampsDbBase:
|
||||
old_data = self.source_map.get(handle)
|
||||
transaction.add(SOURCE_KEY,handle,old_data)
|
||||
self.source_map[handle] = source.serialize()
|
||||
if transaction and not transaction.batch:
|
||||
if old_data:
|
||||
self.run_source_update_callbacks([handle])
|
||||
else:
|
||||
self.run_source_add_callbacks([handle])
|
||||
|
||||
def commit_place(self,place,transaction,change_time=None):
|
||||
"""
|
||||
@ -324,6 +465,11 @@ class GrampsDbBase:
|
||||
old_data = self.place_map.get(handle)
|
||||
transaction.add(PLACE_KEY,handle,old_data)
|
||||
self.place_map[handle] = place.serialize()
|
||||
if transaction and not transaction.batch:
|
||||
if old_data:
|
||||
self.run_place_update_callbacks([handle])
|
||||
else:
|
||||
self.run_place_add_callbacks([handle])
|
||||
|
||||
def commit_event(self,event,transaction,change_time=None):
|
||||
"""
|
||||
@ -347,8 +493,8 @@ class GrampsDbBase:
|
||||
Commits the specified Family to the database, storing the changes
|
||||
as part of the transaction.
|
||||
"""
|
||||
if self.readonly or not family.get_handle():
|
||||
return
|
||||
if self.readonly or not family.handle:
|
||||
return
|
||||
if change_time:
|
||||
family.change = int(change_time)
|
||||
else:
|
||||
@ -359,6 +505,12 @@ class GrampsDbBase:
|
||||
transaction.add(FAMILY_KEY,handle,old_data)
|
||||
self.family_map[handle] = family.serialize()
|
||||
|
||||
if transaction and not transaction.batch:
|
||||
if old_data:
|
||||
self.run_family_update_callbacks([handle])
|
||||
else:
|
||||
self.run_family_add_callbacks([handle])
|
||||
|
||||
def find_next_person_gramps_id(self):
|
||||
"""
|
||||
Returns the next available GRAMPS' ID for a Person object based
|
||||
@ -507,7 +659,8 @@ class GrampsDbBase:
|
||||
if transaction != None:
|
||||
transaction.add(PERSON_KEY, val, None)
|
||||
self.person_map[str(val)] = person.serialize()
|
||||
self.run_person_add_callbacks(str(val))
|
||||
if transaction and not transaction.batch:
|
||||
self.run_person_add_callbacks([str(val)])
|
||||
self.genderStats.count_person (person, self)
|
||||
return person
|
||||
|
||||
@ -641,6 +794,8 @@ class GrampsDbBase:
|
||||
if family.get_handle() == None:
|
||||
family.set_handle(self.create_id())
|
||||
self.commit_family(family,transaction)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_family_add_callbacks(str(family.handle))
|
||||
return family.get_handle()
|
||||
|
||||
def add_source(self,source,transaction):
|
||||
@ -653,6 +808,8 @@ class GrampsDbBase:
|
||||
if source.get_gramps_id() == None:
|
||||
source.set_gramps_id(self.find_next_source_gramps_id())
|
||||
self.commit_source(source,transaction)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_source_add_callbacks([source.handle])
|
||||
return source.get_handle()
|
||||
|
||||
def add_event(self,event,transaction):
|
||||
@ -678,6 +835,8 @@ class GrampsDbBase:
|
||||
if place.get_gramps_id() == None:
|
||||
place.set_gramps_id(self.find_next_place_gramps_id())
|
||||
self.commit_place(place,transaction)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_place_add_callbacks([source.handle])
|
||||
return place.get_handle()
|
||||
|
||||
def add_object(self,obj,transaction):
|
||||
@ -936,6 +1095,12 @@ class GrampsDbBase:
|
||||
if self.undo_callback:
|
||||
self.undo_callback(_("_Undo %s") % transaction.get_description())
|
||||
|
||||
if transaction and transaction.batch:
|
||||
self.run_person_rebuild_callbacks()
|
||||
self.run_family_rebuild_callbacks()
|
||||
self.run_place_rebuild_callbacks()
|
||||
self.run_source_rebuild_callbacks()
|
||||
|
||||
def undo(self):
|
||||
"""
|
||||
Accesses the last committed transaction, and reverts the data to
|
||||
@ -952,21 +1117,25 @@ class GrampsDbBase:
|
||||
(key, handle, data) = transaction.get_record(record_id)
|
||||
if key == PERSON_KEY:
|
||||
if data == None:
|
||||
self.run_person_delete_callbacks([str(handle)])
|
||||
del self.person_map[str(handle)]
|
||||
self.run_person_delete_callbacks(str(handle))
|
||||
else:
|
||||
self.person_map[str(handle)] = data
|
||||
self.run_person_update_callbacks(str(handle))
|
||||
self.run_person_update_callbacks([str(handle)])
|
||||
elif key == FAMILY_KEY:
|
||||
if data == None:
|
||||
self.run_family_delete_callbacks([str(handle)])
|
||||
del self.family_map[str(handle)]
|
||||
else:
|
||||
self.family_map[str(handle)] = data
|
||||
self.run_family_update_callbacks([str(handle)])
|
||||
elif key == SOURCE_KEY:
|
||||
if data == None:
|
||||
self.run_source_delete_callbacks([str(handle)])
|
||||
del self.source_map[str(handle)]
|
||||
else:
|
||||
self.source_map[str(handle)] = data
|
||||
self.run_source_update_callbacks([str(handle)])
|
||||
elif key == EVENT_KEY:
|
||||
if data == None:
|
||||
del self.event_map[str(handle)]
|
||||
@ -974,9 +1143,11 @@ class GrampsDbBase:
|
||||
self.event_map[str(handle)] = data
|
||||
elif key == PLACE_KEY:
|
||||
if data == None:
|
||||
self.run_place_delete_callbacks([str(handle)])
|
||||
del self.place_map[str(handle)]
|
||||
else:
|
||||
self.place_map[str(handle)] = data
|
||||
self.run_place_update_callbacks([str(handle)])
|
||||
elif key == MEDIA_KEY:
|
||||
if data == None:
|
||||
del self.media_map[str(handle)]
|
||||
@ -1309,7 +1480,14 @@ class Transaction:
|
||||
self.db = db
|
||||
self.first = None
|
||||
self.last = None
|
||||
self.batch = False
|
||||
|
||||
def set_batch(self,batch):
|
||||
self.batch = batch
|
||||
|
||||
def get_batch(self):
|
||||
return self.batch
|
||||
|
||||
def get_description(self):
|
||||
"""
|
||||
Returns the text string that describes the logical operation
|
||||
|
@ -142,9 +142,10 @@ class GrampsInMemDB(GrampsDbBase):
|
||||
if transaction != None:
|
||||
old_data = self.person_map.get(handle)
|
||||
transaction.add(PERSON_KEY,handle,old_data)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_person_delete_callbacks([handle])
|
||||
del self.id_trans[person.get_gramps_id()]
|
||||
del self.person_map[handle]
|
||||
self.run_person_delete_callbacks(handle)
|
||||
|
||||
def remove_source(self,handle,transaction):
|
||||
if self.readonly:
|
||||
@ -153,6 +154,8 @@ class GrampsInMemDB(GrampsDbBase):
|
||||
if transaction != None:
|
||||
old_data = self.source_map.get(str(handle))
|
||||
transaction.add(SOURCE_KEY,handle,old_data)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_source_delete_callbacks([handle])
|
||||
del self.sid_trans[source.get_gramps_id()]
|
||||
del self.source_map[str(handle)]
|
||||
|
||||
@ -163,6 +166,8 @@ class GrampsInMemDB(GrampsDbBase):
|
||||
if transaction != None:
|
||||
old_data = self.place_map.get(str(handle))
|
||||
transaction.add(PLACE_KEY,handle,old_data)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_person_delete_callbacks([handle])
|
||||
del self.pid_trans[place.get_gramps_id()]
|
||||
del self.place_map[str(handle)]
|
||||
|
||||
@ -183,6 +188,8 @@ class GrampsInMemDB(GrampsDbBase):
|
||||
if transaction != None:
|
||||
old_data = self.family_map.get(str(handle))
|
||||
transaction.add(FAMILY_KEY,handle,old_data)
|
||||
if transaction and not transaction.batch:
|
||||
self.run_family_delete_callbacks([str(handle)])
|
||||
del self.fid_trans[family.get_gramps_id()]
|
||||
del self.family_map[str(handle)]
|
||||
|
||||
|
@ -77,7 +77,7 @@ _temple_names = [""] + _temple_names
|
||||
#-------------------------------------------------------------------------
|
||||
class Marriage:
|
||||
|
||||
def __init__(self,parent,family,db,callback,update,source_update):
|
||||
def __init__(self,parent,family,db):
|
||||
"""Initializes the Marriage class, and displays the window"""
|
||||
self.family = family
|
||||
self.parent = parent
|
||||
@ -87,11 +87,8 @@ class Marriage:
|
||||
self.child_windows = {}
|
||||
self.db = db
|
||||
self.path = db.get_save_path()
|
||||
self.cb = callback
|
||||
self.update_fv = update
|
||||
self.pmap = {}
|
||||
self.dp = DateHandler.parser
|
||||
self.update_sources = source_update
|
||||
|
||||
if family:
|
||||
self.srcreflist = family.get_source_references()
|
||||
@ -302,8 +299,7 @@ class Marriage:
|
||||
self.sourcetab = Sources.SourceTab(
|
||||
self.srcreflist, self, self.top, self.window, self.slist,
|
||||
self.top.get_widget('add_src'), self.top.get_widget('edit_src'),
|
||||
self.top.get_widget('del_src'), self.db.readonly,
|
||||
self.update_sources)
|
||||
self.top.get_widget('del_src'), self.db.readonly)
|
||||
|
||||
self.redraw_event_list()
|
||||
self.redraw_attr_list()
|
||||
@ -703,7 +699,6 @@ class Marriage:
|
||||
self.update_lists()
|
||||
self.db.commit_family(self.family,trans)
|
||||
self.db.transaction_commit(trans,_("Edit Marriage"))
|
||||
self.update_fv(self.family)
|
||||
|
||||
self.close(1)
|
||||
|
||||
@ -718,12 +713,10 @@ class Marriage:
|
||||
def on_add_clicked(self,*obj):
|
||||
import EventEdit
|
||||
name = Utils.family_name(self.family,self.db)
|
||||
EventEdit.EventEditor(self,name,const.marriageEvents,
|
||||
const.family_events,None,None,
|
||||
0,self.event_edit_callback,
|
||||
const.defaultMarriageEvent,
|
||||
self.db.readonly,
|
||||
self.update_sources)
|
||||
EventEdit.EventEditor(
|
||||
self,name, const.marriageEvents, const.family_events,
|
||||
None, None, 0, self.event_edit_callback,
|
||||
const.defaultMarriageEvent, self.db.readonly)
|
||||
|
||||
def on_event_update_clicked(self,obj):
|
||||
import EventEdit
|
||||
@ -732,11 +725,9 @@ class Marriage:
|
||||
return
|
||||
event = self.etree.get_object(node)
|
||||
name = Utils.family_name(self.family,self.db)
|
||||
EventEdit.EventEditor(self,name,const.marriageEvents,
|
||||
const.family_events,event,None,
|
||||
0,self.event_edit_callback,None,
|
||||
self.db.readonly,
|
||||
self.update_sources)
|
||||
EventEdit.EventEditor(
|
||||
self, name, const.marriageEvents, const.family_events,event,
|
||||
None, 0,self.event_edit_callback, None, self.db.readonly)
|
||||
|
||||
def on_delete_clicked(self,obj):
|
||||
if Utils.delete_selected(obj,self.elist):
|
||||
|
@ -57,10 +57,8 @@ import DateHandler
|
||||
#-------------------------------------------------------------------------
|
||||
class NameEditor:
|
||||
|
||||
def __init__(self,parent,name,callback,parent_window=None,
|
||||
update_sources=None):
|
||||
def __init__(self,parent,name,callback,parent_window=None):
|
||||
|
||||
self.update_sources = update_sources
|
||||
self.parent = parent
|
||||
self.db = self.parent.db
|
||||
if name:
|
||||
@ -132,8 +130,7 @@ class NameEditor:
|
||||
self.sourcetab = Sources.SourceTab(
|
||||
self.srcreflist, self, self.top, self.window, self.slist,
|
||||
self.top.get_widget('add_src'), self.top.get_widget('edit_src'),
|
||||
self.top.get_widget('del_src'), self.db.readonly,
|
||||
self.update_sources)
|
||||
self.top.get_widget('del_src'), self.db.readonly)
|
||||
|
||||
self.note_buffer = self.note_field.get_buffer()
|
||||
|
||||
@ -352,8 +349,9 @@ class NameEditor:
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
def on_switch_page(self,obj,a,page):
|
||||
text = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(),
|
||||
self.note_buffer.get_end_iter(),False))
|
||||
start = self.note_buffer.get_start_iter()
|
||||
stop = self.note_buffer.get_end_iter()
|
||||
text = unicode(self.note_buffer.get_text(start, stop, False))
|
||||
if text:
|
||||
Utils.bold_label(self.notes_label)
|
||||
else:
|
||||
|
@ -88,6 +88,10 @@ class PeopleView:
|
||||
self.person_tree.connect('button-press-event',
|
||||
self.on_plist_button_press)
|
||||
|
||||
self.parent.db.add_person_callbacks(
|
||||
'person_view', self.person_added, self.person_updated,
|
||||
self.person_removed, self.redisplay_person_list)
|
||||
|
||||
def sort_clicked(self,obj):
|
||||
for col in self.columns:
|
||||
if obj == col:
|
||||
@ -122,8 +126,6 @@ class PeopleView:
|
||||
name = column_names[pair[1]]
|
||||
column = gtk.TreeViewColumn(name, self.renderer, text=pair[1])
|
||||
column.set_resizable(True)
|
||||
#column.set_clickable(True)
|
||||
#column.connect('clicked',self.sort_clicked)
|
||||
column.set_min_width(60)
|
||||
column.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY)
|
||||
self.columns.append(column)
|
||||
@ -131,13 +133,13 @@ class PeopleView:
|
||||
index += 1
|
||||
|
||||
def build_tree(self):
|
||||
self.person_model = PeopleModel.PeopleModel(self.parent.db,self.DataFilter)
|
||||
self.person_model = PeopleModel.PeopleModel(self.parent.db,
|
||||
self.DataFilter)
|
||||
self.person_tree.set_model(self.person_model)
|
||||
|
||||
def blist(self, store, path, node, id_list):
|
||||
id_list.append(self.person_model.get_value(
|
||||
node,
|
||||
PeopleModel.COLUMN_INT_ID))
|
||||
idval = self.person_model.get_value(node, PeopleModel.COLUMN_INT_ID)
|
||||
id_list.append(idval)
|
||||
|
||||
def get_selected_objects(self):
|
||||
mlist = []
|
||||
@ -162,6 +164,9 @@ class PeopleView:
|
||||
self.build_columns()
|
||||
self.person_model = PeopleModel.PeopleModel(db,self.DataFilter)
|
||||
self.person_tree.set_model(self.person_model)
|
||||
self.parent.db.add_person_callbacks(
|
||||
'person_view', self.person_added, self.person_updated,
|
||||
self.person_removed, self.redisplay_person_list)
|
||||
|
||||
def remove_from_person_list(self,person):
|
||||
"""Remove the selected person from the list. A person object is
|
||||
@ -171,7 +176,6 @@ class PeopleView:
|
||||
|
||||
def remove_from_history(self,person_handle,old_id=None):
|
||||
"""Removes a person from the history list"""
|
||||
|
||||
if old_id:
|
||||
del_id = old_id
|
||||
else:
|
||||
@ -196,7 +200,7 @@ class PeopleView:
|
||||
self.goto_active_person()
|
||||
|
||||
def add_to_person_list(self,person,change=0):
|
||||
self.apply_filter_clicked()
|
||||
pass
|
||||
|
||||
def goto_active_person(self):
|
||||
if not self.parent.active_person:
|
||||
@ -267,101 +271,93 @@ class PeopleView:
|
||||
menu.append(item)
|
||||
menu.popup(None,None,None,event.button,event.time)
|
||||
|
||||
def redisplay_person_list(self,person):
|
||||
self.person_model.rebuild_data(self.DataFilter)
|
||||
self.add_person(person)
|
||||
def redisplay_person_list(self):
|
||||
self.build_tree()
|
||||
|
||||
def person_added(self,handle):
|
||||
person = self.parent.db.get_person_from_handle(handle)
|
||||
self.add_person(person)
|
||||
|
||||
def add_person(self,person):
|
||||
node = person.get_handle()
|
||||
top = person.get_primary_name().get_group_name()
|
||||
self.person_model.rebuild_data(self.DataFilter)
|
||||
if not self.person_model.is_visable(node):
|
||||
return
|
||||
if (not self.person_model.sname_sub.has_key(top) or
|
||||
len(self.person_model.sname_sub[top]) == 1):
|
||||
path = self.person_model.on_get_path(top)
|
||||
pnode = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,pnode)
|
||||
path = self.person_model.on_get_path(node)
|
||||
pnode = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,pnode)
|
||||
|
||||
def person_removed(self,handle):
|
||||
person = self.parent.db.get_person_from_handle(handle)
|
||||
self.delete_person(person)
|
||||
|
||||
def delete_person(self,person,rebuild=False):
|
||||
node = person.get_handle()
|
||||
if not self.person_model.is_visable(node):
|
||||
return
|
||||
top = person.get_primary_name().get_group_name()
|
||||
mylist = self.person_model.sname_sub.get(top,[])
|
||||
if mylist:
|
||||
try:
|
||||
path = self.person_model.on_get_path(node)
|
||||
self.person_model.row_deleted(path)
|
||||
if len(mylist) == 1:
|
||||
path = self.person_model.on_get_path(top)
|
||||
self.person_model.row_deleted(path)
|
||||
except KeyError:
|
||||
pass
|
||||
self.person_model.rebuild_data(self.DataFilter,skip=node)
|
||||
|
||||
def person_updated(self,handle):
|
||||
person = self.parent.db.get_person_from_handle(handle)
|
||||
self.update_person_list(person)
|
||||
|
||||
def update_person_list(self,person):
|
||||
# find original path,node of person
|
||||
node = person.get_handle()
|
||||
try:
|
||||
oldpath = self.person_model.iter2path[node]
|
||||
except:
|
||||
return
|
||||
pathval = self.person_model.on_get_path(node)
|
||||
pnode = self.person_model.get_iter(pathval)
|
||||
|
||||
# calculate the new data
|
||||
self.person_model.calculate_data(self.DataFilter)
|
||||
|
||||
# find the path of the person in the new data build
|
||||
newpath = self.person_model.temp_iter2path[node]
|
||||
|
||||
# if paths same, just issue row changed signal
|
||||
if oldpath == newpath:
|
||||
self.person_model.row_changed(pathval,pnode)
|
||||
else:
|
||||
# paths different, get the new surname list
|
||||
|
||||
mylist = self.person_model.temp_sname_sub.get(oldpath[0],[])
|
||||
path = self.person_model.on_get_path(node)
|
||||
|
||||
# delete original
|
||||
self.person_model.row_deleted(pathval)
|
||||
|
||||
# delete top node of original if necessar
|
||||
if len(mylist)==0:
|
||||
self.person_model.row_deleted(pathval[0])
|
||||
|
||||
# determine if we need to insert a new top node',
|
||||
insert = not self.person_model.sname_sub.has_key(newpath[0])
|
||||
|
||||
# assign new data
|
||||
self.person_model.assign_data()
|
||||
|
||||
# insert new row if needed
|
||||
if insert:
|
||||
path = self.person_model.on_get_path(newpath[0])
|
||||
def person_added(self,handle_list):
|
||||
for node in handle_list:
|
||||
person = self.parent.db.get_person_from_handle(node)
|
||||
top = person.get_primary_name().get_group_name()
|
||||
self.person_model.rebuild_data(self.DataFilter)
|
||||
if not self.person_model.is_visable(node):
|
||||
continue
|
||||
if (not self.person_model.sname_sub.has_key(top) or
|
||||
len(self.person_model.sname_sub[top]) == 1):
|
||||
path = self.person_model.on_get_path(top)
|
||||
pnode = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,pnode)
|
||||
|
||||
# insert new person
|
||||
path = self.person_model.on_get_path(node)
|
||||
pnode = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,pnode)
|
||||
|
||||
def person_removed(self,handle_list):
|
||||
for node in handle_list:
|
||||
person = self.parent.db.get_person_from_handle(node)
|
||||
if not self.person_model.is_visable(node):
|
||||
continue
|
||||
top = person.get_primary_name().get_group_name()
|
||||
mylist = self.person_model.sname_sub.get(top,[])
|
||||
if mylist:
|
||||
try:
|
||||
path = self.person_model.on_get_path(node)
|
||||
self.person_model.row_deleted(path)
|
||||
if len(mylist) == 1:
|
||||
path = self.person_model.on_get_path(top)
|
||||
self.person_model.row_deleted(path)
|
||||
except KeyError:
|
||||
pass
|
||||
self.person_model.rebuild_data(self.DataFilter,skip=node)
|
||||
|
||||
def person_updated(self,handle_list):
|
||||
|
||||
for node in handle_list:
|
||||
person = self.parent.db.get_person_from_handle(node)
|
||||
try:
|
||||
oldpath = self.person_model.iter2path[node]
|
||||
except:
|
||||
return
|
||||
pathval = self.person_model.on_get_path(node)
|
||||
pnode = self.person_model.get_iter(pathval)
|
||||
|
||||
# calculate the new data
|
||||
self.person_model.calculate_data(self.DataFilter)
|
||||
|
||||
# find the path of the person in the new data build
|
||||
newpath = self.person_model.temp_iter2path[node]
|
||||
|
||||
# if paths same, just issue row changed signal
|
||||
|
||||
if oldpath == newpath:
|
||||
self.person_model.row_changed(pathval,pnode)
|
||||
else:
|
||||
# paths different, get the new surname list
|
||||
|
||||
mylist = self.person_model.temp_sname_sub.get(oldpath[0],[])
|
||||
path = self.person_model.on_get_path(node)
|
||||
|
||||
# delete original
|
||||
self.person_model.row_deleted(pathval)
|
||||
|
||||
# delete top node of original if necessar
|
||||
if len(mylist)==0:
|
||||
self.person_model.row_deleted(pathval[0])
|
||||
|
||||
# determine if we need to insert a new top node',
|
||||
insert = not self.person_model.sname_sub.has_key(newpath[0])
|
||||
|
||||
# assign new data
|
||||
self.person_model.assign_data()
|
||||
|
||||
# insert new row if needed
|
||||
if insert:
|
||||
path = self.person_model.on_get_path(newpath[0])
|
||||
pnode = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,pnode)
|
||||
|
||||
# insert new person
|
||||
path = self.person_model.on_get_path(node)
|
||||
pnode = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,pnode)
|
||||
|
||||
self.parent.change_active_person(person)
|
||||
self.goto_active_person()
|
||||
|
@ -67,7 +67,7 @@ _HANDLE_COL = len(column_names)
|
||||
#-------------------------------------------------------------------------
|
||||
class PlaceView:
|
||||
|
||||
def __init__(self,parent,db,glade,update):
|
||||
def __init__(self,parent,db,glade):
|
||||
self.parent = parent
|
||||
self.glade = glade
|
||||
self.list = glade.get_widget("place_list")
|
||||
@ -84,7 +84,7 @@ class PlaceView:
|
||||
self.topWindow = self.glade.get_widget("gramps")
|
||||
|
||||
self.columns = []
|
||||
self.build_columns()
|
||||
self.change_db(db)
|
||||
|
||||
def build_columns(self):
|
||||
for column in self.columns:
|
||||
@ -107,7 +107,22 @@ class PlaceView:
|
||||
self.columns.append(column)
|
||||
self.list.append_column(column)
|
||||
|
||||
def place_add(self,handle_list):
|
||||
for handle in handle_list:
|
||||
self.model.add_row_by_handle(handle)
|
||||
|
||||
def place_update(self,handle_list):
|
||||
for handle in handle_list:
|
||||
self.model.update_row_by_handle(handle)
|
||||
|
||||
def place_delete(self,handle_list):
|
||||
for handle in handle_list:
|
||||
self.model.delete_row_by_handle(handle)
|
||||
|
||||
def change_db(self,db):
|
||||
db.add_place_callbacks(
|
||||
'place_view', self.place_add, self.place_update,
|
||||
self.place_delete, self.build_tree)
|
||||
self.build_columns()
|
||||
self.build_tree()
|
||||
|
||||
@ -123,8 +138,7 @@ class PlaceView:
|
||||
self.selection.selected_foreach(self.blist,mlist)
|
||||
if mlist:
|
||||
place = self.parent.db.get_place_from_handle(mlist[0])
|
||||
EditPlace.EditPlace(self.parent,place,self.update_display,
|
||||
self.topWindow)
|
||||
EditPlace.EditPlace(self.parent,place,self.topWindow)
|
||||
return 1
|
||||
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||
self.build_context_menu(event)
|
||||
@ -165,14 +179,11 @@ class PlaceView:
|
||||
menu.popup(None,None,None,event.button,event.time)
|
||||
|
||||
def on_add_place_clicked(self,obj):
|
||||
EditPlace.EditPlace(self.parent,RelLib.Place(),self.new_place_after_edit)
|
||||
EditPlace.EditPlace(self.parent,RelLib.Place())
|
||||
|
||||
def new_place_after_edit(self,place):
|
||||
self.model.add_row_by_handle(place.get_handle())
|
||||
|
||||
def update_display(self,place):
|
||||
self.model.update_row_by_handle(place.get_handle())
|
||||
|
||||
def delete_place(self,place):
|
||||
trans = self.parent.db.transaction_begin()
|
||||
place_handle = place.get_handle()
|
||||
@ -220,15 +231,15 @@ class PlaceView:
|
||||
|
||||
place = self.parent.db.get_place_from_handle(place_handle)
|
||||
if used == 1:
|
||||
ans = EditPlace.DeletePlaceQuery(place,self.parent.db,
|
||||
self.model.delete_row_by_handle)
|
||||
QuestionDialog(_('Delete %s?') % place.get_title(),
|
||||
_('This place is currently being used by at least one '
|
||||
'record in the database. Deleting it will remove it '
|
||||
'from the database and remove it from all records '
|
||||
'that reference it.'),
|
||||
_('_Delete Place'),
|
||||
ans.query_response)
|
||||
ans = EditPlace.DeletePlaceQuery(place,self.parent.db)
|
||||
QuestionDialog(
|
||||
_('Delete %s?') % place.get_title(),
|
||||
_('This place is currently being used by at least one '
|
||||
'record in the database. Deleting it will remove it '
|
||||
'from the database and remove it from all records '
|
||||
'that reference it.'),
|
||||
_('_Delete Place'),
|
||||
ans.query_response)
|
||||
else:
|
||||
self.delete_place(place)
|
||||
|
||||
@ -239,7 +250,7 @@ class PlaceView:
|
||||
|
||||
for place_handle in mlist:
|
||||
place = self.parent.db.get_place_from_handle(place_handle)
|
||||
EditPlace.EditPlace(self.parent, place, self.update_display)
|
||||
EditPlace.EditPlace(self.parent, place,self.topWindow)
|
||||
|
||||
def blist(self,store,path,iter,list):
|
||||
handle = store.get_value(iter,_HANDLE_COL)
|
||||
|
@ -464,6 +464,7 @@ class GedcomParser:
|
||||
|
||||
if use_trans:
|
||||
self.trans = self.db.transaction_begin()
|
||||
self.trans.set_batch(True)
|
||||
else:
|
||||
self.trans = None
|
||||
t = time.time()
|
||||
@ -490,6 +491,9 @@ class GedcomParser:
|
||||
|
||||
if use_trans:
|
||||
self.db.transaction_commit(self.trans,_("GEDCOM import"))
|
||||
else:
|
||||
self.db.run_person_rebuild_callbacks()
|
||||
self.db.run_family_rebuild_callbacks()
|
||||
|
||||
if self.window:
|
||||
self.infomsg("\n%s" % msg)
|
||||
|
@ -535,6 +535,7 @@ class GrampsParser:
|
||||
def parse(self,file,use_trans=True):
|
||||
if use_trans:
|
||||
self.trans = self.db.transaction_begin()
|
||||
self.trans.set_batch(True)
|
||||
else:
|
||||
self.trans = None
|
||||
p = ParserCreate()
|
||||
@ -560,6 +561,9 @@ class GrampsParser:
|
||||
del p
|
||||
if use_trans:
|
||||
self.db.transaction_commit(self.trans,_("GRAMPS XML import"))
|
||||
else:
|
||||
self.db.run_person_rebuild_callbacks()
|
||||
self.db.run_family_rebuild_callbacks()
|
||||
|
||||
def start_lds_ord(self,attrs):
|
||||
atype = attrs['type']
|
||||
|
@ -64,10 +64,9 @@ _HANDLE_COL = len(column_names)
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SourceView:
|
||||
def __init__(self,parent,db,glade,update):
|
||||
def __init__(self,parent,db,glade):
|
||||
self.parent = parent
|
||||
self.glade = glade
|
||||
self.update = update
|
||||
self.list = glade.get_widget("source_list")
|
||||
#self.list.set_property('fixed-height-mode',True)
|
||||
self.list.connect('button-press-event',self.button_press)
|
||||
@ -81,7 +80,7 @@ class SourceView:
|
||||
self.topWindow = self.glade.get_widget("gramps")
|
||||
|
||||
self.columns = []
|
||||
self.build_columns()
|
||||
self.change_db(db)
|
||||
|
||||
def build_columns(self):
|
||||
for column in self.columns:
|
||||
@ -107,6 +106,9 @@ class SourceView:
|
||||
self.click_col = column
|
||||
|
||||
def change_db(self,db):
|
||||
db.add_source_callbacks(
|
||||
'source_view', self.source_add, self.source_update,
|
||||
self.source_delete, self.build_tree)
|
||||
self.build_columns()
|
||||
self.build_tree()
|
||||
|
||||
@ -124,7 +126,7 @@ class SourceView:
|
||||
handle = mlist[0]
|
||||
source = self.parent.db.get_source_from_handle(handle)
|
||||
EditSource.EditSource(source,self.parent.db,self.parent,
|
||||
self.topWindow,self.update_display)
|
||||
self.topWindow)
|
||||
return True
|
||||
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||
self.build_context_menu(event)
|
||||
@ -165,7 +167,7 @@ class SourceView:
|
||||
|
||||
def on_add_clicked(self,obj):
|
||||
EditSource.EditSource(RelLib.Source(),self.parent.db,self.parent,
|
||||
self.topWindow,self.new_after_edit)
|
||||
self.topWindow)
|
||||
|
||||
def on_delete_clicked(self,obj):
|
||||
store,node = self.selection.get_selected()
|
||||
@ -196,13 +198,19 @@ class SourceView:
|
||||
handle = list_store.get_value(node,_HANDLE_COL)
|
||||
source = self.parent.db.get_source_from_handle(handle)
|
||||
EditSource.EditSource(source, self.parent.db, self.parent,
|
||||
self.topWindow, self.update_display)
|
||||
self.topWindow)
|
||||
|
||||
def new_after_edit(self,source):
|
||||
self.model.add_row_by_handle(source.get_handle())
|
||||
def source_add(self,handle_list):
|
||||
for handle in handle_list:
|
||||
self.model.add_row_by_handle(handle)
|
||||
|
||||
def update_display(self,source):
|
||||
self.model.update_row_by_handle(source.get_handle())
|
||||
def source_update(self,handle_list):
|
||||
for handle in handle_list:
|
||||
self.model.update_row_by_handle(handle)
|
||||
|
||||
def source_delete(self,handle_list):
|
||||
for handle in handle_list:
|
||||
self.model.delete_row_by_handle(handle)
|
||||
|
||||
def blist(self,store,path,iter,sel_list):
|
||||
handle = store.get_value(iter,_HANDLE_COL)
|
||||
|
@ -230,9 +230,8 @@ class SourceSelector:
|
||||
#-------------------------------------------------------------------------
|
||||
class SourceTab:
|
||||
def __init__(self, srclist, parent, top, window, clist, add_btn,
|
||||
edit_btn, del_btn, readonly=False, main_update=None ):
|
||||
edit_btn, del_btn, readonly=False):
|
||||
|
||||
self.main_update = main_update
|
||||
self.db = parent.db
|
||||
self.parent = parent
|
||||
self.list = srclist
|
||||
@ -334,11 +333,11 @@ class SourceTab:
|
||||
if node:
|
||||
col = store.get_path(node)
|
||||
src = self.list[col[0]]
|
||||
SourceEditor(src,self.db,self.update_clist,self, self.main_update)
|
||||
SourceEditor(src,self.db,self.update_clist,self)
|
||||
|
||||
def add_src_clicked(self,obj):
|
||||
src = RelLib.SourceRef()
|
||||
SourceEditor(src,self.db,self.add_ref,self, self.main_update)
|
||||
SourceEditor(src,self.db,self.add_ref,self)
|
||||
|
||||
def del_src_clicked(self,obj):
|
||||
(store,node) = self.selection.get_selected()
|
||||
@ -355,9 +354,8 @@ class SourceTab:
|
||||
#-------------------------------------------------------------------------
|
||||
class SourceEditor:
|
||||
|
||||
def __init__(self, srcref, database, update, parent, main_update=None):
|
||||
def __init__(self, srcref, database, update, parent):
|
||||
|
||||
self.main_update = main_update
|
||||
self.db = database
|
||||
self.parent = parent
|
||||
if self.parent.__dict__.has_key('child_windows'):
|
||||
@ -573,11 +571,8 @@ class SourceEditor:
|
||||
|
||||
def update_display(self,source):
|
||||
self.draw(source,fresh=False)
|
||||
if self.main_update:
|
||||
self.main_update()
|
||||
|
||||
def add_src_clicked(self,obj):
|
||||
import EditSource
|
||||
EditSource.EditSource(RelLib.Source(),self.db, self,
|
||||
self.sourceDisplay, self.update_display)
|
||||
EditSource.EditSource(RelLib.Source(),self.db, self)
|
||||
|
||||
|
@ -323,10 +323,8 @@ class Gramps:
|
||||
self.change_active_person, self.load_person
|
||||
)
|
||||
|
||||
self.place_view = PlaceView.PlaceView(self,self.db,self.gtop,
|
||||
self.update_display)
|
||||
self.source_view = SourceView.SourceView(self,self.db,self.gtop,
|
||||
self.update_display)
|
||||
self.place_view = PlaceView.PlaceView(self,self.db,self.gtop)
|
||||
self.source_view = SourceView.SourceView(self,self.db,self.gtop)
|
||||
self.media_view = MediaView.MediaView(self,self.db,self.gtop,
|
||||
self.update_display)
|
||||
|
||||
@ -499,11 +497,11 @@ class Gramps:
|
||||
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.family_view.change_db()
|
||||
self.people_view.change_db(self.db)
|
||||
self.people_view.apply_filter()
|
||||
self.source_view.change_db(self.db)
|
||||
self.media_view.change_db(self.db)
|
||||
self.family_view.load_family()
|
||||
|
||||
def exit_and_undo(self,*args):
|
||||
self.db.abort_changes()
|
||||
@ -1117,6 +1115,7 @@ class Gramps:
|
||||
if Utils.wasHistory_broken():
|
||||
self.clear_history()
|
||||
Utils.clearHistory_broken()
|
||||
self.family_view.change_db()
|
||||
self.people_view.change_db(self.db)
|
||||
self.people_view.apply_filter()
|
||||
if not self.active_person:
|
||||
@ -1132,8 +1131,6 @@ class Gramps:
|
||||
page = self.views.get_current_page()
|
||||
if page == PERSON_VIEW:
|
||||
self.people_view.apply_filter()
|
||||
elif page == FAMILY_VIEW1 or page == FAMILY_VIEW2:
|
||||
self.family_view.load_family()
|
||||
elif page == PEDIGREE_VIEW:
|
||||
self.pedigree_view.load_canvas(self.active_person)
|
||||
|
||||
@ -1327,13 +1324,14 @@ class Gramps:
|
||||
else:
|
||||
# File is lost => ask what to do
|
||||
if missmedia_action == 0:
|
||||
mmd = MissingMediaDialog(_("Media object could not be found"),
|
||||
_("%(file_name)s is referenced in the database, but no longer exists. "
|
||||
"The file may have been deleted or moved to a different location. "
|
||||
"You may choose to either remove the reference from the database, "
|
||||
"keep the reference to the missing file, or select a new file."
|
||||
) % { 'file_name' : oldfile },
|
||||
remove_clicked, leave_clicked, select_clicked)
|
||||
mmd = MissingMediaDialog(
|
||||
_("Media object could not be found"),
|
||||
_("%(file_name)s is referenced in the database, but no longer exists. "
|
||||
"The file may have been deleted or moved to a different location. "
|
||||
"You may choose to either remove the reference from the database, "
|
||||
"keep the reference to the missing file, or select a new file."
|
||||
) % { 'file_name' : oldfile },
|
||||
remove_clicked, leave_clicked, select_clicked)
|
||||
missmedia_action = mmd.default_action
|
||||
elif missmedia_action == 1:
|
||||
remove_clicked()
|
||||
@ -1351,9 +1349,6 @@ class Gramps:
|
||||
def load_active_person(self,obj):
|
||||
self.load_person(self.active_person)
|
||||
|
||||
def update_person_list(self,person):
|
||||
self.people_view.add_to_person_list(person,0)
|
||||
|
||||
def load_new_person(self,obj):
|
||||
person = RelLib.Person()
|
||||
try:
|
||||
@ -1439,8 +1434,6 @@ class Gramps:
|
||||
self.people_view.remove_from_person_list(person)
|
||||
self.people_view.remove_from_history(handle)
|
||||
self.db.remove_person(handle, trans)
|
||||
self.people_view.delete_person(person)
|
||||
self.people_view.person_model.rebuild_data()
|
||||
|
||||
if self.hindex >= 0:
|
||||
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
|
||||
@ -1453,8 +1446,6 @@ class Gramps:
|
||||
|
||||
def merge_update(self):
|
||||
self.redraw_histmenu()
|
||||
self.people_view.build_tree()
|
||||
self.update_display(0)
|
||||
|
||||
def goto_active_person(self):
|
||||
self.people_view.goto_active_person()
|
||||
@ -1536,7 +1527,6 @@ class Gramps:
|
||||
def on_import_activate(self,obj):
|
||||
prompter = DbPrompter.ImportDbPrompter(self,self.topWindow)
|
||||
prompter.chooser()
|
||||
self.update_display()
|
||||
|
||||
def on_saveas_activate(self,obj):
|
||||
prompter = DbPrompter.NewSaveasDbPrompter(self,self.topWindow)
|
||||
@ -1625,42 +1615,11 @@ class Gramps:
|
||||
|
||||
def new_after_edit(self,epo,val):
|
||||
self.active_person = epo.person
|
||||
self.people_view.build_tree()
|
||||
self.family_view.load_family()
|
||||
self.place_view.build_tree()
|
||||
self.source_view.build_tree()
|
||||
self.update_display(0)
|
||||
self.goto_active_person()
|
||||
|
||||
def update_after_newchild(self,family,person,plist):
|
||||
self.family_view.load_family(family)
|
||||
self.people_view.redisplay_person_list(person)
|
||||
for p in plist:
|
||||
self.place_view.new_place_after_edit(p)
|
||||
|
||||
def update_after_edit(self,epo,change=1):
|
||||
self.active_person = epo.person
|
||||
pn = self.active_person.get_primary_name()
|
||||
|
||||
mapname = self.db.get_name_group_mapping(pn.get_group_name())
|
||||
|
||||
if epo.orig_surname in [pn.get_group_name(), mapname ]:
|
||||
self.people_view.build_tree()
|
||||
elif change:
|
||||
self.people_view.update_person_list(epo.person)
|
||||
else:
|
||||
self.people_view.redisplay_person_list(epo.person)
|
||||
self.family_view.load_family()
|
||||
self.place_view.build_tree()
|
||||
self.source_view.build_tree()
|
||||
self.update_display(0)
|
||||
self.goto_active_person()
|
||||
|
||||
def update_after_merge(self,person,old_id):
|
||||
if person:
|
||||
self.people_view.redisplay_person_list(person)
|
||||
self.update_display(0)
|
||||
|
||||
def load_person(self,person):
|
||||
if person:
|
||||
try:
|
||||
@ -1714,6 +1673,7 @@ class Gramps:
|
||||
if callback:
|
||||
callback(_('Building Person list...'))
|
||||
self.people_view.change_db(self.db)
|
||||
self.family_view.change_db()
|
||||
if callback:
|
||||
callback(_('Building Place list...'))
|
||||
self.place_view.change_db(self.db)
|
||||
|
Loading…
Reference in New Issue
Block a user