3667: Addings a new person and changing the name grouping results in frozen window
svn: r14663
This commit is contained in:
		| @@ -194,6 +194,9 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): | |||||||
|     # 3. Special signal for change in home person |     # 3. Special signal for change in home person | ||||||
|     __signals__['home-person-changed'] = None |     __signals__['home-person-changed'] = None | ||||||
|      |      | ||||||
|  |     # 4. Signal for change in person group name, parameters are  | ||||||
|  |     __signals__['person-groupname-rebuild'] = (unicode, unicode) | ||||||
|  |  | ||||||
|     def __init__(self): |     def __init__(self): | ||||||
|         """Create a new GrampsDB.""" |         """Create a new GrampsDB.""" | ||||||
|          |          | ||||||
| @@ -1265,13 +1268,17 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): | |||||||
|         if not self.readonly: |         if not self.readonly: | ||||||
|             # Start transaction |             # Start transaction | ||||||
|             with BSDDBTxn(self.env, self.name_group) as txn: |             with BSDDBTxn(self.env, self.name_group) as txn: | ||||||
|                 name = str(name) |                 sname = str(name) | ||||||
|                 data = txn.get(name) |                 data = txn.get(sname) | ||||||
|                 if data is not None: |                 if data is not None: | ||||||
|                     txn.delete(name) |                     txn.delete(sname) | ||||||
|                 if group is not None: |                 if group is not None: | ||||||
|                     txn.put(name, group) |                     txn.put(sname, group) | ||||||
|             self.emit('person-rebuild') |             if group == None: | ||||||
|  |                 grouppar = u'' | ||||||
|  |             else: | ||||||
|  |                 grouppar = group | ||||||
|  |             self.emit('person-groupname-rebuild', (name, grouppar)) | ||||||
|  |  | ||||||
|     def sort_surname_list(self): |     def sort_surname_list(self): | ||||||
|         self.surname_list.sort(key=locale.strxfrm) |         self.surname_list.sort(key=locale.strxfrm) | ||||||
|   | |||||||
| @@ -55,7 +55,13 @@ class Name(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase): | |||||||
|     FN   = 4  # first name |     FN   = 4  # first name | ||||||
|  |  | ||||||
|     def __init__(self, source=None, data=None): |     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) |         PrivacyBase.__init__(self, source) | ||||||
|         SourceBase.__init__(self, source) |         SourceBase.__init__(self, source) | ||||||
|         NoteBase.__init__(self, source) |         NoteBase.__init__(self, source) | ||||||
|   | |||||||
| @@ -708,7 +708,7 @@ class ListView(NavigationView): | |||||||
|         else: |         else: | ||||||
|             self.dirty = True |             self.dirty = True | ||||||
|  |  | ||||||
|     def object_build(self): |     def object_build(self, *args): | ||||||
|         """ |         """ | ||||||
|         Called when the tree must be rebuilt and bookmarks redrawn. |         Called when the tree must be rebuilt and bookmarks redrawn. | ||||||
|         """ |         """ | ||||||
|   | |||||||
| @@ -120,6 +120,7 @@ class BasePersonView(ListView): | |||||||
|             'person-update'  : self.row_update, |             'person-update'  : self.row_update, | ||||||
|             'person-delete'  : self.row_delete, |             'person-delete'  : self.row_delete, | ||||||
|             'person-rebuild' : self.object_build, |             'person-rebuild' : self.object_build, | ||||||
|  |             'person-groupname-rebuild' : self.object_build, | ||||||
|             } |             } | ||||||
|   |   | ||||||
|         ListView.__init__( |         ListView.__init__( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user