3667: Addings a new person and changing the name grouping results in frozen window

svn: r14663
This commit is contained in:
Benny Malengier 2010-03-07 15:34:32 +00:00
parent 129d6e6fbd
commit e0b0b14c2d
4 changed files with 21 additions and 7 deletions

View File

@ -193,6 +193,9 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
# 3. Special signal for change in home person
__signals__['home-person-changed'] = None
# 4. Signal for change in person group name, parameters are
__signals__['person-groupname-rebuild'] = (unicode, unicode)
def __init__(self):
"""Create a new GrampsDB."""
@ -1265,13 +1268,17 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
if not self.readonly:
# Start transaction
with BSDDBTxn(self.env, self.name_group) as txn:
name = str(name)
data = txn.get(name)
sname = str(name)
data = txn.get(sname)
if data is not None:
txn.delete(name)
txn.delete(sname)
if group is not None:
txn.put(name, group)
self.emit('person-rebuild')
txn.put(sname, group)
if group == None:
grouppar = u''
else:
grouppar = group
self.emit('person-groupname-rebuild', (name, grouppar))
def sort_surname_list(self):
self.surname_list.sort(key=locale.strxfrm)

View File

@ -55,7 +55,13 @@ class Name(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase):
FN = 4 # first name
def __init__(self, source=None, data=None):
"""Create a new Name instance, copying from the source if provided."""
"""Create a new Name instance, copying from the source if provided.
We should connect here to 'person-groupname-rebuild' and do something
correct when first parameter is the name, and second parameter is
different from the group here. However, that would be complicated and
no real errors that cannot be ammended can be done if group is
saved differently.
"""
PrivacyBase.__init__(self, source)
SourceBase.__init__(self, source)
NoteBase.__init__(self, source)

View File

@ -708,7 +708,7 @@ class ListView(NavigationView):
else:
self.dirty = True
def object_build(self):
def object_build(self, *args):
"""
Called when the tree must be rebuilt and bookmarks redrawn.
"""

View File

@ -120,6 +120,7 @@ class BasePersonView(ListView):
'person-update' : self.row_update,
'person-delete' : self.row_delete,
'person-rebuild' : self.object_build,
'person-groupname-rebuild' : self.object_build,
}
ListView.__init__(