From e0b0b14c2d603ac552b2f8b1316752cf41bf335b Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sun, 7 Mar 2010 15:34:32 +0000 Subject: [PATCH] 3667: Addings a new person and changing the name grouping results in frozen window svn: r14663 --- src/gen/db/write.py | 17 ++++++++++++----- src/gen/lib/name.py | 8 +++++++- src/gui/views/listview.py | 2 +- src/plugins/lib/libpersonview.py | 1 + 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/gen/db/write.py b/src/gen/db/write.py index dfe643eb3..e3a63ec8b 100644 --- a/src/gen/db/write.py +++ b/src/gen/db/write.py @@ -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) diff --git a/src/gen/lib/name.py b/src/gen/lib/name.py index dedb43a8d..5f52b0d42 100644 --- a/src/gen/lib/name.py +++ b/src/gen/lib/name.py @@ -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) diff --git a/src/gui/views/listview.py b/src/gui/views/listview.py index f46da3fde..10d79d2e0 100644 --- a/src/gui/views/listview.py +++ b/src/gui/views/listview.py @@ -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. """ diff --git a/src/plugins/lib/libpersonview.py b/src/plugins/lib/libpersonview.py index 47ba644b7..7c9212970 100644 --- a/src/plugins/lib/libpersonview.py +++ b/src/plugins/lib/libpersonview.py @@ -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__(