* src/EditPerson.py: enhanced update/delete/add of person view
* src/PeopleModel.py: enhanced update/delete/add of person view * src/PeopleView.py: enhanced update/delete/add of person view * src/gramps_main.py: enhanced update/delete/add of person view svn: r3592
This commit is contained in:
parent
7189f043dc
commit
2b6bf2791f
@ -1,4 +1,8 @@
|
|||||||
2004-09-30 Don Allingham <dallingham@users.sourceforge.net>
|
2004-09-30 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/EditPerson.py: enhanced update/delete/add of person view
|
||||||
|
* src/PeopleModel.py: enhanced update/delete/add of person view
|
||||||
|
* src/PeopleView.py: enhanced update/delete/add of person view
|
||||||
|
* src/gramps_main.py: enhanced update/delete/add of person view
|
||||||
* src/DisplayModels.py: change 0 to False
|
* src/DisplayModels.py: change 0 to False
|
||||||
* src/EditPerson.py: copy current name info to name editor when invoking
|
* src/EditPerson.py: copy current name info to name editor when invoking
|
||||||
* src/GrampsBSDDB.py: provide default name to group mapping
|
* src/GrampsBSDDB.py: provide default name to group mapping
|
||||||
|
@ -1620,14 +1620,16 @@ class EditPerson:
|
|||||||
|
|
||||||
if not self.person.get_handle():
|
if not self.person.get_handle():
|
||||||
self.db.add_person(self.person, trans)
|
self.db.add_person(self.person, trans)
|
||||||
|
call_value = 0
|
||||||
else:
|
else:
|
||||||
if not self.person.get_gramps_id():
|
if not self.person.get_gramps_id():
|
||||||
self.person.set_gramps_id(self.db.find_next_person_gramps_id())
|
self.person.set_gramps_id(self.db.find_next_person_gramps_id())
|
||||||
|
call_value = 1
|
||||||
self.db.commit_person(self.person, trans)
|
self.db.commit_person(self.person, trans)
|
||||||
n = self.person.get_primary_name().get_regular_name()
|
n = self.person.get_primary_name().get_regular_name()
|
||||||
self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
|
self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
|
||||||
if self.callback:
|
if self.callback:
|
||||||
self.callback(self,1)
|
self.callback(self,call_value)
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def get_place(self,field,makenew=0):
|
def get_place(self,field,makenew=0):
|
||||||
|
@ -72,16 +72,15 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self.db = db
|
self.db = db
|
||||||
self.visible = {}
|
self.visible = {}
|
||||||
self.top_visible = {}
|
self.top_visible = {}
|
||||||
|
|
||||||
# maps = self.db.get_people_view_maps()
|
maps = self.db.get_people_view_maps()
|
||||||
# print
|
if maps[0] != None and len(maps[0]) != 0:
|
||||||
# if maps[0] != None and len(maps[0]) != 0:
|
self.top_path2iter = maps[0]
|
||||||
# self.top_path2iter = maps[0]
|
self.iter2path = maps[1]
|
||||||
# self.iter2path = maps[1]
|
self.path2iter = maps[2]
|
||||||
# self.path2iter = maps[2]
|
self.sname_sub = maps[3]
|
||||||
# self.sname_sub = maps[3]
|
else:
|
||||||
# else:
|
self.rebuild_data()
|
||||||
self.rebuild_data()
|
|
||||||
|
|
||||||
def rebuild_data(self):
|
def rebuild_data(self):
|
||||||
self.top_path2iter = []
|
self.top_path2iter = []
|
||||||
@ -179,6 +178,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
try:
|
try:
|
||||||
return COLUMN_DEFS[col][COLUMN_DEF_LIST](self,self.db.person_map[str(node)],node)
|
return COLUMN_DEFS[col][COLUMN_DEF_LIST](self,self.db.person_map[str(node)],node)
|
||||||
except:
|
except:
|
||||||
|
print "except"
|
||||||
return u''
|
return u''
|
||||||
|
|
||||||
def reset_visible(self):
|
def reset_visible(self):
|
||||||
|
@ -121,7 +121,7 @@ class PeopleView:
|
|||||||
#self.sort_model = self.person_model.filter_new()
|
#self.sort_model = self.person_model.filter_new()
|
||||||
self.sort_model = self.person_model
|
self.sort_model = self.person_model
|
||||||
self.person_tree.set_model(self.sort_model)
|
self.person_tree.set_model(self.sort_model)
|
||||||
|
|
||||||
def blist(self, store, path, iter, id_list):
|
def blist(self, store, path, iter, id_list):
|
||||||
id_list.append(self.sort_model.get_value(iter,PeopleModel.COLUMN_INT_ID))
|
id_list.append(self.sort_model.get_value(iter,PeopleModel.COLUMN_INT_ID))
|
||||||
|
|
||||||
@ -202,9 +202,6 @@ class PeopleView:
|
|||||||
self.parent.load_person(self.parent.active_person)
|
self.parent.load_person(self.parent.active_person)
|
||||||
|
|
||||||
def apply_filter(self,current_model=None):
|
def apply_filter(self,current_model=None):
|
||||||
self.build_tree()
|
|
||||||
return
|
|
||||||
|
|
||||||
self.person_model.rebuild_data()
|
self.person_model.rebuild_data()
|
||||||
self.parent.status_text(_('Updating display...'))
|
self.parent.status_text(_('Updating display...'))
|
||||||
keys = self.DataFilter.apply(self.parent.db,
|
keys = self.DataFilter.apply(self.parent.db,
|
||||||
@ -261,5 +258,33 @@ class PeopleView:
|
|||||||
menu.popup(None,None,None,event.button,event.time)
|
menu.popup(None,None,None,event.button,event.time)
|
||||||
|
|
||||||
def redisplay_person_list(self,person):
|
def redisplay_person_list(self,person):
|
||||||
self.build_tree()
|
self.person_model.rebuild_data()
|
||||||
|
self.add_person(person)
|
||||||
|
|
||||||
|
def add_person(self,person):
|
||||||
|
node = person.get_handle()
|
||||||
|
top = person.get_primary_name().get_group_name()
|
||||||
|
if len(self.person_model.sname_sub[top]) == 1:
|
||||||
|
path = self.person_model.on_get_path(top)
|
||||||
|
iter = self.person_model.get_iter(path)
|
||||||
|
self.person_model.row_inserted(path,iter)
|
||||||
|
path = self.person_model.on_get_path(node)
|
||||||
|
iter = self.person_model.get_iter(path)
|
||||||
|
self.person_model.row_inserted(path,iter)
|
||||||
|
|
||||||
|
def delete_person(self,person):
|
||||||
|
node = person.get_handle()
|
||||||
|
top = person.get_primary_name().get_group_name()
|
||||||
|
if len(self.person_model.sname_sub[top]) == 1:
|
||||||
|
path = self.person_model.on_get_path(top)
|
||||||
|
self.person_model.row_deleted(path)
|
||||||
|
path = self.person_model.on_get_path(node)
|
||||||
|
self.person_model.row_deleted(path)
|
||||||
|
|
||||||
|
def update_person_list(self,person):
|
||||||
|
self.delete_person(person)
|
||||||
|
self.person_model.rebuild_data()
|
||||||
|
self.add_person(person)
|
||||||
|
self.parent.change_active_person(person)
|
||||||
|
self.goto_active_person()
|
||||||
|
|
||||||
|
@ -176,7 +176,6 @@ class Gramps:
|
|||||||
TipOfDay.TipOfDay()
|
TipOfDay.TipOfDay()
|
||||||
|
|
||||||
self.db.set_researcher(GrampsCfg.get_researcher())
|
self.db.set_researcher(GrampsCfg.get_researcher())
|
||||||
#self.update_display(0)
|
|
||||||
|
|
||||||
def date_format_key_update(self,client,cnxn_id,entry,data):
|
def date_format_key_update(self,client,cnxn_id,entry,data):
|
||||||
GrampsCfg.set_calendar_date_format()
|
GrampsCfg.set_calendar_date_format()
|
||||||
@ -1212,6 +1211,9 @@ class Gramps:
|
|||||||
else:
|
else:
|
||||||
mlist = [ self.active_person.get_handle() ]
|
mlist = [ self.active_person.get_handle() ]
|
||||||
|
|
||||||
|
if len(mlist) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
for sel in mlist:
|
for sel in mlist:
|
||||||
p = self.db.get_person_from_handle(sel)
|
p = self.db.get_person_from_handle(sel)
|
||||||
self.active_person = p
|
self.active_person = p
|
||||||
@ -1226,8 +1228,6 @@ class Gramps:
|
|||||||
_('_Delete Person'),
|
_('_Delete Person'),
|
||||||
self.delete_person_response)
|
self.delete_person_response)
|
||||||
|
|
||||||
self.update_display(0)
|
|
||||||
|
|
||||||
def delete_person_response(self):
|
def delete_person_response(self):
|
||||||
trans = self.db.transaction_begin()
|
trans = self.db.transaction_begin()
|
||||||
|
|
||||||
@ -1267,9 +1267,13 @@ class Gramps:
|
|||||||
self.db.commit_family(family,trans)
|
self.db.commit_family(family,trans)
|
||||||
|
|
||||||
id = self.active_person.get_handle()
|
id = self.active_person.get_handle()
|
||||||
self.people_view.remove_from_person_list(self.active_person)
|
|
||||||
|
person = self.active_person
|
||||||
|
self.people_view.remove_from_person_list(person)
|
||||||
self.people_view.remove_from_history(id)
|
self.people_view.remove_from_history(id)
|
||||||
self.db.remove_person(id, trans)
|
self.db.remove_person(id, trans)
|
||||||
|
self.people_view.delete_person(person)
|
||||||
|
self.people_view.person_model.rebuild_data()
|
||||||
|
|
||||||
if self.hindex >= 0:
|
if self.hindex >= 0:
|
||||||
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
|
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
|
||||||
@ -1457,9 +1461,11 @@ class Gramps:
|
|||||||
self.place_view.new_place_after_edit(p)
|
self.place_view.new_place_after_edit(p)
|
||||||
|
|
||||||
def update_after_edit(self,epo,change=1):
|
def update_after_edit(self,epo,change=1):
|
||||||
if epo:
|
if change:
|
||||||
|
self.people_view.update_person_list(epo.person)
|
||||||
|
else:
|
||||||
self.people_view.redisplay_person_list(epo.person)
|
self.people_view.redisplay_person_list(epo.person)
|
||||||
self.family_view.load_family()
|
self.family_view.load_family()
|
||||||
self.update_display(0)
|
self.update_display(0)
|
||||||
self.goto_active_person()
|
self.goto_active_person()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user